Index: src/libictranslate/ResourceManager.h =================================================================== diff -u -rd0d46e0ace97519c52eefcd66e1cab5b586dcac1 -ra347fac4097d0504825a93fec5233adade6345a3 --- src/libictranslate/ResourceManager.h (.../ResourceManager.h) (revision d0d46e0ace97519c52eefcd66e1cab5b586dcac1) +++ src/libictranslate/ResourceManager.h (.../ResourceManager.h) (revision a347fac4097d0504825a93fec5233adade6345a3) @@ -41,7 +41,8 @@ /////////////////////////////////////////////////////////// // language description structure -typedef map strings_map; +typedef std::map strings_map; +typedef std::map checksum_map; class LIBICTRANSLATE_API CLangData { @@ -51,27 +52,29 @@ ~CLangData(); CLangData(const CLangData& ld); + CLangData& operator=(const CLangData& rSrc); + void Clear(); // operations bool ReadInfo(PCTSTR pszFile); - bool ReadTranslation(PCTSTR pszFile, bool bUpdate=false); + bool ReadTranslation(PCTSTR pszFile, bool bReadBase = false); PCTSTR GetString(WORD wHiID, WORD wLoID); // attributes void SetFilename(PCTSTR psz); PCTSTR GetFilename(bool bFullPath) const; - void SetLangName(PCTSTR psz) { if (m_pszLngName) delete [] m_pszLngName; m_pszLngName=new TCHAR[_tcslen(psz)+1]; _tcscpy(m_pszLngName, psz); }; + void SetLangName(PCTSTR psz); PCTSTR GetLangName() const { return m_pszLngName; }; - void SetBaseFile(PCTSTR psz) { SetFnameData(&m_pszBaseFile, psz); }; + void SetBaseFile(PCTSTR psz); PCTSTR GetBaseFile() const { return m_pszBaseFile; }; void SetLangCode(WORD wLang) { m_wLangCode=wLang; }; WORD GetLangCode() const { return m_wLangCode; }; - void SetFontFace(PCTSTR psz) { if (m_pszFontFace) delete [] m_pszFontFace; m_pszFontFace=new TCHAR[_tcslen(psz)+1]; _tcscpy(m_pszFontFace, psz); }; + void SetFontFace(PCTSTR psz); PCTSTR GetFontFace() const { return m_pszFontFace; }; void SetCharset(BYTE byChar) { m_byCharset=byChar; }; @@ -83,17 +86,15 @@ void SetDirection(bool brtl) { m_bRTL=brtl; }; bool GetDirection() const { return m_bRTL; }; - void SetHelpName(PCTSTR psz) { SetFnameData(&m_pszHelpName, psz); }; + void SetHelpName(PCTSTR psz); PCTSTR GetHelpName() const { return m_pszHelpName; }; - void SetAuthor(PCTSTR psz) { if (m_pszAuthor) delete [] m_pszAuthor; m_pszAuthor=new TCHAR[_tcslen(psz)+1]; _tcscpy(m_pszAuthor, psz); }; + void SetAuthor(PCTSTR psz); PCTSTR GetAuthor() const { return m_pszAuthor; }; - void SetVersion(PCTSTR psz) { if (m_pszVersion) delete [] m_pszVersion; m_pszVersion=new TCHAR[_tcslen(psz)+1]; _tcscpy(m_pszVersion, psz); }; + void SetVersion(PCTSTR psz); PCTSTR GetVersion() const { return m_pszVersion; }; -// void SetStringData(PCTSTR psz, size_t tCnt) { tCount=tCnt; if (pszStrings) delete [] pszStrings; if (tCount > 0) { pszStrings=new TCHAR[tCnt]; memcpy(pszStrings, psz, tCnt*sizeof(TCHAR)); } }; - protected: void SetFnameData(PTSTR *ppszDst, PCTSTR pszSrc); static void EnumAttributesCallback(bool bGroup, const tchar_t* pszName, const tchar_t* pszValue, ptr_t pData); @@ -113,7 +114,8 @@ bool m_bRTL; // does the language require right-to-left reading order ? // strings (for controls in dialog boxes the ID contains hi:dlg ID, lo:ctrl ID, for strings hi part is 0) - strings_map m_mStrings; // maps string ID to the offset in pszStrings + strings_map m_mStrings; // maps string ID to the offset in pszStrings + checksum_map m_mChecksums; // checksums of strings private: uint_t m_uiSectionID; ///< ID of the currently processed section