-
Notifications
You must be signed in to change notification settings - Fork 1
/
fileio.h
38 lines (29 loc) · 836 Bytes
/
fileio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef __FILEIO_H
#define __FILEIO_H
namespace UOX
{
class UOXFile
{
public:
UOXFile( const char* const, const char* const );
~UOXFile();
inline int ready( void ) const { return ( memPtr != NULL ); }
void rewind( void ) { bIndex = 0; }
void seek( size_t, UI08 );
bool eof( void ) const { return ( bIndex >= fileSize ); }
int getch( void );
void getUChar( UI08 *, UI32 = 1 );
void getChar( SI08 *, UI32 = 1 );
void getUShort( UI16 *, UI32 = 1 );
void getShort( SI16 *, UI32 = 1 );
void getULong( UI32 *, UI32 = 1 );
void getLong( SI32 *, UI32 = 1 );
size_t getPosition( void ) const { return bIndex; }
size_t getLength( void ) const { return fileSize; }
private:
char *memPtr; // ptr to the beginning of the files
size_t fileSize; // file size
size_t bIndex; // current position
};
}
#endif