ICU 56.1
56.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
i18n
unicode
plurfmt.h
Go to the documentation of this file.
1
/*
2
*******************************************************************************
3
* Copyright (C) 2007-2014, International Business Machines Corporation and
4
* others. All Rights Reserved.
5
*******************************************************************************
6
*
7
8
* File PLURFMT.H
9
********************************************************************************
10
*/
11
12
#ifndef PLURFMT
13
#define PLURFMT
14
15
#include "
unicode/utypes.h
"
16
22
#if !UCONFIG_NO_FORMATTING
23
24
#include "
unicode/messagepattern.h
"
25
#include "
unicode/numfmt.h
"
26
#include "
unicode/plurrule.h
"
27
28
U_NAMESPACE_BEGIN
29
30
class
Hashtable;
31
class
NFRule;
32
144
class
U_I18N_API
PluralFormat
:
public
Format
{
145
public
:
146
155
PluralFormat
(
UErrorCode
& status);
156
166
PluralFormat
(
const
Locale
& locale,
UErrorCode
& status);
167
177
PluralFormat
(
const
PluralRules
& rules,
UErrorCode
& status);
178
195
PluralFormat
(
const
Locale
& locale,
const
PluralRules
& rules,
UErrorCode
& status);
196
207
PluralFormat
(
const
Locale
& locale,
UPluralType
type,
UErrorCode
& status);
208
219
PluralFormat
(
const
UnicodeString
& pattern,
UErrorCode
& status);
220
235
PluralFormat
(
const
Locale
& locale,
const
UnicodeString
& pattern,
UErrorCode
& status);
236
248
PluralFormat
(
const
PluralRules
& rules,
249
const
UnicodeString
& pattern,
250
UErrorCode
& status);
251
266
PluralFormat
(
const
Locale
& locale,
267
const
PluralRules
& rules,
268
const
UnicodeString
& pattern,
269
UErrorCode
& status);
270
284
PluralFormat
(
const
Locale
& locale,
285
UPluralType
type,
286
const
UnicodeString
& pattern,
287
UErrorCode
& status);
288
293
PluralFormat
(
const
PluralFormat
& other);
294
299
virtual
~
PluralFormat
();
300
313
void
applyPattern(
const
UnicodeString
& pattern,
UErrorCode
& status);
314
315
316
using
Format::format;
317
330
UnicodeString
format
(int32_t number,
UErrorCode
& status)
const
;
331
344
UnicodeString
format
(
double
number,
UErrorCode
& status)
const
;
345
362
UnicodeString
&
format
(int32_t number,
363
UnicodeString
& appendTo,
364
FieldPosition
& pos,
365
UErrorCode
& status)
const
;
366
383
UnicodeString
&
format
(
double
number,
384
UnicodeString
& appendTo,
385
FieldPosition
& pos,
386
UErrorCode
& status)
const
;
387
388
#ifndef U_HIDE_DEPRECATED_API
389
404
void
setLocale(
const
Locale
& locale,
UErrorCode
& status);
405
#endif
/* U_HIDE_DEPRECATED_API */
406
416
void
setNumberFormat(
const
NumberFormat
* format,
UErrorCode
& status);
417
424
PluralFormat
&
operator=
(
const
PluralFormat
& other);
425
433
virtual
UBool
operator==
(
const
Format
& other)
const
;
434
442
virtual
UBool
operator!=
(
const
Format
& other)
const
;
443
449
virtual
Format
*
clone
(
void
)
const
;
450
465
UnicodeString
&
format
(
const
Formattable
& obj,
466
UnicodeString
& appendTo,
467
FieldPosition
& pos,
468
UErrorCode
& status)
const
;
469
478
UnicodeString
& toPattern(
UnicodeString
& appendTo);
479
502
virtual
void
parseObject
(
const
UnicodeString
& source,
503
Formattable
& result,
504
ParsePosition
& parse_pos)
const
;
505
512
static
UClassID
U_EXPORT2 getStaticClassID(
void
);
513
519
virtual
UClassID
getDynamicClassID
()
const
;
520
521
#if (defined(__xlC__) && (__xlC__ < 0x0C00)) || (U_PLATFORM == U_PF_OS390) || (U_PLATFORM ==U_PF_OS400)
522
// Work around a compiler bug on xlC 11.1 on AIX 7.1 that would
523
// prevent PluralSelectorAdapter from implementing private PluralSelector.
524
// xlC error message:
525
// 1540-0300 (S) The "private" member "class icu_49::PluralFormat::PluralSelector" cannot be accessed.
526
public
:
527
#else
528
private
:
529
#endif
530
533
class
U_I18N_API
PluralSelector
:
public
UMemory
{
534
public
:
535
virtual
~
PluralSelector
();
545
virtual
UnicodeString
select(
void
*context,
double
number,
UErrorCode
& ec)
const
= 0;
546
};
547
551
class
U_I18N_API
PluralSelectorAdapter
:
public
PluralSelector
{
552
public
:
553
PluralSelectorAdapter
() : pluralRules(
NULL
) {
554
}
555
556
virtual
~
PluralSelectorAdapter
();
557
558
virtual
UnicodeString
select(
void
*context,
double
number,
UErrorCode
&
/*ec*/
)
const
;
560
void
reset();
561
562
PluralRules
* pluralRules;
563
};
564
565
#if defined(__xlC__)
566
// End of xlC bug workaround, keep remaining definitions private.
567
private
:
568
#endif
569
Locale
locale;
570
MessagePattern
msgPattern;
571
NumberFormat
* numberFormat;
572
double
offset;
573
PluralSelectorAdapter
pluralRulesWrapper;
574
575
PluralFormat
();
// default constructor not implemented
576
void
init(
const
PluralRules
* rules,
UPluralType
type,
UErrorCode
& status);
581
void
copyObjects
(
const
PluralFormat
& other);
582
583
UnicodeString
&
format
(
const
Formattable
& numberObject,
double
number,
584
UnicodeString
& appendTo,
585
FieldPosition
& pos,
586
UErrorCode
& status)
const
;
599
static
int32_t
findSubMessage
(
600
const
MessagePattern
& pattern, int32_t partIndex,
601
const
PluralSelector
& selector,
void
*context,
double
number,
UErrorCode
& ec);
603
void
parseType(
const
UnicodeString
& source,
const
NFRule *rbnfLenientScanner,
604
Formattable
& result,
FieldPosition
& pos)
const
;
605
606
friend
class
MessageFormat
;
607
friend
class
NFRule;
608
};
609
610
U_NAMESPACE_END
611
612
#endif
/* #if !UCONFIG_NO_FORMATTING */
613
614
#endif // _PLURFMT
615
//eof
Generated on Wed Oct 7 2015 21:17:56 for ICU 56.1 by
1.8.1.2