ICU 65.1  65.1
numsys.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 *******************************************************************************
5 * Copyright (C) 2010-2014, International Business Machines Corporation and
6 * others. All Rights Reserved.
7 *******************************************************************************
8 *
9 *
10 * File NUMSYS.H
11 *
12 * Modification History:*
13 * Date Name Description
14 *
15 ********************************************************************************
16 */
17 
18 #ifndef NUMSYS
19 #define NUMSYS
20 
21 #include "unicode/utypes.h"
22 
23 #if U_SHOW_CPLUSPLUS_API
24 
30 #if !UCONFIG_NO_FORMATTING
31 
32 #include "unicode/format.h"
33 #include "unicode/uobject.h"
34 
35 U_NAMESPACE_BEGIN
36 
37 // can't be #ifndef U_HIDE_INTERNAL_API; needed for char[] field size
42 constexpr const size_t kInternalNumSysNameCapacity = 8;
43 
61 public:
62 
69 
74  NumberingSystem(const NumberingSystem& other);
75 
80  virtual ~NumberingSystem();
81 
88  static NumberingSystem* U_EXPORT2 createInstance(const Locale & inLocale, UErrorCode& status);
89 
94  static NumberingSystem* U_EXPORT2 createInstance(UErrorCode& status);
95 
105  static NumberingSystem* U_EXPORT2 createInstance(int32_t radix, UBool isAlgorithmic, const UnicodeString& description, UErrorCode& status );
106 
116  static StringEnumeration * U_EXPORT2 getAvailableNames(UErrorCode& status);
117 
132  static NumberingSystem* U_EXPORT2 createInstanceByName(const char* name, UErrorCode& status);
133 
134 
141  int32_t getRadix() const;
142 
151  const char * getName() const;
152 
163  virtual UnicodeString getDescription() const;
164 
165 
166 
174  UBool isAlgorithmic() const;
175 
182  static UClassID U_EXPORT2 getStaticClassID(void);
183 
189  virtual UClassID getDynamicClassID() const;
190 
191 
192 private:
193  UnicodeString desc;
194  int32_t radix;
195  UBool algorithmic;
196  char name[kInternalNumSysNameCapacity+1];
197 
198  void setRadix(int32_t radix);
199 
200  void setAlgorithmic(UBool algorithmic);
201 
202  void setDesc(const UnicodeString &desc);
203 
204  void setName(const char* name);
205 
206  static UBool isValidDigitString(const UnicodeString &str);
207 
208  UBool hasContiguousDecimalDigits() const;
209 };
210 
211 U_NAMESPACE_END
212 
213 #endif /* #if !UCONFIG_NO_FORMATTING */
214 
215 #endif /* U_SHOW_CPLUSPLUS_API */
216 
217 #endif // _NUMSYS
218 //eof
Defines numbering systems.
Definition: numsys.h:60
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:61
C++ API: Base class for all formats.
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside...
Definition: utypes.h:301
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
constexpr const size_t kInternalNumSysNameCapacity
Size of a numbering system name.
Definition: numsys.h:42
C++ API: Common ICU base class UObject.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
Basic definitions for ICU, for both C and C++ APIs.
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:294
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
int8_t UBool
The ICU boolean type.
Definition: umachine.h:261
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195