• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // © 2017 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4  *******************************************************************************
5  * Copyright (C) 2009-2017, International Business Machines Corporation,       *
6  * Google, and others. All Rights Reserved.                                    *
7  *******************************************************************************
8  */
9 
10 #ifndef __NOUNIT_H__
11 #define __NOUNIT_H__
12 
13 #include "unicode/utypes.h"
14 
15 #if !UCONFIG_NO_FORMATTING
16 
17 #include "unicode/measunit.h"
18 
19 /**
20  * \file
21  * \brief C++ API: units for percent and permille
22  */
23 
24 U_NAMESPACE_BEGIN
25 
26 #ifndef U_HIDE_DRAFT_API
27 /**
28  * Dimensionless unit for percent and permille.
29  * @see NumberFormatter
30  * @draft ICU 60
31  */
32 class U_I18N_API NoUnit: public MeasureUnit {
33 public:
34     /**
35      * Returns an instance for the base unit (dimensionless and no scaling).
36      *
37      * @return               a NoUnit instance
38      * @draft ICU 60
39      */
40     static NoUnit U_EXPORT2 base();
41 
42     /**
43      * Returns an instance for percent, or 1/100 of a base unit.
44      *
45      * @return               a NoUnit instance
46      * @draft ICU 60
47      */
48     static NoUnit U_EXPORT2 percent();
49 
50     /**
51      * Returns an instance for permille, or 1/1000 of a base unit.
52      *
53      * @return               a NoUnit instance
54      * @draft ICU 60
55      */
56     static NoUnit U_EXPORT2 permille();
57 
58     /**
59      * Copy operator.
60      * @draft ICU 60
61      */
62     NoUnit(const NoUnit& other);
63 
64     /**
65      * Destructor.
66      * @draft ICU 60
67      */
68     virtual ~NoUnit();
69 
70     /**
71      * Return a polymorphic clone of this object.  The result will
72      * have the same class as returned by getDynamicClassID().
73      * @draft ICU 60
74      */
75     virtual UObject* clone() const;
76 
77     /**
78      * Returns a unique class ID for this object POLYMORPHICALLY.
79      * This method implements a simple form of RTTI used by ICU.
80      * @return The class ID for this object. All objects of a given
81      * class have the same class ID.  Objects of other classes have
82      * different class IDs.
83      * @draft ICU 60
84      */
85     virtual UClassID getDynamicClassID() const;
86 
87     /**
88      * Returns the class ID for this class. This is used to compare to
89      * the return value of getDynamicClassID().
90      * @return The class ID for all objects of this class.
91      * @draft ICU 60
92      */
93     static UClassID U_EXPORT2 getStaticClassID();
94 
95 private:
96     /**
97      * Constructor
98      * @internal (private)
99      */
100     NoUnit(const char* subtype);
101 
102 };
103 #endif  /* U_HIDE_DRAFT_API */
104 
105 U_NAMESPACE_END
106 
107 #endif /* #if !UCONFIG_NO_FORMATTING */
108 
109 #endif // __NOUNIT_H__
110 //eof
111 //
112