tzgnames.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. *******************************************************************************
  5. * Copyright (C) 2011-2012, International Business Machines Corporation and *
  6. * others. All Rights Reserved. *
  7. *******************************************************************************
  8. */
  9. #ifndef __TZGNAMES_H
  10. #define __TZGNAMES_H
  11. /**
  12. * \file
  13. * \brief C API: Time zone generic names classes
  14. */
  15. #include "unicode/utypes.h"
  16. #if !UCONFIG_NO_FORMATTING
  17. #include "unicode/locid.h"
  18. #include "unicode/unistr.h"
  19. #include "unicode/tzfmt.h"
  20. #include "unicode/tznames.h"
  21. U_CDECL_BEGIN
  22. typedef enum UTimeZoneGenericNameType {
  23. UTZGNM_UNKNOWN = 0x00,
  24. UTZGNM_LOCATION = 0x01,
  25. UTZGNM_LONG = 0x02,
  26. UTZGNM_SHORT = 0x04
  27. } UTimeZoneGenericNameType;
  28. U_CDECL_END
  29. U_NAMESPACE_BEGIN
  30. class TimeZone;
  31. struct TZGNCoreRef;
  32. class U_I18N_API TimeZoneGenericNames : public UMemory {
  33. public:
  34. virtual ~TimeZoneGenericNames();
  35. static TimeZoneGenericNames* createInstance(const Locale& locale, UErrorCode& status);
  36. virtual bool operator==(const TimeZoneGenericNames& other) const;
  37. virtual bool operator!=(const TimeZoneGenericNames& other) const {return !operator==(other);}
  38. virtual TimeZoneGenericNames* clone() const;
  39. UnicodeString& getDisplayName(const TimeZone& tz, UTimeZoneGenericNameType type,
  40. UDate date, UnicodeString& name) const;
  41. UnicodeString& getGenericLocationName(const UnicodeString& tzCanonicalID, UnicodeString& name) const;
  42. int32_t findBestMatch(const UnicodeString& text, int32_t start, uint32_t types,
  43. UnicodeString& tzID, UTimeZoneFormatTimeType& timeType, UErrorCode& status) const;
  44. private:
  45. TimeZoneGenericNames();
  46. TZGNCoreRef* fRef;
  47. };
  48. U_NAMESPACE_END
  49. #endif
  50. #endif