You.i Engine
YiBifParser.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2017. All rights reserved.
2 #ifndef _YI_BIF_PARSER_H_
3 #define _YI_BIF_PARSER_H_
4 
5 #include "framework/YiPredef.h"
6 #include "utility/YiString.h"
7 
27 class CYIBif
28 {
29 public:
30  CYIBif();
31  CYIBif(const CYIString &path);
32  ~CYIBif();
33 
37  bool Open(const CYIString &path);
38 
42  bool Open(const uint8_t *pData, uint32_t nSize);
43 
47  bool IsBifData(const uint8_t *pData, uint32_t uSize);
48 
52  uint32_t GetTimeStampMultiplier() const;
53 
57  uint32_t GetEntryCount() const;
58 
70  bool GetImageDataAtIndex(uint32_t uIndex, std::vector<uint8_t> *pImageData) const;
71 
80  uint32_t GetImageIndexAtTime(uint64_t uTime) const;
81 
85  uint32_t GetDataSize() const;
86 
87 private:
88  uint32_t *m_pOffset;
89  uint64_t *m_pTime;
90 
91  uint32_t m_EntryCnt;
92  uint32_t m_TimestampMultiplier;
93 
94  FILE* m_pFile;
95  std::vector<uint8_t> m_rawData;
96  uint32_t m_RawDataIndex;
97 
98  // Reset internally settings if any.
99  void Reset();
100 
101  bool ParseHeader();
102  bool ParseIndexTable();
103 
104 private:
105  // Do not implement
106  CYIBif(const CYIBif &);
107  CYIBif &operator=(const CYIBif &);
108 };
109 
114 inline uint32_t CYIBif::GetEntryCount() const
115 {
116  return (m_EntryCnt == 0 ? 0 : (m_EntryCnt - 1));
117 }
118 
119 inline uint32_t CYIBif::GetTimeStampMultiplier() const
120 {
121  return m_TimestampMultiplier;
122 }
123 
124 #endif // _YI_BIF_PARSER_H_
bool GetImageDataAtIndex(uint32_t uIndex, std::vector< uint8_t > *pImageData) const
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:35
uint32_t GetDataSize() const
Encapulates and provides services for getting the data in BIF (Base Index Frames) file archives...
Definition: YiBifParser.h:27
bool Open(const CYIString &path)
uint32_t GetEntryCount() const
Definition: YiBifParser.h:114
uint32_t GetImageIndexAtTime(uint64_t uTime) const
bool IsBifData(const uint8_t *pData, uint32_t uSize)
uint32_t GetTimeStampMultiplier() const
Definition: YiBifParser.h:119