ICU 72.1 72.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
35U_NAMESPACE_BEGIN
36
37// can't be #ifndef U_HIDE_INTERNAL_API; needed for char[] field size
42constexpr const size_t kInternalNumSysNameCapacity = 8;
43
61public:
62
69
75
80 NumberingSystem& operator=(const NumberingSystem& other) = default;
81
87
94 static NumberingSystem* U_EXPORT2 createInstance(const Locale & inLocale, UErrorCode& status);
95
100 static NumberingSystem* U_EXPORT2 createInstance(UErrorCode& status);
101
111 static NumberingSystem* U_EXPORT2 createInstance(int32_t radix, UBool isAlgorithmic, const UnicodeString& description, UErrorCode& status );
112
122 static StringEnumeration * U_EXPORT2 getAvailableNames(UErrorCode& status);
123
138 static NumberingSystem* U_EXPORT2 createInstanceByName(const char* name, UErrorCode& status);
139
140
147 int32_t getRadix() const;
148
157 const char * getName() const;
158
170
171
172
181
188 static UClassID U_EXPORT2 getStaticClassID(void);
189
195 virtual UClassID getDynamicClassID() const override;
196
197
198private:
199 UnicodeString desc;
200 int32_t radix;
201 UBool algorithmic;
202 char name[kInternalNumSysNameCapacity+1];
203
204 void setRadix(int32_t radix);
205
206 void setAlgorithmic(UBool algorithmic);
207
208 void setDesc(const UnicodeString &desc);
209
210 void setName(const char* name);
211};
212
213U_NAMESPACE_END
214
215#endif /* #if !UCONFIG_NO_FORMATTING */
216
217#endif /* U_SHOW_CPLUSPLUS_API */
218
219#endif // _NUMSYS
220//eof
A Locale object represents a specific geographical, political, or cultural region.
Definition: locid.h:195
Defines numbering systems.
Definition: numsys.h:60
static NumberingSystem * createInstance(int32_t radix, UBool isAlgorithmic, const UnicodeString &description, UErrorCode &status)
Create a numbering system using the specified radix, type, and description.
const char * getName() const
Returns the name of this numbering system if it was created using one of the predefined names known t...
static NumberingSystem * createInstanceByName(const char *name, UErrorCode &status)
Create a numbering system from one of the predefined numbering systems specified by CLDR and known to...
virtual UClassID getDynamicClassID() const override
ICU "poor man's RTTI", returns a UClassID for the actual class.
static UClassID getStaticClassID(void)
ICU "poor man's RTTI", returns a UClassID for this class.
virtual ~NumberingSystem()
Destructor.
NumberingSystem()
Default Constructor.
UBool isAlgorithmic() const
Returns true if the given numbering system is algorithmic.
virtual UnicodeString getDescription() const
Returns the description string of this numbering system.
NumberingSystem(const NumberingSystem &other)
Copy constructor.
static NumberingSystem * createInstance(const Locale &inLocale, UErrorCode &status)
Create the default numbering system associated with the specified locale.
static NumberingSystem * createInstance(UErrorCode &status)
Create the default numbering system associated with the default locale.
static StringEnumeration * getAvailableNames(UErrorCode &status)
Return a StringEnumeration over all the names of numbering systems known to ICU.
int32_t getRadix() const
Returns the radix of this numbering system.
NumberingSystem & operator=(const NumberingSystem &other)=default
Copy assignment.
Base class for 'pure' C++ implementations of uenum api.
Definition: strenum.h:61
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition: unistr.h:296
C++ API: Base class for all formats.
constexpr const size_t kInternalNumSysNameCapacity
Size of a numbering system name.
Definition: numsys.h:42
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition: umachine.h:269
C++ API: Common ICU base class UObject.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
#define U_I18N_API
Set to export library symbols from inside the i18n library, and to import them from outside.
Definition: utypes.h:301