nounit.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. #ifndef __NOUNIT_H__
  10. #define __NOUNIT_H__
  11. #include "unicode/utypes.h"
  12. #if U_SHOW_CPLUSPLUS_API
  13. #if !UCONFIG_NO_FORMATTING
  14. #include "unicode/measunit.h"
  15. #ifndef U_HIDE_DRAFT_API
  16. /**
  17. * \file
  18. * \brief C++ API: units for percent and permille
  19. */
  20. U_NAMESPACE_BEGIN
  21. /**
  22. * Dimensionless unit for percent and permille.
  23. * @see NumberFormatter
  24. * @draft ICU 60
  25. */
  26. class U_I18N_API NoUnit: public MeasureUnit {
  27. public:
  28. /**
  29. * Returns an instance for the base unit (dimensionless and no scaling).
  30. *
  31. * @return a NoUnit instance
  32. * @draft ICU 60
  33. */
  34. static NoUnit U_EXPORT2 base();
  35. /**
  36. * Returns an instance for percent, or 1/100 of a base unit.
  37. *
  38. * @return a NoUnit instance
  39. * @draft ICU 60
  40. */
  41. static NoUnit U_EXPORT2 percent();
  42. /**
  43. * Returns an instance for permille, or 1/1000 of a base unit.
  44. *
  45. * @return a NoUnit instance
  46. * @draft ICU 60
  47. */
  48. static NoUnit U_EXPORT2 permille();
  49. /**
  50. * Copy operator.
  51. * @draft ICU 60
  52. */
  53. NoUnit(const NoUnit& other);
  54. /**
  55. * Destructor.
  56. * @draft ICU 60
  57. */
  58. virtual ~NoUnit();
  59. /**
  60. * Return a polymorphic clone of this object. The result will
  61. * have the same class as returned by getDynamicClassID().
  62. * @draft ICU 60
  63. */
  64. virtual NoUnit* clone() const;
  65. /**
  66. * Returns a unique class ID for this object POLYMORPHICALLY.
  67. * This method implements a simple form of RTTI used by ICU.
  68. * @return The class ID for this object. All objects of a given
  69. * class have the same class ID. Objects of other classes have
  70. * different class IDs.
  71. * @draft ICU 60
  72. */
  73. virtual UClassID getDynamicClassID() const;
  74. /**
  75. * Returns the class ID for this class. This is used to compare to
  76. * the return value of getDynamicClassID().
  77. * @return The class ID for all objects of this class.
  78. * @draft ICU 60
  79. */
  80. static UClassID U_EXPORT2 getStaticClassID();
  81. private:
  82. /**
  83. * Constructor
  84. * @internal (private)
  85. */
  86. NoUnit(const char* subtype);
  87. };
  88. U_NAMESPACE_END
  89. #endif /* U_HIDE_DRAFT_API */
  90. #endif /* #if !UCONFIG_NO_FORMATTING */
  91. #endif /* U_SHOW_CPLUSPLUS_API */
  92. #endif // __NOUNIT_H__
  93. //eof
  94. //