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