2009-11-16 00:29:53 +03:00
|
|
|
/*
|
2011-01-30 18:15:33 +03:00
|
|
|
* Copyright 2009,2011, Haiku, Inc.
|
2009-11-16 00:29:53 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2011-01-30 18:05:38 +03:00
|
|
|
#ifndef _PACKAGE__HPKG__DATA_OUTPUT_H_
|
|
|
|
#define _PACKAGE__HPKG__DATA_OUTPUT_H_
|
2009-11-16 00:29:53 +03:00
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
|
2011-01-28 02:17:03 +03:00
|
|
|
namespace BPackageKit {
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
namespace BHPKG {
|
2011-01-28 02:17:03 +03:00
|
|
|
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
class BDataOutput {
|
2009-11-16 00:29:53 +03:00
|
|
|
public:
|
2011-01-30 18:05:38 +03:00
|
|
|
virtual ~BDataOutput();
|
2009-11-16 00:29:53 +03:00
|
|
|
|
|
|
|
virtual status_t WriteData(const void* buffer, size_t size) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
class BBufferDataOutput : public BDataOutput {
|
2009-11-16 00:29:53 +03:00
|
|
|
public:
|
2011-01-30 18:05:38 +03:00
|
|
|
BBufferDataOutput(void* buffer, size_t size);
|
2009-11-16 00:29:53 +03:00
|
|
|
|
|
|
|
size_t BytesWritten() const { return fBytesWritten; }
|
|
|
|
|
|
|
|
virtual status_t WriteData(const void* buffer, size_t size);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void* fBuffer;
|
|
|
|
size_t fSize;
|
|
|
|
size_t fBytesWritten;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
} // namespace BHPKG
|
2011-01-28 02:17:03 +03:00
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
#endif // _PACKAGE__HPKG__DATA_OUTPUT_H_
|