| 1 |
//======================================================================== |
| 2 |
// |
| 3 |
// FoFiBase.h |
| 4 |
// |
| 5 |
// Copyright 1999-2003 Glyph & Cog, LLC |
| 6 |
// |
| 7 |
//======================================================================== |
| 8 |
|
| 9 |
#ifndef FOFIBASE_H |
| 10 |
#define FOFIBASE_H |
| 11 |
|
| 12 |
#include <aconf.h> |
| 13 |
|
| 14 |
#include "gtypes.h" |
| 15 |
|
| 16 |
//------------------------------------------------------------------------ |
| 17 |
|
| 18 |
typedef void (*FoFiOutputFunc)(void *stream, const char *data, int len); |
| 19 |
|
| 20 |
//------------------------------------------------------------------------ |
| 21 |
// FoFiBase |
| 22 |
//------------------------------------------------------------------------ |
| 23 |
|
| 24 |
class FoFiBase { |
| 25 |
public: |
| 26 |
|
| 27 |
virtual ~FoFiBase(); |
| 28 |
|
| 29 |
protected: |
| 30 |
|
| 31 |
FoFiBase(char *fileA, int lenA, GBool freeFileDataA); |
| 32 |
static char *readFile(char *fileName, int *fileLen); |
| 33 |
|
| 34 |
// S = signed / U = unsigned |
| 35 |
// 8/16/32/Var = word length, in bytes |
| 36 |
// BE = big endian |
| 37 |
int getS8(int pos, GBool *ok); |
| 38 |
int getU8(int pos, GBool *ok); |
| 39 |
int getS16BE(int pos, GBool *ok); |
| 40 |
int getU16BE(int pos, GBool *ok); |
| 41 |
int getS32BE(int pos, GBool *ok); |
| 42 |
Guint getU32BE(int pos, GBool *ok); |
| 43 |
Guint getU32LE(int pos, GBool *ok); |
| 44 |
Guint getUVarBE(int pos, int size, GBool *ok); |
| 45 |
|
| 46 |
GBool checkRegion(int pos, int size); |
| 47 |
|
| 48 |
Guchar *fileData; |
| 49 |
Guchar *file; |
| 50 |
int len; |
| 51 |
GBool freeFileData; |
| 52 |
}; |
| 53 |
|
| 54 |
#endif |