tLanguage Class Reference

#include <tLocale.h>

Inheritance diagram for tLanguage:

Inheritance graph
[legend]
Collaboration diagram for tLanguage:

Collaboration graph
[legend]

List of all members.

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 tStringName ()

Static Public Member Functions

static tLanguageFirstLanguage ()
static tLanguageFind (tString const &name)
 finds a language with the specified name. Never fails, creates new language on demand.
static tLanguageFindStrict (tString const &name)
 finds a language with the specified name. Aborts if the language is not found.
static tLanguageFindSloppy (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)


Detailed Description

Definition at line 38 of file tLocale.h.


Constructor & Destructor Documentation

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 }

Here is the caller graph for this function:


Member Function Documentation

tLanguage * tLanguage::FirstLanguage (  )  [static]

Definition at line 101 of file tLocale.cpp.

Referenced by sg_LanguageMenu().

00102 {
00103     return st_languageAnchor;
00104 }

Here is the caller graph for this function:

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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().

00128 {
00129     // store name for later loading
00130     this->file = file;
00131 }

Here is the caller graph for this function:

tLanguage * tLanguage::Find ( tString const &  name  )  [static]

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

tLanguage * tLanguage::FindStrict ( tString const &  name  )  [static]

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

tLanguage * tLanguage::FindSloppy ( tString const &  name  )  [static]

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

const tString& tLanguage::Name (  )  [inline]

Definition at line 57 of file tLocale.h.

References name.

Referenced by sg_LanguageMenu().

00057                          {
00058         return name;
00059     }

Here is the caller graph for this function:


Member Data Documentation

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]

filename to load the language from (empty if the language was already loaded)

Definition at line 41 of file tLocale.h.

Referenced by Load().


The documentation for this class was generated from the following files:
Generated on Sat Mar 15 23:57:14 2008 for Armagetron Advanced by  doxygen 1.5.4