ICU 57.1
57.1
common
unicode
listformatter.h
Go to the documentation of this file.
1
/*
2
*******************************************************************************
3
*
4
* Copyright (C) 2012-2016, International Business Machines
5
* Corporation and others. All Rights Reserved.
6
*
7
*******************************************************************************
8
* file name: listformatter.h
9
* encoding: US-ASCII
10
* tab size: 8 (not used)
11
* indentation:4
12
*
13
* created on: 20120426
14
* created by: Umesh P. Nair
15
*/
16
17
#ifndef __LISTFORMATTER_H__
18
#define __LISTFORMATTER_H__
19
20
#include "
unicode/utypes.h
"
21
22
#include "
unicode/unistr.h
"
23
#include "
unicode/locid.h
"
24
25
U_NAMESPACE_BEGIN
26
28
class
Hashtable;
29
31
struct
ListFormatInternal;
32
33
/* The following can't be #ifndef U_HIDE_INTERNAL_API, needed for other .h file declarations */
35
struct
ListFormatData
:
public
UMemory
{
36
UnicodeString
twoPattern;
37
UnicodeString
startPattern;
38
UnicodeString
middlePattern;
39
UnicodeString
endPattern;
40
41
ListFormatData
(
const
UnicodeString
& two,
const
UnicodeString
& start,
const
UnicodeString
& middle,
const
UnicodeString
& end) :
42
twoPattern(two), startPattern(start), middlePattern(middle), endPattern(end) {}
43
};
44
45
62
class
U_COMMON_API
ListFormatter
:
public
UObject
{
63
64
public
:
65
70
ListFormatter
(
const
ListFormatter
&);
71
76
ListFormatter
& operator=(
const
ListFormatter
& other);
77
86
static
ListFormatter
* createInstance(
UErrorCode
& errorCode);
87
97
static
ListFormatter
* createInstance(
const
Locale
& locale,
UErrorCode
& errorCode);
98
99
#ifndef U_HIDE_INTERNAL_API
100
110
static
ListFormatter
* createInstance(
const
Locale
& locale,
const
char
* style,
UErrorCode
& errorCode);
111
#endif
/* U_HIDE_INTERNAL_API */
112
118
virtual
~
ListFormatter
();
119
120
131
UnicodeString
& format(
const
UnicodeString
items[], int32_t n_items,
132
UnicodeString
& appendTo,
UErrorCode
& errorCode)
const
;
133
134
#ifndef U_HIDE_INTERNAL_API
135
138
UnicodeString
& format(
139
const
UnicodeString
items[],
140
int32_t n_items,
141
UnicodeString
& appendTo,
142
int32_t index,
143
int32_t &offset,
144
UErrorCode
& errorCode)
const
;
148
ListFormatter
(
const
ListFormatData
&data,
UErrorCode
&errorCode);
152
ListFormatter
(
const
ListFormatInternal* listFormatterInternal);
153
#endif
/* U_HIDE_INTERNAL_API */
154
155
private
:
156
static
void
initializeHash(
UErrorCode
& errorCode);
157
static
const
ListFormatInternal* getListFormatInternal(
const
Locale
& locale,
const
char
*style,
UErrorCode
& errorCode);
158
159
ListFormatter
();
160
161
ListFormatInternal* owned;
162
const
ListFormatInternal* data;
163
};
164
165
U_NAMESPACE_END
166
167
#endif
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::ListFormatData
Definition:
listformatter.h:35
U_COMMON_API
#define U_COMMON_API
Definition:
utypes.h:357
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition:
unistr.h:293
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition:
uobject.h:221
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers,...
Definition:
utypes.h:476
icu::UMemory
UMemory is the common ICU base class.
Definition:
uobject.h:110
icu::ListFormatter
An immutable class for formatting a list, using data from CLDR (or supplied separately).
Definition:
listformatter.h:62
locid.h
C++ API: Locale ID object.
U_NAMESPACE_END
#define U_NAMESPACE_END
Definition:
uversion.h:130
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
Definition:
uversion.h:129
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition:
locid.h:185
unistr.h
C++ API: Unicode String.
Generated by
1.8.17