1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 ********************************************************************************
5 * Copyright (C) 2010-2012, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ********************************************************************************
11 * Modification History:
13 * Date Name Description
14 * 12/15/2009 dougfelt Created
15 ********************************************************************************
21 #include "unicode/utypes.h"
22 #include "unicode/uobject.h"
26 * \brief C++ API: FieldPosition Iterator.
29 #if UCONFIG_NO_FORMATTING
34 * Allow the declaration of APIs with pointers to FieldPositionIterator
35 * even when formatting is removed from the build.
37 class FieldPositionIterator;
43 #include "unicode/fieldpos.h"
44 #include "unicode/umisc.h"
51 * FieldPositionIterator returns the field ids and their start/limit positions generated
52 * by a call to Format::format. See Format, NumberFormat, DecimalFormat.
55 class U_I18N_API FieldPositionIterator : public UObject {
61 ~FieldPositionIterator();
64 * Constructs a new, empty iterator.
67 FieldPositionIterator(void);
70 * Copy constructor. If the copy failed for some reason, the new iterator will
74 FieldPositionIterator(const FieldPositionIterator&);
77 * Return true if another object is semantically equal to this
80 * Return true if this FieldPositionIterator is at the same position in an
81 * equal array of run values.
84 UBool operator==(const FieldPositionIterator&) const;
87 * Returns the complement of the result of operator==
88 * @param rhs The FieldPositionIterator to be compared for inequality
89 * @return the complement of the result of operator==
92 UBool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); }
95 * If the current position is valid, updates the FieldPosition values, advances the iterator,
96 * and returns TRUE, otherwise returns FALSE.
99 UBool next(FieldPosition& fp);
102 friend class FieldPositionIteratorHandler;
105 * Sets the data used by the iterator, and resets the position.
106 * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid
107 * (length is not a multiple of 3, or start >= limit for any run).
109 void setData(UVector32 *adopt, UErrorCode& status);
117 #endif /* #if !UCONFIG_NO_FORMATTING */