intl/icu/source/i18n/unicode/tmunit.h

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

michael@0 1 /*
michael@0 2 *******************************************************************************
michael@0 3 * Copyright (C) 2009-2010, Google, International Business Machines Corporation and *
michael@0 4 * others. All Rights Reserved. *
michael@0 5 *******************************************************************************
michael@0 6 */
michael@0 7
michael@0 8 #ifndef __TMUNIT_H__
michael@0 9 #define __TMUNIT_H__
michael@0 10
michael@0 11
michael@0 12 /**
michael@0 13 * \file
michael@0 14 * \brief C++ API: time unit object
michael@0 15 */
michael@0 16
michael@0 17
michael@0 18 #include "unicode/measunit.h"
michael@0 19
michael@0 20 #if !UCONFIG_NO_FORMATTING
michael@0 21
michael@0 22 U_NAMESPACE_BEGIN
michael@0 23
michael@0 24 /**
michael@0 25 * Measurement unit for time units.
michael@0 26 * @see TimeUnitAmount
michael@0 27 * @see TimeUnit
michael@0 28 * @stable ICU 4.2
michael@0 29 */
michael@0 30 class U_I18N_API TimeUnit: public MeasureUnit {
michael@0 31 public:
michael@0 32 /**
michael@0 33 * Constants for all the time units we supported.
michael@0 34 * @stable ICU 4.2
michael@0 35 */
michael@0 36 enum UTimeUnitFields {
michael@0 37 UTIMEUNIT_YEAR,
michael@0 38 UTIMEUNIT_MONTH,
michael@0 39 UTIMEUNIT_DAY,
michael@0 40 UTIMEUNIT_WEEK,
michael@0 41 UTIMEUNIT_HOUR,
michael@0 42 UTIMEUNIT_MINUTE,
michael@0 43 UTIMEUNIT_SECOND,
michael@0 44 UTIMEUNIT_FIELD_COUNT
michael@0 45 };
michael@0 46
michael@0 47 /**
michael@0 48 * Create Instance.
michael@0 49 * @param timeUnitField time unit field based on which the instance
michael@0 50 * is created.
michael@0 51 * @param status input-output error code.
michael@0 52 * If the timeUnitField is invalid,
michael@0 53 * then this will be set to U_ILLEGAL_ARGUMENT_ERROR.
michael@0 54 * @return a TimeUnit instance
michael@0 55 * @stable ICU 4.2
michael@0 56 */
michael@0 57 static TimeUnit* U_EXPORT2 createInstance(UTimeUnitFields timeUnitField,
michael@0 58 UErrorCode& status);
michael@0 59
michael@0 60
michael@0 61 /**
michael@0 62 * Override clone.
michael@0 63 * @stable ICU 4.2
michael@0 64 */
michael@0 65 virtual UObject* clone() const;
michael@0 66
michael@0 67 /**
michael@0 68 * Copy operator.
michael@0 69 * @stable ICU 4.2
michael@0 70 */
michael@0 71 TimeUnit(const TimeUnit& other);
michael@0 72
michael@0 73 /**
michael@0 74 * Assignment operator.
michael@0 75 * @stable ICU 4.2
michael@0 76 */
michael@0 77 TimeUnit& operator=(const TimeUnit& other);
michael@0 78
michael@0 79 /**
michael@0 80 * Equality operator.
michael@0 81 * @return true if 2 objects are the same.
michael@0 82 * @stable ICU 4.2
michael@0 83 */
michael@0 84 virtual UBool operator==(const UObject& other) const;
michael@0 85
michael@0 86 /**
michael@0 87 * Non-Equality operator.
michael@0 88 * @return true if 2 objects are not the same.
michael@0 89 * @stable ICU 4.2
michael@0 90 */
michael@0 91 UBool operator!=(const UObject& other) const;
michael@0 92
michael@0 93 /**
michael@0 94 * Returns a unique class ID for this object POLYMORPHICALLY.
michael@0 95 * This method implements a simple form of RTTI used by ICU.
michael@0 96 * @return The class ID for this object. All objects of a given
michael@0 97 * class have the same class ID. Objects of other classes have
michael@0 98 * different class IDs.
michael@0 99 * @stable ICU 4.2
michael@0 100 */
michael@0 101 virtual UClassID getDynamicClassID() const;
michael@0 102
michael@0 103 /**
michael@0 104 * Returns the class ID for this class. This is used to compare to
michael@0 105 * the return value of getDynamicClassID().
michael@0 106 * @return The class ID for all objects of this class.
michael@0 107 * @stable ICU 4.2
michael@0 108 */
michael@0 109 static UClassID U_EXPORT2 getStaticClassID();
michael@0 110
michael@0 111
michael@0 112 /**
michael@0 113 * Get time unit field.
michael@0 114 * @return time unit field.
michael@0 115 * @stable ICU 4.2
michael@0 116 */
michael@0 117 UTimeUnitFields getTimeUnitField() const;
michael@0 118
michael@0 119 /**
michael@0 120 * Destructor.
michael@0 121 * @stable ICU 4.2
michael@0 122 */
michael@0 123 virtual ~TimeUnit();
michael@0 124
michael@0 125 private:
michael@0 126 UTimeUnitFields fTimeUnitField;
michael@0 127
michael@0 128 /**
michael@0 129 * Constructor
michael@0 130 * @internal ICU 4.2
michael@0 131 */
michael@0 132 TimeUnit(UTimeUnitFields timeUnitField);
michael@0 133
michael@0 134 };
michael@0 135
michael@0 136
michael@0 137 inline UBool
michael@0 138 TimeUnit::operator!=(const UObject& other) const {
michael@0 139 return !operator==(other);
michael@0 140 }
michael@0 141
michael@0 142
michael@0 143 U_NAMESPACE_END
michael@0 144
michael@0 145 #endif /* #if !UCONFIG_NO_FORMATTING */
michael@0 146
michael@0 147 #endif // __TMUNIT_H__
michael@0 148 //eof
michael@0 149 //

mercurial