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 big-endian data buffers easily
24 #ifndef BIGENDIANBUFFER_H
25 #define BIGENDIANBUFFER_H
27 #include "GenericEndianBuffer.h"
29 class BigEndianBuffer: public GenericEndianBuffer {
31 // self-allocate data buffer
32 BigEndianBuffer(unsigned int _size);
33 // use a pre-allocated buffer
34 BigEndianBuffer(unsigned char *_data, unsigned int _size);
35 ~BigEndianBuffer(void);
36 // read big-endian values, advance position accordingly
37 short ReadShort(void);
38 unsigned short ReadUShort(void);
40 unsigned long ReadULong(void);
41 double ReadFixed(void) { return ReadLong() / 65536.0; }
43 // write big-endian values, advance position accordingly
44 void WriteShort(short v);
45 void WriteUShort(unsigned short v);
46 void WriteLong(long v);
47 void WriteULong(unsigned long v);
48 void WriteFixed(double d);