2 * This file is part of ShapeFusion (Copyright 2000 Tito Dal Canton)
4 * ShapeFusion is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * ShapeFusion is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with ShapeFusion; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 // Utility class to access little-endian data buffers easily
24 #ifndef LITTLEENDIANBUFFER_H
25 #define LITTLEENDIANBUFFER_H
27 #include "GenericEndianBuffer.h"
29 class LittleEndianBuffer: public GenericEndianBuffer {
31 // self-allocate data buffer
32 LittleEndianBuffer(unsigned int _size);
33 // use a pre-allocated buffer
34 LittleEndianBuffer(unsigned char *_data, unsigned int _size);
35 ~LittleEndianBuffer(void);
36 // read little-endian values, advance position accordingly
37 short ReadShort(void);
38 unsigned short ReadUShort(void);
40 unsigned long ReadULong(void);
41 // write little-endian values, advance position accordingly
42 void WriteShort(short v);
43 void WriteUShort(unsigned short v);
44 void WriteLong(long v);
45 void WriteULong(unsigned long v);