ICU 50.1.2
50.1.2
Main Page
Related Pages
Modules
Namespaces
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
Locale
& locale,
UPluralType
type,
UErrorCode
& status);
206
217
PluralFormat
(
const
UnicodeString
& pattern,
UErrorCode
& status);
218
233
PluralFormat
(
const
Locale
& locale,
const
UnicodeString
& pattern,
UErrorCode
& status);
234
246
PluralFormat
(
const
PluralRules
& rules,
247
const
UnicodeString
& pattern,
248
UErrorCode
& status);
249
264
PluralFormat
(
const
Locale
& locale,
265
const
PluralRules
& rules,
266
const
UnicodeString
& pattern,
267
UErrorCode
& status);
268
282
PluralFormat
(
const
Locale
& locale,
283
UPluralType
type,
284
const
UnicodeString
& pattern,
285
UErrorCode
& status);
286
291
PluralFormat
(
const
PluralFormat
& other);
292
297
virtual
~
PluralFormat
();
298
311
void
applyPattern(
const
UnicodeString
& pattern,
UErrorCode
& status);
312
313
314
using
Format::format;
315
328
UnicodeString
format
(int32_t number,
UErrorCode
& status)
const
;
329
342
UnicodeString
format
(
double
number,
UErrorCode
& status)
const
;
343
360
UnicodeString
&
format
(int32_t number,
361
UnicodeString
& appendTo,
362
FieldPosition
& pos,
363
UErrorCode
& status)
const
;
364
381
UnicodeString
&
format
(
double
number,
382
UnicodeString
& appendTo,
383
FieldPosition
& pos,
384
UErrorCode
& status)
const
;
385
401
void
setLocale(
const
Locale
& locale,
UErrorCode
& status);
402
412
void
setNumberFormat(
const
NumberFormat
* format,
UErrorCode
& status);
413
420
PluralFormat
&
operator=
(
const
PluralFormat
& other);
421
429
virtual
UBool
operator==
(
const
Format
& other)
const
;
430
438
virtual
UBool
operator!=
(
const
Format
& other)
const
;
439
445
virtual
Format
*
clone
(
void
)
const
;
446
459
UnicodeString
&
format
(
const
Formattable
& obj,
460
UnicodeString
& appendTo,
461
FieldPosition
& pos,
462
UErrorCode
& status)
const
;
463
472
UnicodeString
& toPattern(
UnicodeString
& appendTo);
473
496
virtual
void
parseObject
(
const
UnicodeString
& source,
497
Formattable
& result,
498
ParsePosition
& parse_pos)
const
;
499
506
static
UClassID
U_EXPORT2 getStaticClassID(
void
);
507
513
virtual
UClassID
getDynamicClassID
()
const
;
514
515
#if (defined(__xlC__) && (__xlC__ < 0x0C00)) || (U_PLATFORM == U_PF_OS390) || (U_PLATFORM ==U_PF_OS400)
516
// Work around a compiler bug on xlC 11.1 on AIX 7.1 that would
517
// prevent PluralSelectorAdapter from implementing private PluralSelector.
518
// xlC error message:
519
// 1540-0300 (S) The "private" member "class icu_49::PluralFormat::PluralSelector" cannot be accessed.
520
public
:
521
#else
522
private
:
523
#endif
524
527
class
U_I18N_API
PluralSelector
:
public
UMemory
{
528
public
:
529
virtual
~
PluralSelector
();
537
virtual
UnicodeString
select(
double
number,
UErrorCode
& ec)
const
= 0;
538
};
539
543
class
U_I18N_API
PluralSelectorAdapter
:
public
PluralSelector
{
544
public
:
545
PluralSelectorAdapter
() : pluralRules(
NULL
) {
546
}
547
548
virtual
~
PluralSelectorAdapter
();
549
550
virtual
UnicodeString
select(
double
number,
UErrorCode
&
/*ec*/
)
const
;
551
552
void
reset();
553
554
PluralRules
* pluralRules;
555
};
556
557
#if defined(__xlC__)
558
// End of xlC bug workaround, keep remaining definitions private.
559
private
:
560
#endif
561
Locale
locale;
562
MessagePattern
msgPattern;
563
NumberFormat
* numberFormat;
564
double
offset;
565
PluralSelectorAdapter
pluralRulesWrapper;
566
567
PluralFormat
();
// default constructor not implemented
568
void
init(
const
PluralRules
* rules,
UPluralType
type,
UErrorCode
& status);
573
void
copyObjects
(
const
PluralFormat
& other);
574
585
static
int32_t
findSubMessage
(
586
const
MessagePattern
& pattern, int32_t partIndex,
587
const
PluralSelector
& selector,
double
number,
UErrorCode
& ec);
588
589
friend
class
MessageFormat
;
590
};
591
592
U_NAMESPACE_END
593
594
#endif
/* #if !UCONFIG_NO_FORMATTING */
595
596
#endif // _PLURFMT
597
//eof
Generated on Thu Jan 10 2013 16:42:09 for ICU 50.1.2 by
1.8.1.2