ManaPlus
podict.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2012-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
23 
24 #include "debug.h"
25 
26 std::string empty;
27 
28 PoDict *translator = nullptr;
29 PoDict *dictionary = nullptr;
31 #ifdef ENABLE_CUSTOMNLS
32 PoDict *mainTranslator = nullptr;
33 #endif // ENABLE_CUSTOMNLS
34 
35 PoDict::PoDict(const std::string &lang) :
36  mPoLines(),
37  mLang(lang)
38 {
39 }
40 
42 {
43 }
44 
45 const std::string PoDict::getStr(const std::string &str)
46 {
47  if (mPoLines.find(str) == mPoLines.end())
48  return str;
49  return mPoLines[str];
50 }
51 
52 const char *PoDict::getChar(const char *const str)
53 {
54  if (mPoLines.find(str) == mPoLines.end())
55  return str;
56  return mPoLines[str].c_str();
57 }
58 
59 bool PoDict::haveStr(const std::string &str) const
60 {
61  return mPoLines.find(str) != mPoLines.end();
62 }
Definition: podict.h:33
const char * getChar(const char *const str)
Definition: podict.cpp:52
bool haveStr(const std::string &str) const
Definition: podict.cpp:59
const std::string getStr(const std::string &str)
Definition: podict.cpp:45
PoDict(const std::string &lang)
Definition: podict.cpp:35
~PoDict()
Definition: podict.cpp:41
PoMap mPoLines
Definition: podict.h:63
PoDict * dictionary
Definition: podict.cpp:29
PoDict * translator
Definition: podict.cpp:28
std::string empty
Definition: podict.cpp:26
PoDict * reverseDictionary
Definition: podict.cpp:30