2 * Copyright 2006-2007, Haiku. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Stephan Aßmus <superstippi@gmx.de>
8 #ifndef LITTLE_ENDIAN_BUFFER_H
9 #define LITTLE_ENDIAN_BUFFER_H
12 #include <SupportDefs.h>
14 #include "IconBuild.h"
20 class LittleEndianBuffer
{
23 LittleEndianBuffer(size_t size
);
24 LittleEndianBuffer(uint8
* buffer
,
26 ~LittleEndianBuffer();
28 bool Write(uint8 value
);
29 bool Write(uint16 value
);
30 bool Write(uint32 value
);
31 bool Write(float value
);
32 bool Write(double value
);
34 bool Write(const LittleEndianBuffer
& other
);
35 bool Write(const uint8
* buffer
, size_t bytes
);
37 bool Read(uint8
& value
);
38 bool Read(uint16
& value
);
39 bool Read(uint32
& value
);
40 bool Read(float& value
);
41 bool Read(double& value
);
42 bool Read(LittleEndianBuffer
& other
, size_t bytes
);
44 void Skip(size_t bytes
);
48 size_t SizeUsed() const
49 { return fHandle
- fBuffer
; }
54 void _SetSize(size_t size
);
67 #endif // LITTLE_ENDIAN_BUFFER_H