locbased.h (2022B)
1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /* 4 ********************************************************************** 5 * Copyright (c) 2004-2014, International Business Machines 6 * Corporation and others. All Rights Reserved. 7 ********************************************************************** 8 * Author: Alan Liu 9 * Created: January 16 2004 10 * Since: ICU 2.8 11 ********************************************************************** 12 */ 13 #ifndef LOCBASED_H 14 #define LOCBASED_H 15 16 #include "unicode/locid.h" 17 #include "unicode/uobject.h" 18 19 U_NAMESPACE_BEGIN 20 21 /** 22 * A utility class that unifies the implementation of getLocale() by 23 * various ICU services. This class is likely to be removed in the 24 * ICU 3.0 time frame in favor of an integrated approach with the 25 * services framework. 26 * @since ICU 2.8 27 */ 28 class U_COMMON_API LocaleBased : public UMemory { 29 30 public: 31 32 /** 33 * Return locale meta-data for the service object wrapped by this 34 * object. Either the valid or the actual locale may be 35 * retrieved. 36 * @param valid The valid locale. 37 * @param actual The actual locale. 38 * @param type either ULOC_VALID_LOCALE or ULOC_ACTUAL_LOCALE 39 * @param status input-output error code 40 * @return the indicated locale 41 */ 42 static const Locale& getLocale( 43 const Locale& valid, const Locale& actual, 44 ULocDataLocaleType type, UErrorCode& status); 45 46 /** 47 * Return the locale ID for the service object wrapped by this 48 * object. Either the valid or the actual locale may be 49 * retrieved. 50 * @param valid The valid locale. 51 * @param actual The actual locale. 52 * @param type either ULOC_VALID_LOCALE or ULOC_ACTUAL_LOCALE 53 * @param status input-output error code 54 * @return the indicated locale ID 55 */ 56 static const char* getLocaleID( 57 const Locale& valid, const Locale& actual, 58 ULocDataLocaleType type, UErrorCode& status); 59 60 }; 61 62 U_NAMESPACE_END 63 64 #endif