00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef CEYLAN_LOCALE_H_
00028 #define CEYLAN_LOCALE_H_
00029
00030
00031 #include "CeylanTypes.h"
00032 #include "CeylanException.h"
00033
00034 #include <string>
00035 #include <list>
00036
00037
00038 namespace Ceylan
00039 {
00040
00041
00043 class CEYLAN_DLL LocalizationException: public Ceylan::Exception
00044 {
00045
00046 public:
00047
00048 explicit LocalizationException( const std::string & reason ) ;
00049 virtual ~LocalizationException() throw() ;
00050
00051 } ;
00052
00053
00054
00055 typedef Ceylan::Uint16 LocaleCode ;
00056
00057
00058
00063 class CEYLAN_DLL LocalizationSettings : public TextDisplayable
00064 {
00065
00066
00067 public:
00068
00069
00074 explicit LocalizationSettings() ;
00075
00076
00078 virtual ~LocalizationSettings() throw() ;
00079
00080
00081
00082
00083
00084
00092 virtual void addSupportedLocale( LocaleCode code ) ;
00093
00094
00095
00103 virtual void addSupportedLocale( const std::string & localeName ) ;
00104
00105
00106
00112 virtual bool isSupported( LocaleCode code ) ;
00113
00114
00115
00120 virtual bool isSupported( const std::string & localeName ) ;
00121
00122
00123
00128 virtual const std::list<LocaleCode> & getSupportedLocales() const ;
00129
00130
00131
00132
00133
00134
00135
00136
00138 virtual bool hasCurrentLocale() const ;
00139
00140
00147 virtual LocaleCode getCurrentLocaleCode() const ;
00148
00149
00150
00157 virtual const std::string & getCurrentLocaleName() const ;
00158
00159
00160
00167 virtual void setCurrentLocale( LocaleCode code ) ;
00168
00169
00176 virtual void setCurrentLocale( const std::string & localeName ) ;
00177
00178
00179
00190 virtual const std::string toString( VerbosityLevels level = high )
00191 const ;
00192
00193
00194
00199 static bool IsAKnownLocale( const std::string & localeName ) ;
00200
00201
00210 static LocaleCode GetLocaleCodeFromName(
00211 const std::string & localeName ) ;
00212
00213
00222 static const std::string & GetLocaleNameFromCode(
00223 LocaleCode code ) ;
00224
00225
00226
00227
00228
00229 static const LocaleCode EnglishLocale ;
00230 static const LocaleCode FrenchLocale ;
00231 static const LocaleCode GermanLocale ;
00232
00233
00234
00235
00236 protected:
00237
00238
00240 std::list<LocaleCode> _supportedLocales ;
00241
00242
00244 LocaleCode _currentLocale ;
00245
00246
00247
00248
00249 private:
00250
00251
00259 LocalizationSettings( const LocalizationSettings & source ) ;
00260
00261
00262
00270 LocalizationSettings & operator = (
00271 const LocalizationSettings & source ) ;
00272
00273
00274 } ;
00275
00276 }
00277
00278
00279
00280 #endif // CEYLAN_LOCALE_H_
00281