1370b324cSopenharmony_ci// Common/Lang.h
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#ifndef ZIP7_INC_COMMON_LANG_H
4370b324cSopenharmony_ci#define ZIP7_INC_COMMON_LANG_H
5370b324cSopenharmony_ci
6370b324cSopenharmony_ci#include "MyString.h"
7370b324cSopenharmony_ci
8370b324cSopenharmony_ciclass CLang
9370b324cSopenharmony_ci{
10370b324cSopenharmony_ci  wchar_t *_text;
11370b324cSopenharmony_ci
12370b324cSopenharmony_ci  bool OpenFromString(const AString &s);
13370b324cSopenharmony_cipublic:
14370b324cSopenharmony_ci  CRecordVector<UInt32> _ids;
15370b324cSopenharmony_ci  CRecordVector<UInt32> _offsets;
16370b324cSopenharmony_ci  UStringVector Comments;
17370b324cSopenharmony_ci
18370b324cSopenharmony_ci  CLang(): _text(NULL) {}
19370b324cSopenharmony_ci  ~CLang() { Clear(); }
20370b324cSopenharmony_ci  bool Open(CFSTR fileName, const char *id);
21370b324cSopenharmony_ci  void Clear() throw();
22370b324cSopenharmony_ci  bool IsEmpty() const { return _ids.IsEmpty(); }
23370b324cSopenharmony_ci  const wchar_t *Get(UInt32 id) const throw();
24370b324cSopenharmony_ci  const wchar_t *Get_by_index(unsigned index) const throw()
25370b324cSopenharmony_ci  {
26370b324cSopenharmony_ci    return _text + (size_t)_offsets[index];
27370b324cSopenharmony_ci  }
28370b324cSopenharmony_ci};
29370b324cSopenharmony_ci
30370b324cSopenharmony_ci#endif
31