-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGTPInputStream.h
More file actions
53 lines (43 loc) · 1.21 KB
/
GTPInputStream.h
File metadata and controls
53 lines (43 loc) · 1.21 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef GTP_INPUT_STREAM_H
#define GTP_INPUT_STREAM_H
#include "TGFactory.h"
#include <fstream>
#include <cstdio>
#define DEBUG printf
#define MAX_SUPPORTED_VERSION 4
class GTPInputStream // : public GTPFileFormat, TGInputStreamBase
{
protected:
TGStdString version;
int versionIndex;
std::ifstream* stream;
const char* versions[MAX_SUPPORTED_VERSION];
TGFactory *factory;
public:
GTPInputStream();
void init(TGFactory *factory, std::ifstream *aStream);
protected:
TGFactory *getFactory() { return factory; }
bool isSupportedVersion(const char* aVersion);
public:
bool isSupportedVersion();
protected:
void readVersion();
int read() ;
int read(char* bytes, int len) ;
int read(char* bytes, int off,int len) ;
void skip(int bytes) ;
unsigned char readUnsignedByte() ;
signed char readByte() ;
bool readBoolean() ;
int readInt() ;
long readLong() ;
TGStdString readString(int size, int len) ;
TGStdString readString(int length) ;
TGStdString readStringInteger() ;
TGStdString readStringByte(int size) ;
TGStdString readStringByteSizeOfByte() ;
TGStdString readStringByteSizeOfInteger() ;
void close();
};
#endif