Add infos into target window
[ryzomcore.git] / ryzom / server / src / general_utilities_service / gus_text.h
blob7e985583f7c8804adb265996cd6174303e877dba
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 #ifndef GUS_TEXT_H
18 #define GUS_TEXT_H
20 //-----------------------------------------------------------------------------
21 // includes
22 //-----------------------------------------------------------------------------
24 #include "nel/misc/displayer.h"
25 #include "gus_client_manager.h"
28 //-----------------------------------------------------------------------------
29 // GUS namespace
30 //-----------------------------------------------------------------------------
32 namespace GUS
34 //-----------------------------------------------------------------------------
35 // class CLangText
36 //-----------------------------------------------------------------------------
37 // the text set for a given language
39 class CLangText
41 public:
42 CLangText(const NLMISC::CSString& languageCode);
43 const NLMISC::CSString& getLanguageCode() const;
45 const ucstring& get(const NLMISC::CSString& tokenName) const;
46 void set(const NLMISC::CSString& tokenName,const ucstring& txt);
47 void set(const NLMISC::CSString& tokenName,const NLMISC::CSString& txt);
49 void display() const;
51 void getTokenNameSet(std::set<NLMISC::CSString>& result,bool clearResultFirst=true);
53 private:
54 NLMISC::CSString _Code;
55 typedef std::map<NLMISC::CSString,ucstring> TTexts;
56 TTexts _Texts;
60 //-----------------------------------------------------------------------------
61 // class CTextSet
62 //-----------------------------------------------------------------------------
64 class CText
66 public:
67 // read a file of text strings
68 bool read(const NLMISC::CSString& fileName);
70 // set the active language
71 void setLanguage(const NLMISC::CSString& languageCode);
72 // lookup a string trying the active lagugage first, and otherwise the default string set
73 const ucstring& get(const NLMISC::CSString& tokenName) const;
75 // lookup a string for a given language
76 const ucstring& get(const NLMISC::CSString& languageCode,const NLMISC::CSString& tokenName) const;
77 // set a string for a given language
78 void set(const NLMISC::CSString& languageCode,const NLMISC::CSString& tokenName,const ucstring& txt);
79 // set a string for the default string set
80 void set(const NLMISC::CSString& tokenName,const ucstring& txt);
82 // display a little info on the set of languages loaded
83 void display() const;
85 // get hold of the set of token names
86 void getTokenNameSet(std::set<NLMISC::CSString>& result);
88 private:
89 NLMISC::CSString _ActiveLanguage;
90 typedef std::vector<CLangText> TLangTexts;
91 TLangTexts _LangTexts;
97 //-----------------------------------------------------------------------------
98 #endif