#include <tLocale.h>
Public Member Functions | |
tLanguage (const tString &n) | |
void | SetFirstLanguage () const |
void | SetSecondLanguage () const |
void | Load () const |
loads this language fully | |
void | LoadLater (char const *file) const |
loads this language later from this file | |
const tString & | Name () |
Static Public Member Functions | |
static tLanguage * | FirstLanguage () |
static tLanguage * | Find (tString const &name) |
finds a language with the specified name. Never fails, creates new language on demand. | |
static tLanguage * | FindStrict (tString const &name) |
finds a language with the specified name. Aborts if the language is not found. | |
static tLanguage * | FindSloppy (tString const &name) |
finds a language with the specified name. Returns NULL if the language is not found. | |
Private Attributes | |
tString | name |
the language's name | |
tString | file |
filename to load the language from (empty if the language was already loaded) |
Definition at line 38 of file tLocale.h.
tLanguage::tLanguage | ( | const tString & | n | ) |
Definition at line 94 of file tLocale.cpp.
Referenced by Find().
00095 :tListItem<tLanguage>(st_languageAnchor), 00096 name(n) 00097 { 00098 }
tLanguage * tLanguage::FirstLanguage | ( | ) | [static] |
Definition at line 101 of file tLocale.cpp.
Referenced by sg_LanguageMenu().
00102 { 00103 return st_languageAnchor; 00104 }
void tLanguage::SetFirstLanguage | ( | ) | const |
Definition at line 106 of file tLocale.cpp.
References Load().
Referenced by sg_LanguageInit().
00107 { 00108 st_firstLanguage = this; 00109 Load(); 00110 }
void tLanguage::SetSecondLanguage | ( | ) | const |
Definition at line 112 of file tLocale.cpp.
References Load().
Referenced by sg_LanguageInit().
00113 { 00114 st_secondLanguage = this; 00115 Load(); 00116 }
void tLanguage::Load | ( | ) | const |
loads this language fully
Definition at line 118 of file tLocale.cpp.
References tString::Clear(), file, tString::Len(), and tLocaleItem::Load().
Referenced by tLocaleItem::operator const char *(), SetFirstLanguage(), and SetSecondLanguage().
00119 { 00120 if (file.Len() > 1) 00121 { 00122 tLocaleItem::Load( file ); 00123 file.Clear(); 00124 } 00125 }
void tLanguage::LoadLater | ( | char const * | file | ) | const |
loads this language later from this file
Definition at line 127 of file tLocale.cpp.
Referenced by tLocaleItem::Load().
finds a language with the specified name. Never fails, creates new language on demand.
Definition at line 133 of file tLocale.cpp.
References FindSloppy(), tLanguage(), and tNEW.
Referenced by tLocaleItem::Load(), and sg_LanguageInit().
00134 { 00135 tLanguage *ret = FindSloppy( name ); 00136 00137 if (ret) 00138 return ret; 00139 00140 return tNEW(tLanguage(name)); 00141 }
finds a language with the specified name. Aborts if the language is not found.
Definition at line 143 of file tLocale.cpp.
References FindSloppy(), NULL, and tERR_ERROR_INT.
Referenced by tLocaleItem::operator const char *().
00144 { 00145 tLanguage *ret = FindSloppy( name ); 00146 00147 if (ret) 00148 return ret; 00149 00150 tERR_ERROR_INT("Language " << name << " not found."); 00151 return NULL; 00152 }
finds a language with the specified name. Returns NULL if the language is not found.
Definition at line 154 of file tLocale.cpp.
References name, tListItem< T >::Next(), and NULL.
Referenced by Find(), and FindStrict().
00155 { 00156 tLanguage *ret = st_languageAnchor; 00157 while (ret) 00158 { 00159 if (ret->name == name) 00160 return ret; 00161 ret = ret->Next(); 00162 } 00163 00164 return NULL; 00165 }
const tString& tLanguage::Name | ( | ) | [inline] |
Definition at line 57 of file tLocale.h.
References name.
Referenced by sg_LanguageMenu().
00057 { 00058 return name; 00059 }
tString tLanguage::name [private] |
the language's name
Definition at line 40 of file tLocale.h.
Referenced by FindSloppy(), and Name().
tString tLanguage::file [mutable, private] |