fpositer.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // © 2016 and later: Unicode, Inc. and others.
  2. // License & terms of use: http://www.unicode.org/copyright.html
  3. /*
  4. ********************************************************************************
  5. * Copyright (C) 2010-2012, International Business Machines
  6. * Corporation and others. All Rights Reserved.
  7. ********************************************************************************
  8. *
  9. * File attiter.h
  10. *
  11. * Modification History:
  12. *
  13. * Date Name Description
  14. * 12/15/2009 dougfelt Created
  15. ********************************************************************************
  16. */
  17. #ifndef FPOSITER_H
  18. #define FPOSITER_H
  19. #include "unicode/utypes.h"
  20. #if U_SHOW_CPLUSPLUS_API
  21. #include "unicode/uobject.h"
  22. /**
  23. * \file
  24. * \brief C++ API: FieldPosition Iterator.
  25. */
  26. #if UCONFIG_NO_FORMATTING
  27. U_NAMESPACE_BEGIN
  28. /*
  29. * Allow the declaration of APIs with pointers to FieldPositionIterator
  30. * even when formatting is removed from the build.
  31. */
  32. class FieldPositionIterator;
  33. U_NAMESPACE_END
  34. #else
  35. #include "unicode/fieldpos.h"
  36. #include "unicode/umisc.h"
  37. U_NAMESPACE_BEGIN
  38. class UVector32;
  39. /**
  40. * FieldPositionIterator returns the field ids and their start/limit positions generated
  41. * by a call to Format::format. See Format, NumberFormat, DecimalFormat.
  42. * @stable ICU 4.4
  43. */
  44. class U_I18N_API FieldPositionIterator : public UObject {
  45. public:
  46. /**
  47. * Destructor.
  48. * @stable ICU 4.4
  49. */
  50. ~FieldPositionIterator();
  51. /**
  52. * Constructs a new, empty iterator.
  53. * @stable ICU 4.4
  54. */
  55. FieldPositionIterator();
  56. /**
  57. * Copy constructor. If the copy failed for some reason, the new iterator will
  58. * be empty.
  59. * @stable ICU 4.4
  60. */
  61. FieldPositionIterator(const FieldPositionIterator&);
  62. /**
  63. * Return true if another object is semantically equal to this
  64. * one.
  65. * <p>
  66. * Return true if this FieldPositionIterator is at the same position in an
  67. * equal array of run values.
  68. * @stable ICU 4.4
  69. */
  70. bool operator==(const FieldPositionIterator&) const;
  71. /**
  72. * Returns the complement of the result of operator==
  73. * @param rhs The FieldPositionIterator to be compared for inequality
  74. * @return the complement of the result of operator==
  75. * @stable ICU 4.4
  76. */
  77. bool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); }
  78. /**
  79. * If the current position is valid, updates the FieldPosition values, advances the iterator,
  80. * and returns true, otherwise returns false.
  81. * @stable ICU 4.4
  82. */
  83. UBool next(FieldPosition& fp);
  84. private:
  85. /**
  86. * Sets the data used by the iterator, and resets the position.
  87. * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid
  88. * (length is not a multiple of 3, or start >= limit for any run).
  89. */
  90. void setData(UVector32 *adopt, UErrorCode& status);
  91. friend class FieldPositionIteratorHandler;
  92. UVector32 *data;
  93. int32_t pos;
  94. };
  95. U_NAMESPACE_END
  96. #endif /* #if !UCONFIG_NO_FORMATTING */
  97. #endif /* U_SHOW_CPLUSPLUS_API */
  98. #endif // FPOSITER_H