ICU 49.1.1
49.1.1
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
i18n
unicode
plurfmt.h
Go to the documentation of this file.
1
/*
2
*******************************************************************************
3
* Copyright (C) 2007-2012, International Business Machines Corporation and
4
* others. All Rights Reserved.
5
*******************************************************************************
6
*
7
8
* File PLURFMT.H
9
*
10
* Modification History:*
11
* Date Name Description
12
*
13
********************************************************************************
14
*/
15
16
#ifndef PLURFMT
17
#define PLURFMT
18
19
#include "
unicode/utypes.h
"
20
26
#if !UCONFIG_NO_FORMATTING
27
28
#include "
unicode/messagepattern.h
"
29
#include "
unicode/numfmt.h
"
30
#include "
unicode/plurrule.h
"
31
32
U_NAMESPACE_BEGIN
33
34
class
Hashtable;
35
147
class
U_I18N_API
PluralFormat
:
public
Format
{
148
public
:
149
158
PluralFormat
(
UErrorCode
& status);
159
169
PluralFormat
(
const
Locale
& locale,
UErrorCode
& status);
170
180
PluralFormat
(
const
PluralRules
& rules,
UErrorCode
& status);
181
193
PluralFormat
(
const
Locale
& locale,
const
PluralRules
& rules,
UErrorCode
& status);
194
205
PluralFormat
(
const
UnicodeString
& pattern,
UErrorCode
& status);
206
221
PluralFormat
(
const
Locale
& locale,
const
UnicodeString
& pattern,
UErrorCode
& status);
222
234
PluralFormat
(
const
PluralRules
& rules,
235
const
UnicodeString
& pattern,
236
UErrorCode
& status);
237
252
PluralFormat
(
const
Locale
& locale,
253
const
PluralRules
& rules,
254
const
UnicodeString
& pattern,
255
UErrorCode
& status);
256
261
PluralFormat
(
const
PluralFormat
& other);
262
267
virtual
~
PluralFormat
();
268
281
void
applyPattern(
const
UnicodeString
& pattern,
UErrorCode
& status);
282
283
284
using
Format::format
;
285
298
UnicodeString
format
(int32_t number,
UErrorCode
& status)
const
;
299
312
UnicodeString
format
(
double
number,
UErrorCode
& status)
const
;
313
330
UnicodeString
&
format
(int32_t number,
331
UnicodeString
& appendTo,
332
FieldPosition
& pos,
333
UErrorCode
& status)
const
;
334
351
UnicodeString
&
format
(
double
number,
352
UnicodeString
& appendTo,
353
FieldPosition
& pos,
354
UErrorCode
& status)
const
;
355
368
void
setLocale(
const
Locale
& locale,
UErrorCode
& status);
369
379
void
setNumberFormat(
const
NumberFormat
* format,
UErrorCode
& status);
380
387
PluralFormat
&
operator=
(
const
PluralFormat
& other);
388
396
virtual
UBool
operator==
(
const
Format
& other)
const
;
397
405
virtual
UBool
operator!=
(
const
Format
& other)
const
;
406
412
virtual
Format
*
clone
(
void
)
const
;
413
426
UnicodeString
&
format
(
const
Formattable
& obj,
427
UnicodeString
& appendTo,
428
FieldPosition
& pos,
429
UErrorCode
& status)
const
;
430
439
UnicodeString
& toPattern(
UnicodeString
& appendTo);
440
463
virtual
void
parseObject
(
const
UnicodeString
& source,
464
Formattable
& result,
465
ParsePosition
& parse_pos)
const
;
466
473
static
UClassID
U_EXPORT2 getStaticClassID(
void
);
474
480
virtual
UClassID
getDynamicClassID
()
const
;
481
482
#if defined(__xlC__) || (U_PLATFORM == U_PF_OS390) || (U_PLATFORM ==U_PF_OS400)
483
// Work around a compiler bug on xlC 11.1 on AIX 7.1 that would
484
// prevent PluralSelectorAdapter from implementing private PluralSelector.
485
// xlC error message:
486
// 1540-0300 (S) The "private" member "class icu_49::PluralFormat::PluralSelector" cannot be accessed.
487
public
:
488
#else
489
private
:
490
#endif
491
494
class
U_I18N_API
PluralSelector
:
public
UMemory
{
495
public
:
496
virtual
~
PluralSelector
();
504
virtual
UnicodeString
select(
double
number,
UErrorCode
& ec)
const
= 0;
505
};
506
510
class
U_I18N_API
PluralSelectorAdapter
:
public
PluralSelector
{
511
public
:
512
PluralSelectorAdapter
() : pluralRules(
NULL
) {
513
}
514
515
virtual
~
PluralSelectorAdapter
();
516
517
virtual
UnicodeString
select(
double
number,
UErrorCode
&
/*ec*/
)
const
;
518
519
void
reset();
520
521
PluralRules
* pluralRules;
522
};
523
524
#if defined(__xlC__)
525
// End of xlC bug workaround, keep remaining definitions private.
526
private
:
527
#endif
528
Locale
locale;
529
MessagePattern
msgPattern;
530
NumberFormat
* numberFormat;
531
double
offset;
532
PluralSelectorAdapter
pluralRulesWrapper;
533
534
PluralFormat
();
// default constructor not implemented
535
void
init(
const
PluralRules
* rules,
UErrorCode
& status);
540
void
copyObjects
(
const
PluralFormat
& other);
541
552
static
int32_t
findSubMessage
(
553
const
MessagePattern
& pattern, int32_t partIndex,
554
const
PluralSelector
& selector,
double
number,
UErrorCode
& ec);
555
556
friend
class
MessageFormat
;
557
};
558
559
U_NAMESPACE_END
560
561
#endif
/* #if !UCONFIG_NO_FORMATTING */
562
563
#endif // _PLURFMT
564
//eof
Generated by
1.8.3.1