fpositer.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. // Copyright (C) 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. #include "unicode/uobject.h"
  21. /**
  22. * \file
  23. * \brief C++ API: FieldPosition Iterator.
  24. */
  25. #if UCONFIG_NO_FORMATTING
  26. U_NAMESPACE_BEGIN
  27. /*
  28. * Allow the declaration of APIs with pointers to FieldPositionIterator
  29. * even when formatting is removed from the build.
  30. */
  31. class FieldPositionIterator;
  32. U_NAMESPACE_END
  33. #else
  34. #include "unicode/fieldpos.h"
  35. #include "unicode/umisc.h"
  36. U_NAMESPACE_BEGIN
  37. class UVector32;
  38. /**
  39. * FieldPositionIterator returns the field ids and their start/limit positions generated
  40. * by a call to Format::format. See Format, NumberFormat, DecimalFormat.
  41. * @stable ICU 4.4
  42. */
  43. class U_I18N_API FieldPositionIterator : public UObject {
  44. public:
  45. /**
  46. * Destructor.
  47. * @stable ICU 4.4
  48. */
  49. ~FieldPositionIterator();
  50. /**
  51. * Constructs a new, empty iterator.
  52. * @stable ICU 4.4
  53. */
  54. FieldPositionIterator(void);
  55. /**
  56. * Copy constructor. If the copy failed for some reason, the new iterator will
  57. * be empty.
  58. * @stable ICU 4.4
  59. */
  60. FieldPositionIterator(const FieldPositionIterator&);
  61. /**
  62. * Return true if another object is semantically equal to this
  63. * one.
  64. * <p>
  65. * Return true if this FieldPositionIterator is at the same position in an
  66. * equal array of run values.
  67. * @stable ICU 4.4
  68. */
  69. UBool operator==(const FieldPositionIterator&) const;
  70. /**
  71. * Returns the complement of the result of operator==
  72. * @param rhs The FieldPositionIterator to be compared for inequality
  73. * @return the complement of the result of operator==
  74. * @stable ICU 4.4
  75. */
  76. UBool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); }
  77. /**
  78. * If the current position is valid, updates the FieldPosition values, advances the iterator,
  79. * and returns TRUE, otherwise returns FALSE.
  80. * @stable ICU 4.4
  81. */
  82. UBool next(FieldPosition& fp);
  83. private:
  84. friend class FieldPositionIteratorHandler;
  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. UVector32 *data;
  92. int32_t pos;
  93. };
  94. U_NAMESPACE_END
  95. #endif /* #if !UCONFIG_NO_FORMATTING */
  96. #endif // FPOSITER_H