GAF Library
Generic Animation Format
 All Classes Functions Pages
GAFFile.h
1 #pragma once
2 
3 #include "GAFHeader.h"
4 
5 class GAFFile
6 {
7 private:
8  unsigned char* m_data;
9  unsigned int m_dataPosition;
10  unsigned long m_dataLen;
11  GAFHeader m_header;
12 private:
13  unsigned char* _getData(const std::string& filename, const char* openMode, unsigned long& outLen);
14 protected:
15  void _readHeaderBegin(GAFHeader&);
16 public:
17  GAFFile();
18  ~GAFFile();
19 
20  unsigned char read1Byte();
21  unsigned short read2Bytes();
22  unsigned int read4Bytes();
23  unsigned long long read8Bytes();
24  float readFloat();
25  double readDouble();
26 
27  bool isEOF() const;
28 
29  unsigned int readString(std::string* dst); // function reads lenght prefixed string
30  void readBytes(void* dst, unsigned int len);
31 
32  void close();
33 
34  // TODO: Provide error codes
35  bool open(const std::string& filename, const char* openMode);
36  bool isOpened() const;
37 
38  const GAFHeader& getHeader() const;
39  GAFHeader& getHeader();
40 
41  unsigned int getPosition() const;
42  void rewind(unsigned int newPos);
43 };
Definition: GAFHeader.h:3
Definition: GAFFile.h:5