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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial