ICU 66.1 66.1
uformattable.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) 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
38
46typedef enum UFormattableType {
54#ifndef U_HIDE_DEPRECATED_API
60#endif /* U_HIDE_DEPRECATED_API */
62
63
70typedef void *UFormattable;
71
82U_STABLE UFormattable* U_EXPORT2
84
91U_STABLE void U_EXPORT2
93
94#if U_SHOW_CPLUSPLUS_API
95
96U_NAMESPACE_BEGIN
97
108
109U_NAMESPACE_END
110
111#endif
112
125
134U_STABLE UBool U_EXPORT2
136
147U_STABLE UDate U_EXPORT2
149
165U_STABLE double U_EXPORT2
167
186U_STABLE int32_t U_EXPORT2
188
189
207U_STABLE int64_t U_EXPORT2
209
220U_STABLE const void *U_EXPORT2
222
235U_STABLE const UChar* U_EXPORT2
236ufmt_getUChars(UFormattable* fmt, int32_t *len, UErrorCode *status);
237
246U_STABLE int32_t U_EXPORT2
248
258U_STABLE UFormattable * U_EXPORT2
260
283U_STABLE const char * U_EXPORT2
284ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status);
285
286#endif
287
288#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:562
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.
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*),...
UFormattableType ufmt_getType(const UFormattable *fmt, UErrorCode *status)
Return the type of this object.
const char * ufmt_getDecNumChars(UFormattable *fmt, int32_t *len, UErrorCode *status)
Returns a numeric string representation of the number contained within this formattable,...
UFormattable * ufmt_getArrayItemByIndex(UFormattable *fmt, int32_t n, UErrorCode *status)
Get the specified value from the array of UFormattables.
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:46
@ UFMT_STRING
ufmt_getUChars() will return without conversion.
Definition: uformattable.h:50
@ UFMT_LONG
ufmt_getLong() will return without conversion.
Definition: uformattable.h:49
@ UFMT_ARRAY
ufmt_countArray() and ufmt_getArray() will return the value.
Definition: uformattable.h:51
@ UFMT_OBJECT
ufmt_getObject() will return without conversion.
Definition: uformattable.h:53
@ UFMT_DOUBLE
ufmt_getDouble() will return without conversion.
Definition: uformattable.h:48
@ UFMT_DATE
ufmt_getDate() will return without conversion.
Definition: uformattable.h:47
@ UFMT_COUNT
One more than the highest normal UFormattableType value.
Definition: uformattable.h:59
@ UFMT_INT64
ufmt_getInt64() will return without conversion.
Definition: uformattable.h:52
void * UFormattable
Opaque type representing various types of data which may be used for formatting and parsing operation...
Definition: uformattable.h:70
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.
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:261
uint16_t UChar
The base type for UTF-16 code units and pointers.
Definition: umachine.h:378
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:111
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition: utypes.h:415
double UDate
Date and Time data type.
Definition: utypes.h:203