Locale.h++

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002    commonc++ - A C++ Common Class Library
00003    Copyright (C) 2005-2012  Mark A Lindner
00004 
00005    This file is part of commonc++.
00006 
00007    This library is free software; you can redistribute it and/or
00008    modify it under the terms of the GNU Library General Public
00009    License as published by the Free Software Foundation; either
00010    version 2 of the License, or (at your option) any later version.
00011 
00012    This library is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015    Library General Public License for more details.
00016 
00017    You should have received a copy of the GNU Library General Public
00018    License along with this library; if not, write to the Free
00019    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020    ---------------------------------------------------------------------------
00021 */
00022 
00023 #ifndef __ccxx_Locale_hxx
00024 #define __ccxx_Locale_hxx
00025 
00026 #include <commonc++/String.h++>
00027 
00028 namespace ccxx {
00029 
00035 class COMMONCPP_API Locale
00036 {
00037   public:
00038 
00042   Locale(String language, String country = String::null,
00043          String variant = String::null);
00044 
00046   ~Locale();
00047 
00049   bool isValid() const throw();
00050 
00052   String getEncoding() const;
00053 
00055   String getAMAffix() const;
00056 
00058   String getPMAffix() const;
00059 
00064   String getWeekDayName(int day) const;
00065 
00070   String getAbbreviatedWeekDayName(int day) const;
00071 
00076   String getMonthName(int month) const;
00077 
00082   String getAbbreviatedMonthName(int month) const;
00083 
00085   String getRadixCharacter() const;
00086 
00088   String getThousandsSeparator() const;
00089 
00091   String getCurrencySymbol() const;
00092 
00094   inline String getLanguage() const
00095   { return(_language); }
00096 
00098   inline String getCountry() const
00099   { return(_country); }
00100 
00102   inline String getVariant() const
00103   { return(_variant); }
00104 
00106   inline String toString() const
00107   { return(_id); }
00108 
00110   static String getCurrentEncoding();
00111 
00113   static const Locale getCurrent();
00114 
00116   static bool setCurrent(const Locale &locale);
00117 
00119   static const Locale CANADA;
00121   static const Locale CANADA_FRENCH;
00123   static const Locale CHINA;
00125   static const Locale CHINESE;
00127   static const Locale ENGLISH;
00129   static const Locale FRANCE;
00131   static const Locale FRENCH;
00133   static const Locale GERMANY;
00135   static const Locale GERMAN;
00137   static const Locale ITALY;
00139   static const Locale ITALIAN;
00141   static const Locale JAPAN;
00143   static const Locale JAPANESE;
00145   static const Locale KOREA;
00147   static const Locale KOREAN;
00149   static const Locale SPANISH;
00151   static const Locale SIMPLIFIED_CHINESE;
00153   static const Locale TRADITIONAL_CHINESE;
00155   static const Locale TAIWAN;
00157   static const Locale UNITED_KINGDOM;
00159   static const Locale UNITED_STATES;
00160 
00161   private:
00162 
00163 #ifdef CCXX_OS_WINDOWS
00164   Locale(LCID locale);
00165 #endif
00166 
00167   String _language;
00168   String _country;
00169   String _variant;
00170   String _id;
00171 #ifdef CCXX_OS_WINDOWS
00172   LCID _locale;
00173 #else
00174   void *_locale;
00175 #endif
00176 };
00177 
00178 }; // namespace ccxx
00179 
00180 #endif // __ccxx_Locale_hxx
Generated on Sat Nov 26 16:49:07 2011 for libcommonc++ by  doxygen 1.6.3