00001 /* AbiSource Program Utilities 00002 * Copyright (C) 2002 Dom Lachowicz 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 00017 * 02110-1301 USA. 00018 */ 00019 00020 #ifndef UT_LOCALE_H 00021 #define UT_LOCALE_H 00022 00023 #include <locale.h> 00024 #include "ut_string_class.h" 00025 00026 class ABI_EXPORT UT_LocaleTransactor 00027 { 00028 public: 00029 00030 UT_LocaleTransactor (int category, const char * locale); 00031 ~UT_LocaleTransactor (); 00032 00033 private: 00034 00035 UT_LocaleTransactor (); 00036 UT_LocaleTransactor (const UT_LocaleTransactor & rhs); 00037 UT_LocaleTransactor& operator=(const UT_LocaleTransactor & rhs); 00038 00039 int mCategory; 00040 char * mOldLocale; 00041 }; 00042 00043 class ABI_EXPORT UT_LocaleInfo 00044 { 00045 public: 00046 00047 UT_LocaleInfo (); 00048 UT_LocaleInfo (const char * locale); 00049 00050 // default copy and assignment constructors 00051 00052 static const UT_LocaleInfo system(); 00053 00054 bool hasLanguage () const; 00055 bool hasTerritory () const; 00056 bool hasEncoding () const; 00057 00058 const std::string& getLanguage () const; 00059 const std::string& getTerritory () const; 00060 const std::string& getEncoding () const; 00061 00062 std::string toString () const; 00063 00064 bool operator==(const UT_LocaleInfo & rhs) const; 00065 bool operator!=(const UT_LocaleInfo & rhs) const; 00066 00067 private: 00068 00069 void init (const std::string & locale); 00070 00071 std::string mLanguage; 00072 std::string mTerritory; 00073 std::string mEncoding; 00074 }; 00075 00076 const char* UT_getFallBackStringSetLocale(const char* pLocale); 00077 00078 #endif /* UT_LOCALE_H */