fpositer.h 2.9 KB

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