123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- #ifndef __TMUTFMT_H__
- #define __TMUTFMT_H__
- #include "unicode/utypes.h"
- #if U_SHOW_CPLUSPLUS_API
- #if !UCONFIG_NO_FORMATTING
- #include "unicode/unistr.h"
- #include "unicode/tmunit.h"
- #include "unicode/tmutamt.h"
- #include "unicode/measfmt.h"
- #include "unicode/numfmt.h"
- #include "unicode/plurrule.h"
- #ifndef U_HIDE_DEPRECATED_API
- enum UTimeUnitFormatStyle {
-
- UTMUTFMT_FULL_STYLE,
-
- UTMUTFMT_ABBREVIATED_STYLE,
-
- UTMUTFMT_FORMAT_STYLE_COUNT
- };
- typedef enum UTimeUnitFormatStyle UTimeUnitFormatStyle;
- U_NAMESPACE_BEGIN
- class Hashtable;
- class UVector;
- struct TimeUnitFormatReadSink;
- class U_I18N_API TimeUnitFormat: public MeasureFormat {
- public:
-
- TimeUnitFormat(UErrorCode& status);
-
- TimeUnitFormat(const Locale& locale, UErrorCode& status);
-
- TimeUnitFormat(const Locale& locale, UTimeUnitFormatStyle style, UErrorCode& status);
-
- TimeUnitFormat(const TimeUnitFormat&);
-
- virtual ~TimeUnitFormat();
-
- virtual TimeUnitFormat* clone() const;
-
- TimeUnitFormat& operator=(const TimeUnitFormat& other);
-
- UBool operator!=(const Format& other) const;
-
- void setLocale(const Locale& locale, UErrorCode& status);
-
- void setNumberFormat(const NumberFormat& format, UErrorCode& status);
-
- virtual void parseObject(const UnicodeString& source,
- Formattable& result,
- ParsePosition& pos) const;
-
- static UClassID U_EXPORT2 getStaticClassID(void);
-
- virtual UClassID getDynamicClassID(void) const;
- private:
- Hashtable* fTimeUnitToCountToPatterns[TimeUnit::UTIMEUNIT_FIELD_COUNT];
- UTimeUnitFormatStyle fStyle;
- void create(UTimeUnitFormatStyle style, UErrorCode& status);
-
-
- void setup(UErrorCode& status);
-
- void initDataMembers(UErrorCode& status);
-
- void readFromCurrentLocale(UTimeUnitFormatStyle style, const char* key, const UVector& pluralCounts,
- UErrorCode& status);
-
-
- void checkConsistency(UTimeUnitFormatStyle style, const char* key, UErrorCode& status);
-
- void searchInLocaleChain(UTimeUnitFormatStyle style, const char* key, const char* localeName,
- TimeUnit::UTimeUnitFields field, const UnicodeString&,
- const char*, Hashtable*, UErrorCode&);
-
- Hashtable* initHash(UErrorCode& status);
-
- void deleteHash(Hashtable* htable);
-
- void copyHash(const Hashtable* source, Hashtable* target, UErrorCode& status);
-
-
- static const char* getTimeUnitName(TimeUnit::UTimeUnitFields field, UErrorCode& status);
- friend struct TimeUnitFormatReadSink;
- };
- inline UBool
- TimeUnitFormat::operator!=(const Format& other) const {
- return !operator==(other);
- }
- U_NAMESPACE_END
- #endif
- #endif
- #endif
- #endif
|