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 14 /** 15 * \file 16 * \brief C++ API: units for percent and permille 17 */ 18 19 20 #include "unicode/measunit.h" 21 22 #if !UCONFIG_NO_FORMATTING 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 * Return a polymorphic clone of this object. The result will 66 * have the same class as returned by getDynamicClassID(). 67 * @draft ICU 60 68 */ 69 virtual UObject* clone() const; 70 71 /** 72 * Returns a unique class ID for this object POLYMORPHICALLY. 73 * This method implements a simple form of RTTI used by ICU. 74 * @return The class ID for this object. All objects of a given 75 * class have the same class ID. Objects of other classes have 76 * different class IDs. 77 * @draft ICU 60 78 */ 79 virtual UClassID getDynamicClassID() const; 80 81 /** 82 * Returns the class ID for this class. This is used to compare to 83 * the return value of getDynamicClassID(). 84 * @return The class ID for all objects of this class. 85 * @draft ICU 60 86 */ 87 static UClassID U_EXPORT2 getStaticClassID(); 88 89 /** 90 * Destructor. 91 * @draft ICU 60 92 */ 93 virtual ~NoUnit(); 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