ICU 57.1  57.1
uformattable.h
Go to the documentation of this file.
1 /*
2 ********************************************************************************
3 * Copyright (C) 2013-2014, International Business Machines Corporation and others.
4 * All Rights Reserved.
5 ********************************************************************************
6 *
7 * File UFORMATTABLE.H
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 2013 Jun 7 srl New
13 ********************************************************************************
14 */
15 
28 #ifndef UFORMATTABLE_H
29 #define UFORMATTABLE_H
30 
31 #include "unicode/utypes.h"
32 
33 #if !UCONFIG_NO_FORMATTING
34 
35 #include "unicode/localpointer.h"
36 
44 typedef enum UFormattableType {
45  UFMT_DATE = 0,
52  UFMT_COUNT
54 
55 
62 typedef void *UFormattable;
63 
74 U_STABLE UFormattable* U_EXPORT2
76 
83 U_STABLE void U_EXPORT2
85 
86 #if U_SHOW_CPLUSPLUS_API
87 
89 
100 
102 
103 #endif
104 
115 U_STABLE UFormattableType U_EXPORT2
116 ufmt_getType(const UFormattable* fmt, UErrorCode *status);
117 
126 U_STABLE UBool U_EXPORT2
128 
139 U_STABLE UDate U_EXPORT2
140 ufmt_getDate(const UFormattable* fmt, UErrorCode *status);
141 
157 U_STABLE double U_EXPORT2
159 
178 U_STABLE int32_t U_EXPORT2
180 
181 
199 U_STABLE int64_t U_EXPORT2
201 
212 U_STABLE const void *U_EXPORT2
214 
227 U_STABLE const UChar* U_EXPORT2
228 ufmt_getUChars(UFormattable* fmt, int32_t *len, UErrorCode *status);
229 
238 U_STABLE int32_t U_EXPORT2
240 
250 U_STABLE UFormattable * U_EXPORT2
252 
275 U_STABLE const char * U_EXPORT2
276 ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status);
277 
278 #endif
279 
280 #endif
"Smart pointer" class, closes a UFormattable via ufmt_close().
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
#define U_DEFINE_LOCAL_OPEN_POINTER(LocalPointerClassName, Type, closeFunction)
"Smart pointer" definition macro, deletes objects via the closeFunction.
Definition: localpointer.h:539
double ufmt_getDouble(UFormattable *fmt, UErrorCode *status)
Gets the double value of this object.
UBool ufmt_isNumeric(const UFormattable *fmt)
Return whether the object is numeric.
UFormattableType ufmt_getType(const UFormattable *fmt, UErrorCode *status)
Return the type of this object.
const UChar * ufmt_getUChars(UFormattable *fmt, int32_t *len, UErrorCode *status)
Gets the string value of this object as a UChar string.
UFormattableType
Enum designating the type of a UFormattable instance.
Definition: uformattable.h:44
@ UFMT_STRING
ufmt_getUChars() will return without conversion.
Definition: uformattable.h:48
@ UFMT_LONG
ufmt_getLong() will return without conversion.
Definition: uformattable.h:47
@ UFMT_ARRAY
ufmt_countArray() and ufmt_getArray() will return the value.
Definition: uformattable.h:49
@ UFMT_OBJECT
ufmt_getObject() will return without conversion.
Definition: uformattable.h:51
@ UFMT_DOUBLE
ufmt_getDouble() will return without conversion.
Definition: uformattable.h:46
@ UFMT_DATE
ufmt_getDate() will return without conversion.
Definition: uformattable.h:45
@ UFMT_COUNT
Count of defined UFormattableType values.
Definition: uformattable.h:52
@ UFMT_INT64
ufmt_getInt64() will return without conversion.
Definition: uformattable.h:50
UFormattable * ufmt_getArrayItemByIndex(UFormattable *fmt, int32_t n, UErrorCode *status)
Get the specified value from the array of UFormattables.
void * UFormattable
Opaque type representing various types of data which may be used for formatting and parsing operation...
Definition: uformattable.h:62
int64_t ufmt_getInt64(UFormattable *fmt, UErrorCode *status)
Gets the int64_t value of this object.
int32_t ufmt_getArrayLength(const UFormattable *fmt, UErrorCode *status)
Get the number of array objects contained, if an array type UFMT_ARRAY.
UFormattable * ufmt_open(UErrorCode *status)
Initialize a UFormattable, to type UNUM_LONG, value 0 may return error if memory allocation failed.
const void * ufmt_getObject(const UFormattable *fmt, UErrorCode *status)
Returns a pointer to the UObject contained within this formattable (as a const void*),...
const char * ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status)
Returns a numeric string representation of the number contained within this formattable,...
void ufmt_close(UFormattable *fmt)
Cleanup any additional memory allocated by this UFormattable.
int32_t ufmt_getLong(UFormattable *fmt, UErrorCode *status)
Gets the long (int32_t) value of this object.
UDate ufmt_getDate(const UFormattable *fmt, UErrorCode *status)
Gets the UDate value of this object.
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234
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:312
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:109
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition: utypes.h:476
double UDate
Date and Time data type.
Definition: utypes.h:201
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129