Ceylan::LocalizationSettings Class Reference

Describes the localization settings, notably for a given application. More...

#include <CeylanLocale.h>

Inheritance diagram for Ceylan::LocalizationSettings:

Inheritance graph
[legend]
Collaboration diagram for Ceylan::LocalizationSettings:

Collaboration graph
[legend]

List of all members.

Public Types

enum  TextOutputFormat { rawText, html }
 Defines what text output formats for TextDisplayable instances are available. More...

Public Member Functions

 LocalizationSettings ()
 Constructs an instance to localization settings.
virtual ~LocalizationSettings () throw ()
 Virtual destructor.
virtual void addSupportedLocale (LocaleCode code)
 Adds a new supported locale.
virtual void addSupportedLocale (const std::string &localeName)
 Adds a new supported locale.
virtual bool isSupported (LocaleCode code)
 Returns true iff the locale corresponding to specified code is supported.
virtual bool isSupported (const std::string &localeName)
 Returns true iff the specified locale is supported.
virtual const std::list
< LocaleCode > & 
getSupportedLocales () const
 Returns the list of the codes of all supported locales.
virtual bool hasCurrentLocale () const
 Returns true iff a current locale is set.
virtual LocaleCode getCurrentLocaleCode () const
 Returns the code of the current locale in use.
virtual const std::string & getCurrentLocaleName () const
 Returns the name of the current locale in use.
virtual void setCurrentLocale (LocaleCode code)
 Sets the current locale from its code.
virtual void setCurrentLocale (const std::string &localeName)
 Sets the current locale from its name.
virtual const std::string toString (VerbosityLevels level=high) const
 Returns a user-friendly description of the state of this object.

Static Public Member Functions

static bool IsAKnownLocale (const std::string &localeName)
 Returns true iff the specified locale name is a known locale.
static LocaleCode GetLocaleCodeFromName (const std::string &localeName)
 Returns the locale code corresponding to the specified locale name.
static const std::string & GetLocaleNameFromCode (LocaleCode code)
 Returns the locale name corresponding to the specified locale code.
static const std::string ToString (std::list< TextDisplayable * > displayables, Ceylan::VerbosityLevels level=Ceylan::high)
 Returns a user-friendly description of this list of pointers to text displayable instances.
static TextOutputFormat GetOutputFormat ()
 Returns the current overall text format to be used by TextDisplayable instances.
static void SetOutputFormat (TextOutputFormat newOutputFormat)
 Sets the current overall text format to be used by TextDisplayable instances.

Static Public Attributes

static const LocaleCode EnglishLocale = 1
static const LocaleCode FrenchLocale = 2
static const LocaleCode GermanLocale = 3

Protected Attributes

std::list< LocaleCode_supportedLocales
 The list of supported locales.
LocaleCode _currentLocale
 The current locale in use.

Static Protected Attributes

static TextOutputFormat _OutputFormat = rawText
 The text format to be used currently by TextDisplayable instances.

Private Member Functions

 LocalizationSettings (const LocalizationSettings &source)
 Copy constructor made private to ensure that it will be never called.
LocalizationSettingsoperator= (const LocalizationSettings &source)
 Assignment operator made private to ensure that it will be never called.


Detailed Description

Describes the localization settings, notably for a given application.

Definition at line 63 of file CeylanLocale.h.


Member Enumeration Documentation

Defines what text output formats for TextDisplayable instances are available.

Enumerator:
rawText 
html 

Definition at line 124 of file CeylanTextDisplayable.h.


Constructor & Destructor Documentation

LocalizationSettings::LocalizationSettings (  )  [explicit]

Constructs an instance to localization settings.

Definition at line 73 of file CeylanLocale.cc.

LocalizationSettings::~LocalizationSettings (  )  throw () [virtual]

Virtual destructor.

Definition at line 81 of file CeylanLocale.cc.

Ceylan::LocalizationSettings::LocalizationSettings ( const LocalizationSettings source  )  [private]

Copy constructor made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.


Member Function Documentation

void LocalizationSettings::addSupportedLocale ( const std::string &  localeName  )  [virtual]

Adds a new supported locale.

Exceptions:
LocalizationException if the locale is not a known one.

Definition at line 99 of file CeylanLocale.cc.

References addSupportedLocale(), GetLocaleCodeFromName(), and IsAKnownLocale().

void LocalizationSettings::addSupportedLocale ( LocaleCode  code  )  [virtual]

Adds a new supported locale.

Exceptions:
LocalizationException if the locale is not a known one.

Definition at line 88 of file CeylanLocale.cc.

References _supportedLocales, and isSupported().

Referenced by addSupportedLocale().

LocaleCode LocalizationSettings::getCurrentLocaleCode (  )  const [virtual]

Returns the code of the current locale in use.

Exceptions:
LocalizationException if none is set.

Definition at line 154 of file CeylanLocale.cc.

References _currentLocale.

Referenced by getCurrentLocaleName().

const std::string & LocalizationSettings::getCurrentLocaleName (  )  const [virtual]

Returns the name of the current locale in use.

Exceptions:
LocalizationException if none is set.

Definition at line 167 of file CeylanLocale.cc.

References getCurrentLocaleCode(), and GetLocaleNameFromCode().

Referenced by toString().

LocaleCode LocalizationSettings::GetLocaleCodeFromName ( const std::string &  localeName  )  [static]

Returns the locale code corresponding to the specified locale name.

Exceptions:
LocalizationException if the locale name does not correspond to any known locale.

Definition at line 240 of file CeylanLocale.cc.

References EnglishLocale, EnglishLocaleName, FrenchLocale, FrenchLocaleName, GermanLocale, and GermanLocaleName.

Referenced by addSupportedLocale(), isSupported(), and setCurrentLocale().

const std::string & LocalizationSettings::GetLocaleNameFromCode ( LocaleCode  code  )  [static]

Returns the locale name corresponding to the specified locale code.

Exceptions:
LocalizationException if the locale code does not correspond to any known locale.

Definition at line 261 of file CeylanLocale.cc.

References EnglishLocale, EnglishLocaleName, FrenchLocale, FrenchLocaleName, GermanLocale, GermanLocaleName, and Ceylan::toString().

Referenced by getCurrentLocaleName(), and toString().

TextDisplayable::TextOutputFormat TextDisplayable::GetOutputFormat (  )  [static, inherited]

const std::list< LocaleCode > & LocalizationSettings::getSupportedLocales (  )  const [virtual]

Returns the list of the codes of all supported locales.

Definition at line 136 of file CeylanLocale.cc.

References _supportedLocales.

bool LocalizationSettings::hasCurrentLocale (  )  const [virtual]

Returns true iff a current locale is set.

Definition at line 145 of file CeylanLocale.cc.

References _currentLocale.

Referenced by toString().

bool LocalizationSettings::IsAKnownLocale ( const std::string &  localeName  )  [static]

Returns true iff the specified locale name is a known locale.

Definition at line 225 of file CeylanLocale.cc.

References generalUtils::false, and generalUtils::true.

Referenced by addSupportedLocale(), and isSupported().

bool LocalizationSettings::isSupported ( const std::string &  localeName  )  [virtual]

Returns true iff the specified locale is supported.

Definition at line 123 of file CeylanLocale.cc.

References generalUtils::false, GetLocaleCodeFromName(), IsAKnownLocale(), and isSupported().

bool LocalizationSettings::isSupported ( LocaleCode  code  )  [virtual]

Returns true iff the locale corresponding to specified code is supported.

Definition at line 113 of file CeylanLocale.cc.

References _supportedLocales.

Referenced by addSupportedLocale(), isSupported(), and setCurrentLocale().

LocalizationSettings& Ceylan::LocalizationSettings::operator= ( const LocalizationSettings source  )  [private]

Assignment operator made private to ensure that it will be never called.

The compiler should complain whenever this undefined operator is called, implicitly or not.

void LocalizationSettings::setCurrentLocale ( const std::string &  localeName  )  [virtual]

Sets the current locale from its name.

Exceptions:
LocalizationException if the operation failed.

Definition at line 190 of file CeylanLocale.cc.

References GetLocaleCodeFromName(), and setCurrentLocale().

void LocalizationSettings::setCurrentLocale ( LocaleCode  code  )  [virtual]

Sets the current locale from its code.

Exceptions:
LocalizationException if the operation failed.

Definition at line 176 of file CeylanLocale.cc.

References _currentLocale, isSupported(), and Ceylan::toString().

Referenced by setCurrentLocale().

void TextDisplayable::SetOutputFormat ( TextOutputFormat  newOutputFormat  )  [static, inherited]

Sets the current overall text format to be used by TextDisplayable instances.

Parameters:
newOutputFormat the new output format.

Definition at line 72 of file CeylanTextDisplayable.cc.

References Ceylan::TextDisplayable::_OutputFormat.

Referenced by Ceylan::Log::LogHolder::LogHolder().

const std::string TextDisplayable::ToString ( std::list< TextDisplayable * >  displayables,
Ceylan::VerbosityLevels  level = Ceylan::high 
) [static, inherited]

Returns a user-friendly description of this list of pointers to text displayable instances.

Parameters:
displayables a list of pointers to TextDisplayable instances/
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
toString, Ceylan::VerbosityLevels

Definition at line 45 of file CeylanTextDisplayable.cc.

References Ceylan::formatStringList().

const std::string LocalizationSettings::toString ( VerbosityLevels  level = high  )  const [virtual]

Returns a user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
TextDisplayable

Implements Ceylan::TextDisplayable.

Definition at line 199 of file CeylanLocale.cc.

References _supportedLocales, Ceylan::formatStringList(), getCurrentLocaleName(), GetLocaleNameFromCode(), and hasCurrentLocale().


Member Data Documentation

The current locale in use.

Definition at line 244 of file CeylanLocale.h.

Referenced by getCurrentLocaleCode(), hasCurrentLocale(), and setCurrentLocale().

TextDisplayable::TextOutputFormat TextDisplayable::_OutputFormat = rawText [static, protected, inherited]

The text format to be used currently by TextDisplayable instances.

Note:
Defaults to raw text.

Definition at line 158 of file CeylanTextDisplayable.h.

Referenced by Ceylan::TextDisplayable::GetOutputFormat(), and Ceylan::TextDisplayable::SetOutputFormat().

The list of supported locales.

Definition at line 240 of file CeylanLocale.h.

Referenced by addSupportedLocale(), getSupportedLocales(), isSupported(), and toString().

Definition at line 229 of file CeylanLocale.h.

Referenced by GetLocaleCodeFromName(), and GetLocaleNameFromCode().

Definition at line 230 of file CeylanLocale.h.

Referenced by GetLocaleCodeFromName(), and GetLocaleNameFromCode().

Definition at line 231 of file CeylanLocale.h.

Referenced by GetLocaleCodeFromName(), and GetLocaleNameFromCode().


The documentation for this class was generated from the following files:

Generated on Thu Jun 4 20:40:07 2009 for Ceylan by  doxygen 1.5.8