BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / translators / psd / DataArray.h
blobfba0546649a42df580a1a7d9b955477951da117e
1 /*
2 * Copyright 2013, Gerasim Troeglazov, 3dEyes@gmail.com. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
7 #ifndef PSD_DATA_ARRAY_H
8 #define PSD_DATA_ARRAY_H
10 #include <stdlib.h>
11 #include <stdio.h>
12 #include <string.h>
14 #include <String.h>
15 #include <DataIO.h>
16 #include <File.h>
17 #include <ByteOrder.h>
19 #define DATAARRAY_BLOCK_SIZE 1024
21 class BDataArray {
22 public:
23 BDataArray(int32 blockSize = DATAARRAY_BLOCK_SIZE);
24 ~BDataArray();
26 BDataArray& Append(int8 val);
27 BDataArray& Append(uint8 val);
28 BDataArray& Append(int16 val);
29 BDataArray& Append(uint16 val);
30 BDataArray& Append(int32 val);
31 BDataArray& Append(uint32 val);
32 BDataArray& Append(int64 val);
33 BDataArray& Append(uint64 val);
34 BDataArray& Append(const char *str);
35 BDataArray& Append(BString& str);
36 BDataArray& Append(BDataArray& str);
37 BDataArray& Append(uint8 *ptr, int32 len);
39 BDataArray& Repeat(uint8 byte, int32 count);
41 BDataArray& operator<<(int8);
42 BDataArray& operator<<(uint8);
43 BDataArray& operator<<(int16);
44 BDataArray& operator<<(uint16);
45 BDataArray& operator<<(int32);
46 BDataArray& operator<<(uint32);
47 BDataArray& operator<<(int64);
48 BDataArray& operator<<(uint64);
49 BDataArray& operator<<(const char*);
50 BDataArray& operator<<(BDataArray&);
52 uint8 *Buffer(void);
53 int32 Length(void);
55 ssize_t WriteToStream(BPositionIO *stream);
57 private:
58 inline status_t _ReallocArrayFor(int32 size);
60 uint8 *fData;
61 int32 fDataSize;
62 int32 fAllocatedDataSize;
63 int32 fBlockSize;
67 #endif /* PSD_DATA_ARRAY_H */