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