GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/utils/translation/podict.h Lines: 2 2 100.0 %
Date: 2017-11-29 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2012-2017  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
21
#ifndef UTILS_TRANSLATION_PODICT_H
22
#define UTILS_TRANSLATION_PODICT_H
23
24
#include <map>
25
#include <string>
26
27
#include "localconsts.h"
28
29
typedef std::map <std::string, std::string> PoMap;
30
31
class PoDict final
32
{
33
    public:
34
        explicit PoDict(const std::string &lang);
35
36
        A_DELETE_COPY(PoDict)
37
38
        ~PoDict();
39
40
        const std::string getStr(const std::string &str);
41
42
        const char *getChar(const char *const str);
43
44
        bool haveStr(const std::string &str) const;
45
46
#ifndef UNITTESTS
47
    protected:
48
#endif  // UNITTESTS
49
        friend class PoParser;
50
        friend class TranslationManager;
51
52
        PoMap *getMap()
53
6
        { return &mPoLines; }
54
55
        void set(const std::string &key, const std::string &value)
56
14288
        { mPoLines[key] = value; }
57
58
        void setLang(const std::string &lang)
59
        { mLang = lang; }
60
61
    private:
62
        PoMap mPoLines;
63
        std::string mLang;
64
};
65
66
extern PoDict *translator;
67
extern PoDict *dictionary;
68
extern PoDict *reverseDictionary;
69
#ifdef ENABLE_CUSTOMNLS
70
extern PoDict *mainTranslator;
71
#endif  // ENABLE_CUSTOMNLS
72
73
#endif  // UTILS_TRANSLATION_PODICT_H