Restore the "GPL licensing not permitted" in GLUT license headers.
[haiku.git] / headers / os / package / hpkg / DataReader.h
blobfec3b20e22b7c0e0aae3fad936dff06ad311cefd
1 /*
2 * Copyright 2009-2014, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _PACKAGE__HPKG__DATA_READER_H_
6 #define _PACKAGE__HPKG__DATA_READER_H_
9 #include <SupportDefs.h>
12 class BDataIO;
15 namespace BPackageKit {
17 namespace BHPKG {
20 class BDataReader {
21 public:
22 virtual ~BDataReader();
24 virtual status_t ReadData(off_t offset, void* buffer,
25 size_t size) = 0;
29 class BAbstractBufferedDataReader : public BDataReader {
30 public:
31 virtual ~BAbstractBufferedDataReader();
33 virtual status_t ReadData(off_t offset, void* buffer,
34 size_t size);
35 virtual status_t ReadDataToOutput(off_t offset, size_t size,
36 BDataIO* output) = 0;
40 class BFDDataReader : public BDataReader {
41 public:
42 BFDDataReader(int fd);
44 void SetFD(int fd);
46 virtual status_t ReadData(off_t offset, void* buffer,
47 size_t size);
49 private:
50 int fFD;
54 class BAttributeDataReader : public BDataReader {
55 public:
56 BAttributeDataReader(int fd,
57 const char* attribute, uint32 type);
59 virtual status_t ReadData(off_t offset, void* buffer,
60 size_t size);
62 private:
63 int fFD;
64 uint32 fType;
65 const char* fAttribute;
69 class BBufferDataReader : public BAbstractBufferedDataReader {
70 public:
71 BBufferDataReader(const void* data, size_t size);
73 virtual status_t ReadData(off_t offset, void* buffer,
74 size_t size);
75 virtual status_t ReadDataToOutput(off_t offset, size_t size,
76 BDataIO* output);
78 private:
79 const void* fData;
80 size_t fSize;
84 } // namespace BHPKG
86 } // namespace BPackageKit
89 #endif // _PACKAGE__HPKG__DATA_READER_H_