diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-09-04 19:11:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-09-04 19:11:53 +0300 |
commit | 3a407bb6b73a186eafd99bcec570f88097c4b2e1 (patch) | |
tree | ea57a752c348ba0a883294855ad3c62c16e9749d /src/utils/translation | |
parent | 872fc368f7b253f26714fc47323064f270b62b40 (diff) | |
download | mv-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.gz mv-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.bz2 mv-3a407bb6b73a186eafd99bcec570f88097c4b2e1.tar.xz mv-3a407bb6b73a186eafd99bcec570f88097c4b2e1.zip |
Add const to more classes.
Diffstat (limited to 'src/utils/translation')
-rw-r--r-- | src/utils/translation/podict.cpp | 2 | ||||
-rw-r--r-- | src/utils/translation/podict.h | 2 | ||||
-rw-r--r-- | src/utils/translation/poparser.cpp | 11 | ||||
-rw-r--r-- | src/utils/translation/poparser.h | 10 | ||||
-rw-r--r-- | src/utils/translation/translationmanager.cpp | 8 | ||||
-rw-r--r-- | src/utils/translation/translationmanager.h | 6 |
6 files changed, 20 insertions, 19 deletions
diff --git a/src/utils/translation/podict.cpp b/src/utils/translation/podict.cpp index 5b1e2a2f2..ebd0682ed 100644 --- a/src/utils/translation/podict.cpp +++ b/src/utils/translation/podict.cpp @@ -47,7 +47,7 @@ const std::string PoDict::getStr(const std::string &str) return mPoLines[str]; } -const char *PoDict::getChar(const char *str) +const char *PoDict::getChar(const char *const str) { if (mPoLines.find(str) == mPoLines.end()) return str; diff --git a/src/utils/translation/podict.h b/src/utils/translation/podict.h index 4c41aadcc..86a09b0d9 100644 --- a/src/utils/translation/podict.h +++ b/src/utils/translation/podict.h @@ -35,7 +35,7 @@ class PoDict const std::string getStr(const std::string &str); - const char *getChar(const char *str); + const char *getChar(const char *const str); protected: friend class PoParser; diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp index b2278c741..57d9b1604 100644 --- a/src/utils/translation/poparser.cpp +++ b/src/utils/translation/poparser.cpp @@ -40,7 +40,7 @@ PoParser::PoParser() : void PoParser::openFile(std::string name) { - ResourceManager *resman = ResourceManager::getInstance(); + const ResourceManager *const resman = ResourceManager::getInstance(); int size; char *buf = static_cast<char*>(resman->loadFile(getFileName(name), size)); @@ -48,7 +48,8 @@ void PoParser::openFile(std::string name) free(buf); } -PoDict *PoParser::load(std::string lang, std::string fileName, PoDict *dict) +PoDict *PoParser::load(const std::string &lang, const std::string &fileName, + PoDict *const dict) { logger->log("loading lang: %s, file: %s", lang.c_str(), fileName.c_str()); @@ -214,7 +215,7 @@ PoDict *PoParser::getEmptyDict() bool PoParser::checkLang(std::string lang) const { // check is po file exists - ResourceManager *resman = ResourceManager::getInstance(); + ResourceManager *const resman = ResourceManager::getInstance(); return resman->exists(getFileName(lang)); } @@ -225,12 +226,12 @@ std::string PoParser::getFileName(std::string lang) const return strprintf("translations/%s.po", lang.c_str()); } -PoDict *PoParser::getDict() +PoDict *PoParser::getDict() const { return new PoDict(mLang); } -void PoParser::convertStr(std::string &str) +void PoParser::convertStr(std::string &str) const { if (str.empty()) return; diff --git a/src/utils/translation/poparser.h b/src/utils/translation/poparser.h index 35a9cd772..254c44a34 100644 --- a/src/utils/translation/poparser.h +++ b/src/utils/translation/poparser.h @@ -33,9 +33,9 @@ class PoParser public: PoParser(); - PoDict *load(std::string lang, - std::string fileName = "", - PoDict *dict = nullptr); + PoDict *load(const std::string &lang, + const std::string &fileName = "", + PoDict *const dict = nullptr); bool checkLang(std::string lang) const; @@ -57,9 +57,9 @@ class PoParser std::string getFileName(std::string lang) const; - PoDict *getDict(); + PoDict *getDict() const; - void convertStr(std::string &str); + void convertStr(std::string &str) const; // current lang std::string mLang; diff --git a/src/utils/translation/translationmanager.cpp b/src/utils/translation/translationmanager.cpp index 4c811ab60..110353baf 100644 --- a/src/utils/translation/translationmanager.cpp +++ b/src/utils/translation/translationmanager.cpp @@ -57,8 +57,8 @@ void TranslationManager::close() } PoDict *TranslationManager::loadLang(LangVect lang, - std::string subName, - PoDict *dict) + const std::string &subName, + PoDict *const dict) { std::string name = ""; PoParser parser; @@ -84,14 +84,14 @@ PoDict *TranslationManager::loadLang(LangVect lang, } bool TranslationManager::translateFile(const std::string &fileName, - PoDict *dict, + PoDict *const dict, StringVect &lines) { if (!dict || fileName.empty()) return false; int contentsLength; - ResourceManager *resman = ResourceManager::getInstance(); + const ResourceManager *const resman = ResourceManager::getInstance(); char *fileContents = static_cast<char*>( resman->loadFile(fileName, contentsLength)); diff --git a/src/utils/translation/translationmanager.h b/src/utils/translation/translationmanager.h index debb555ea..25f88a4c1 100644 --- a/src/utils/translation/translationmanager.h +++ b/src/utils/translation/translationmanager.h @@ -31,8 +31,8 @@ class TranslationManager { public: static PoDict *loadLang(StringVect lang, - std::string subName, - PoDict *dict = nullptr); + const std::string &subName, + PoDict *const dict = nullptr); static void init(); @@ -41,7 +41,7 @@ class TranslationManager static void loadCurrentLang(); static bool translateFile(const std::string &fileName, - PoDict *dict, + PoDict *const dict, StringVect &lines); }; |