UDK 3.2.7 C/C++ API Reference
|
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 00002 /************************************************************************* 00003 * 00004 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 00005 * 00006 * Copyright 2000, 2010 Oracle and/or its affiliates. 00007 * 00008 * OpenOffice.org - a multi-platform office productivity suite 00009 * 00010 * This file is part of OpenOffice.org. 00011 * 00012 * OpenOffice.org is free software: you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License version 3 00014 * only, as published by the Free Software Foundation. 00015 * 00016 * OpenOffice.org is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Lesser General Public License version 3 for more details 00020 * (a copy is included in the LICENSE file that accompanied this code). 00021 * 00022 * You should have received a copy of the GNU Lesser General Public License 00023 * version 3 along with OpenOffice.org. If not, see 00024 * <http://www.openoffice.org/license.html> 00025 * for a copy of the LGPLv3 License. 00026 * 00027 ************************************************************************/ 00028 00029 #ifndef _RTL_LOCALE_HXX_ 00030 #define _RTL_LOCALE_HXX_ 00031 00032 #include <rtl/locale.h> 00033 #include <rtl/ustring.hxx> 00034 00035 #ifdef __cplusplus 00036 00037 namespace rtl 00038 { 00039 00165 class OLocale 00166 { 00167 public: 00168 OLocale( rtl_Locale * locale ) 00169 : pData( locale ) {} 00170 00171 OLocale( const OLocale & obj) 00172 : pData(obj.pData) {} 00173 00174 OLocale & operator = ( const OLocale & obj) 00175 { 00176 pData = obj.pData; 00177 return *this; 00178 } 00179 00186 static OLocale registerLocale( const OUString & language, const OUString & country, 00187 const OUString & variant ) 00188 { 00189 return rtl_locale_register( language.getStr(), country.getStr(), variant.getStr() ); 00190 } 00191 00197 static OLocale registerLocale( const OUString & language, const OUString & country ) 00198 { 00199 return rtl_locale_register( language.getStr(), country.getStr(), NULL ); 00200 } 00201 00204 static OLocale getDefault() { return rtl_locale_getDefault(); } 00205 00208 static void setDefault( const OUString & language, const OUString & country, 00209 const OUString & variant ) 00210 { rtl_locale_setDefault(language.getStr(), country.getStr(), variant.getStr()); } 00211 00216 OUString getLanguage() const { return pData->Language; } 00217 00222 OUString getCountry() const { return pData->Country; } 00223 00227 OUString getVariant() const { return pData->Variant; } 00228 00229 00233 sal_Int32 hashCode() const { return pData->HashCode; } 00234 00235 sal_Bool operator == (const OLocale & obj ) const 00236 { 00237 return pData == obj.pData; 00238 } 00239 00240 rtl_Locale * getData() const { return pData; } 00241 00242 private: 00247 rtl_Locale * pData; 00248 00249 OLocale() 00250 : pData(rtl_locale_getDefault()) {} 00251 /* 00252 OLocale( const OLocale & obj) 00253 : pData(obj.pData) {} 00254 00255 OLocale & operator = ( const OLocale & obj) 00256 { pData = obj.pData; 00257 return *this; 00258 } 00259 */ 00260 }; 00261 00262 } 00263 00264 #endif /* __cplusplus */ 00265 #endif /* _RTL_LOCALE_HXX_ */ 00266 00267 00268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */