2009-11-15 21:29:53 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2011-01-30 15:05:38 +00:00
|
|
|
#ifndef _PACKAGE__HPKG__DATA_OUTPUT_H_
|
|
|
|
#define _PACKAGE__HPKG__DATA_OUTPUT_H_
|
2009-11-15 21:29:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
|
|
|
|
2011-01-27 23:17:03 +00:00
|
|
|
namespace BPackageKit {
|
|
|
|
|
2011-01-30 15:05:38 +00:00
|
|
|
namespace BHPKG {
|
2011-01-27 23:17:03 +00:00
|
|
|
|
|
|
|
|
2011-01-30 15:05:38 +00:00
|
|
|
class BDataOutput {
|
2009-11-15 21:29:53 +00:00
|
|
|
public:
|
2011-01-30 15:05:38 +00:00
|
|
|
virtual ~BDataOutput();
|
2009-11-15 21:29:53 +00:00
|
|
|
|
|
|
|
virtual status_t WriteData(const void* buffer, size_t size) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-30 15:05:38 +00:00
|
|
|
class BBufferDataOutput : public BDataOutput {
|
2009-11-15 21:29:53 +00:00
|
|
|
public:
|
2011-01-30 15:05:38 +00:00
|
|
|
BBufferDataOutput(void* buffer, size_t size);
|
2009-11-15 21:29:53 +00: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 15:05:38 +00:00
|
|
|
} // namespace BHPKG
|
2011-01-27 23:17:03 +00:00
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
2011-01-30 15:05:38 +00:00
|
|
|
#endif // _PACKAGE__HPKG__DATA_OUTPUT_H_
|