You.i Engine
YiMOTranslator.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_MO_TRANSLATOR_H_
3 #define _YI_MO_TRANSLATOR_H_
4 
5 #include <vector>
6 
7 #include "utility/YiString.h"
8 #include "utility/YiTranslator.h"
9 
27 {
28 public:
30  virtual ~CYIMOTranslator();
31 
36  virtual bool LoadTranslation(const CYIString &filename) override;
37 
41  virtual bool LoadTranslation(const uint8_t *pData, size_t dataSize) override;
42 
47  virtual CYIString Translate(const CYIString &text) override;
48 
49 private:
50  bool ReadBuffer(std::vector<uint8_t> moBuffer);
51  void Reset();
52 
53  std::vector<uint8_t> m_moBuffer;
54 
55  std::vector<CYIString> m_transStringCache;
56  size_t m_nbStrings;
57 
58  uint32_t *m_pOrigStringTable; // start of the original strings index table
59  uint32_t *m_pTransStringTable; // start of the translated strings index table
60  uint32_t m_stringsStartOffset; // start of the section containing strings (orig and trans)
61 
63 };
66 #endif // _YI_MO_TRANSLATOR_H_
#define YI_DISALLOW_COPY_AND_ASSIGN(TypeName)
Delete the copy constructor and assignment operator (and consequently the move constructor as well) ...
Definition: YiPredef.h:122
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
virtual bool LoadTranslation(const CYIString &filename) override
virtual ~CYIMOTranslator()
virtual CYIString Translate(const CYIString &text) override
A translator object used for parsing and indexing localisation strings found in ".mo" binary files. These objects are available through the CYITranslation interface and should be primarily loaded through the CYIAssetLoader, which will provide a CYIAssetTranslation object.
Definition: YiMOTranslator.h:26
Definition: YiTranslator.h:12