~ubuntu-branches/ubuntu/precise/icu/precise

« back to all changes in this revision

Viewing changes to source/i18n/unicode/tmutfmt.h

  • Committer: Package Import Robot
  • Author(s): Jay Berkenbilt
  • Date: 2011-11-09 09:59:08 UTC
  • mfrom: (10.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20111109095908-x875xobgnnvttamx
Tags: 4.8.1.1-1
* New upstream release
* Add simple patch to define PATH_MAX when not defined.  Not an ideal
  solution, but it will do for now.  (Closes: #643661)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 *******************************************************************************
3
 
 * Copyright (C) 2010, Google, International Business Machines Corporation and *
4
 
 * others. All Rights Reserved.                                                *
 
3
 * Copyright (C) 2008-2011, Google, International Business Machines Corporation
 
4
 * and others. All Rights Reserved.
5
5
 *******************************************************************************
6
6
 */
7
7
 
26
26
#include "unicode/plurrule.h"
27
27
 
28
28
/**
29
 
 * @internal ICU 4.2
 
29
 * Constants for various styles.
 
30
 * There are 2 styles: full name and abbreviated name.
 
31
 * For example, for English, the full name for hour duration is "3 hours",
 
32
 * and the abbreviated name is "3 hrs".
 
33
 * @draft ICU 4.8
30
34
 */
31
 
 
32
 
union UHashTok;
 
35
enum UTimeUnitFormatStyle {
 
36
    /** @draft ICU 4.8 */
 
37
    UTMUTFMT_FULL_STYLE,
 
38
    /** @draft ICU 4.8 */
 
39
    UTMUTFMT_ABBREVIATED_STYLE,
 
40
    /** @draft ICU 4.8 */
 
41
    UTMUTFMT_FORMAT_STYLE_COUNT
 
42
};
 
43
typedef enum UTimeUnitFormatStyle UTimeUnitFormatStyle; /**< @draft ICU 4.8 */
33
44
 
34
45
U_NAMESPACE_BEGIN
35
46
 
70
81
public:
71
82
 
72
83
    /**
73
 
     * Constants for various styles.
74
 
     * There are 2 styles: full name and abbreviated name.
75
 
     * For example, for English, the full name for hour duration is "3 hours",
76
 
     * and the abbreviated name is "3 hrs".
77
 
     * @draft ICU 4.2
78
 
     */
79
 
    enum EStyle {
80
 
        kFull = 0,
81
 
        kAbbreviate = 1,
82
 
        kTotal = kAbbreviate + 1
83
 
    };
84
 
 
85
 
    /**
86
84
     * Create TimeUnitFormat with default locale, and full name style.
87
85
     * Use setLocale and/or setFormat to modify.
88
86
     * @stable ICU 4.2
97
95
 
98
96
    /**
99
97
     * Create TimeUnitFormat given locale and style.
100
 
     * @draft ICU 4.2
 
98
     * @draft ICU 4.8
101
99
     */
102
 
    TimeUnitFormat(const Locale& locale, EStyle style, UErrorCode& status);
 
100
    TimeUnitFormat(const Locale& locale, UTimeUnitFormatStyle style, UErrorCode& status);
103
101
 
104
102
    /**
105
103
     * Copy constructor.
219
217
    Locale        fLocale;
220
218
    Hashtable*    fTimeUnitToCountToPatterns[TimeUnit::UTIMEUNIT_FIELD_COUNT];
221
219
    PluralRules*  fPluralRules;
222
 
    EStyle           fStyle;
 
220
    UTimeUnitFormatStyle fStyle;
223
221
 
224
 
    void create(const Locale& locale, EStyle style, UErrorCode& status);
 
222
    void create(const Locale& locale, UTimeUnitFormatStyle style, UErrorCode& status);
225
223
 
226
224
    // it might actually be simpler to make them Decimal Formats later.
227
225
    // initialize all private data members
231
229
    void initDataMembers(UErrorCode& status);
232
230
 
233
231
    // initialize fTimeUnitToCountToPatterns from current locale's resource.
234
 
    void readFromCurrentLocale(EStyle style, const char* key, UErrorCode& status);
 
232
    void readFromCurrentLocale(UTimeUnitFormatStyle style, const char* key, UErrorCode& status);
235
233
 
236
234
    // check completeness of fTimeUnitToCountToPatterns against all time units,
237
235
    // and all plural rules, fill in fallback as necessary.
238
 
    void checkConsistency(EStyle style, const char* key, UErrorCode& status);
 
236
    void checkConsistency(UTimeUnitFormatStyle style, const char* key, UErrorCode& status);
239
237
 
240
238
    // fill in fTimeUnitToCountToPatterns from locale fall-back chain
241
 
    void searchInLocaleChain(EStyle style, const char* key,
242
 
                             TimeUnit::UTimeUnitFields field, const char*,
 
239
    void searchInLocaleChain(UTimeUnitFormatStyle style, const char* key, const char* localeName,
 
240
                             TimeUnit::UTimeUnitFields field, const UnicodeString&,
243
241
                             const char*, Hashtable*, UErrorCode&);
244
242
 
245
243
    // initialize hash table