ICU 58.2 58.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

uformattable.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ********************************************************************************
5 * Copyright (C) 2013-2014, International Business Machines Corporation and others.
6 * All Rights Reserved.
7 ********************************************************************************
8 *
9 * File UFORMATTABLE.H
10 *
11 * Modification History:
12 *
13 * Date Name Description
14 * 2013 Jun 7 srl New
15 ********************************************************************************
16 */
17
30 #ifndef UFORMATTABLE_H
31 #define UFORMATTABLE_H
32
33 #include "unicode/utypes.h"
34
35 #if !UCONFIG_NO_FORMATTING
36
37 #include "unicode/localpointer.h"
38
46 typedef enum UFormattableType {
47 UFMT_DATE = 0,
48 UFMT_DOUBLE,
49 UFMT_LONG,
50 UFMT_STRING,
51 UFMT_ARRAY,
52 UFMT_INT64,
53 UFMT_OBJECT,
54 #ifndef U_HIDE_DEPRECATED_API
55
59 UFMT_COUNT
60 #endif // U_HIDE_DEPRECATED_API
61 } UFormattableType;
62
63
70 typedef void *UFormattable;
71
82 U_STABLE UFormattable* U_EXPORT2
83 ufmt_open(UErrorCode* status);
84
91 U_STABLE void U_EXPORT2
92 ufmt_close(UFormattable* fmt);
93
94 #if U_SHOW_CPLUSPLUS_API
95
96 U_NAMESPACE_BEGIN
97
107 U_DEFINE_LOCAL_OPEN_POINTER(LocalUFormattablePointer, UFormattable, ufmt_close);
108
109 U_NAMESPACE_END
110
111 #endif
112
123 U_STABLE UFormattableType U_EXPORT2
124 ufmt_getType(const UFormattable* fmt, UErrorCode *status);
125
134 U_STABLE UBool U_EXPORT2
135 ufmt_isNumeric(const UFormattable* fmt);
136
147 U_STABLE UDate U_EXPORT2
148 ufmt_getDate(const UFormattable* fmt, UErrorCode *status);
149
165 U_STABLE double U_EXPORT2
166 ufmt_getDouble(UFormattable* fmt, UErrorCode *status);
167
186 U_STABLE int32_t U_EXPORT2
187 ufmt_getLong(UFormattable* fmt, UErrorCode *status);
188
189
207 U_STABLE int64_t U_EXPORT2
208 ufmt_getInt64(UFormattable* fmt, UErrorCode *status);
209
220 U_STABLE const void *U_EXPORT2
221 ufmt_getObject(const UFormattable* fmt, UErrorCode *status);
222
235 U_STABLE const UChar* U_EXPORT2
236 ufmt_getUChars(UFormattable* fmt, int32_t *len, UErrorCode *status);
237
246 U_STABLE int32_t U_EXPORT2
247 ufmt_getArrayLength(const UFormattable* fmt, UErrorCode *status);
248
258 U_STABLE UFormattable * U_EXPORT2
259 ufmt_getArrayItemByIndex(UFormattable* fmt, int32_t n, UErrorCode *status);
260
283 U_STABLE const char * U_EXPORT2
284 ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status);
285
286 #endif
287
288 #endif
ufmt_open
UFormattable * ufmt_open(UErrorCode *status)
Initialize a UFormattable, to type UNUM_LONG, value 0 may return error if memory allocation failed...
ufmt_getDouble
double ufmt_getDouble(UFormattable *fmt, UErrorCode *status)
Gets the double value of this object.
ufmt_getUChars
const UChar * ufmt_getUChars(UFormattable *fmt, int32_t *len, UErrorCode *status)
Gets the string value of this object as a UChar string.
UDate
double UDate
Date and Time data type.
Definition: utypes.h:203
ufmt_getDate
UDate ufmt_getDate(const UFormattable *fmt, UErrorCode *status)
Gets the UDate value of this object.
UFMT_COUNT
One more than the highest normal UFormattableType value.
Definition: uformattable.h:59
ufmt_getArrayLength
int32_t ufmt_getArrayLength(const UFormattable *fmt, UErrorCode *status)
Get the number of array objects contained, if an array type UFMT_ARRAY.
ufmt_getType
UFormattableType ufmt_getType(const UFormattable *fmt, UErrorCode *status)
Return the type of this object.
UFMT_DATE
ufmt_getDate() will return without conversion.
Definition: uformattable.h:47
ufmt_getLong
int32_t ufmt_getLong(UFormattable *fmt, UErrorCode *status)
Gets the long (int32_t) value of this object.
UFMT_ARRAY
ufmt_countArray() and ufmt_getArray() will return the value.
Definition: uformattable.h:51
UFormattableType
UFormattableType
Enum designating the type of a UFormattable instance.
Definition: uformattable.h:46
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
ufmt_close
void ufmt_close(UFormattable *fmt)
Cleanup any additional memory allocated by this UFormattable.
U_DEFINE_LOCAL_OPEN_POINTER
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:530
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UFMT_INT64
ufmt_getInt64() will return without conversion.
Definition: uformattable.h:52
UFMT_OBJECT
ufmt_getObject() will return without conversion.
Definition: uformattable.h:53
ufmt_isNumeric
UBool ufmt_isNumeric(const UFormattable *fmt)
Return whether the object is numeric.
ufmt_getInt64
int64_t ufmt_getInt64(UFormattable *fmt, UErrorCode *status)
Gets the int64_t value of this object.
ufmt_getArrayItemByIndex
UFormattable * ufmt_getArrayItemByIndex(UFormattable *fmt, int32_t n, UErrorCode *status)
Get the specified value from the array of UFormattables.
UFMT_LONG
ufmt_getLong() will return without conversion.
Definition: uformattable.h:49
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:337
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
LocalUFormattablePointer
"Smart pointer" class, closes a UFormattable via ufmt_close().
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:396
UFMT_STRING
ufmt_getUChars() will return without conversion.
Definition: uformattable.h:50
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
ufmt_getObject
const void * ufmt_getObject(const UFormattable *fmt, UErrorCode *status)
Returns a pointer to the UObject contained within this formattable (as a const void*), or NULL if this object is not of type UFMT_OBJECT.
UFormattable
void * UFormattable
Opaque type representing various types of data which may be used for formatting and parsing operation...
Definition: uformattable.h:70
UFMT_DOUBLE
ufmt_getDouble() will return without conversion.
Definition: uformattable.h:48
ufmt_getDecNumChars
const char * ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status)
Returns a numeric string representation of the number contained within this formattable, or NULL if this object does not contain numeric type.
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:134
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259