ICU 52.1
52.1
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-2013, 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
143
class
U_I18N_API
PluralFormat
:
public
Format
{
144
public
:
145
154
PluralFormat
(
UErrorCode
& status);
155
165
PluralFormat
(
const
Locale
& locale,
UErrorCode
& status);
166
176
PluralFormat
(
const
PluralRules
& rules,
UErrorCode
& status);
177
194
PluralFormat
(
const
Locale
& locale,
const
PluralRules
& rules,
UErrorCode
& status);
195
206
PluralFormat
(
const
Locale
& locale,
UPluralType
type,
UErrorCode
& status);
207
218
PluralFormat
(
const
UnicodeString
& pattern,
UErrorCode
& status);
219
234
PluralFormat
(
const
Locale
& locale,
const
UnicodeString
& pattern,
UErrorCode
& status);
235
247
PluralFormat
(
const
PluralRules
& rules,
248
const
UnicodeString
& pattern,
249
UErrorCode
& status);
250
265
PluralFormat
(
const
Locale
& locale,
266
const
PluralRules
& rules,
267
const
UnicodeString
& pattern,
268
UErrorCode
& status);
269
283
PluralFormat
(
const
Locale
& locale,
284
UPluralType
type,
285
const
UnicodeString
& pattern,
286
UErrorCode
& status);
287
292
PluralFormat
(
const
PluralFormat
& other);
293
298
virtual
~
PluralFormat
();
299
312
void
applyPattern(
const
UnicodeString
& pattern,
UErrorCode
& status);
313
314
315
using
Format::format
;
316
329
UnicodeString
format
(int32_t number,
UErrorCode
& status)
const
;
330
343
UnicodeString
format
(
double
number,
UErrorCode
& status)
const
;
344
361
UnicodeString
&
format
(int32_t number,
362
UnicodeString
& appendTo,
363
FieldPosition
& pos,
364
UErrorCode
& status)
const
;
365
382
UnicodeString
&
format
(
double
number,
383
UnicodeString
& appendTo,
384
FieldPosition
& pos,
385
UErrorCode
& status)
const
;
386
387
#ifndef U_HIDE_DEPRECATED_API
388
403
void
setLocale(
const
Locale
& locale,
UErrorCode
& status);
404
#endif
/* U_HIDE_DEPRECATED_API */
405
415
void
setNumberFormat(
const
NumberFormat
* format,
UErrorCode
& status);
416
423
PluralFormat
&
operator=
(
const
PluralFormat
& other);
424
432
virtual
UBool
operator==
(
const
Format
& other)
const
;
433
441
virtual
UBool
operator!=
(
const
Format
& other)
const
;
442
448
virtual
Format
*
clone
(
void
)
const
;
449
464
UnicodeString
&
format
(
const
Formattable
& obj,
465
UnicodeString
& appendTo,
466
FieldPosition
& pos,
467
UErrorCode
& status)
const
;
468
477
UnicodeString
& toPattern(
UnicodeString
& appendTo);
478
501
virtual
void
parseObject
(
const
UnicodeString
& source,
502
Formattable
& result,
503
ParsePosition
& parse_pos)
const
;
504
511
static
UClassID
U_EXPORT2 getStaticClassID(
void
);
512
518
virtual
UClassID
getDynamicClassID
()
const
;
519
520
#if (defined(__xlC__) && (__xlC__ < 0x0C00)) || (U_PLATFORM == U_PF_OS390) || (U_PLATFORM ==U_PF_OS400)
521
// Work around a compiler bug on xlC 11.1 on AIX 7.1 that would
522
// prevent PluralSelectorAdapter from implementing private PluralSelector.
523
// xlC error message:
524
// 1540-0300 (S) The "private" member "class icu_49::PluralFormat::PluralSelector" cannot be accessed.
525
public
:
526
#else
527
private
:
528
#endif
529
532
class
U_I18N_API
PluralSelector
:
public
UMemory
{
533
public
:
534
virtual
~
PluralSelector
();
544
virtual
UnicodeString
select(
void
*context,
double
number,
UErrorCode
& ec)
const
= 0;
545
};
546
550
class
U_I18N_API
PluralSelectorAdapter
:
public
PluralSelector
{
551
public
:
552
PluralSelectorAdapter
() : pluralRules(
NULL
) {
553
}
554
555
virtual
~
PluralSelectorAdapter
();
556
557
virtual
UnicodeString
select(
void
*context,
double
number,
UErrorCode
&
/*ec*/
)
const
;
559
void
reset();
560
561
PluralRules
* pluralRules;
562
};
563
564
#if defined(__xlC__)
565
// End of xlC bug workaround, keep remaining definitions private.
566
private
:
567
#endif
568
Locale
locale;
569
MessagePattern
msgPattern;
570
NumberFormat
* numberFormat;
571
double
offset;
572
PluralSelectorAdapter
pluralRulesWrapper;
573
574
PluralFormat
();
// default constructor not implemented
575
void
init(
const
PluralRules
* rules,
UPluralType
type,
UErrorCode
& status);
580
void
copyObjects
(
const
PluralFormat
& other);
581
582
UnicodeString
&
format
(
const
Formattable
& numberObject,
double
number,
583
UnicodeString
& appendTo,
584
FieldPosition
& pos,
585
UErrorCode
& status)
const
;
598
static
int32_t
findSubMessage
(
599
const
MessagePattern
& pattern, int32_t partIndex,
600
const
PluralSelector
& selector,
void
*context,
double
number,
UErrorCode
& ec);
602
friend
class
MessageFormat
;
603
};
604
605
U_NAMESPACE_END
606
607
#endif
/* #if !UCONFIG_NO_FORMATTING */
608
609
#endif // _PLURFMT
610
//eof
Generated on Tue Mar 1 2016 21:34:30 for ICU 52.1 by
1.8.4