2 ********************************************************************************
3 * Copyright (C) 2010-2012, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 ********************************************************************************
9 * Modification History:
11 * Date Name Description
12 * 12/15/2009 dougfelt Created
13 ********************************************************************************
19 #include "unicode/utypes.h"
20 #include "unicode/uobject.h"
24 * \brief C++ API: FieldPosition Iterator.
27 #if UCONFIG_NO_FORMATTING
32 * Allow the declaration of APIs with pointers to FieldPositionIterator
33 * even when formatting is removed from the build.
35 class FieldPositionIterator
;
41 #include "unicode/fieldpos.h"
42 #include "unicode/umisc.h"
49 * FieldPositionIterator returns the field ids and their start/limit positions generated
50 * by a call to Format::format. See Format, NumberFormat, DecimalFormat.
53 class U_I18N_API FieldPositionIterator
: public UObject
{
59 ~FieldPositionIterator();
62 * Constructs a new, empty iterator.
65 FieldPositionIterator(void);
68 * Copy constructor. If the copy failed for some reason, the new iterator will
72 FieldPositionIterator(const FieldPositionIterator
&);
75 * Return true if another object is semantically equal to this
78 * Return true if this FieldPositionIterator is at the same position in an
79 * equal array of run values.
82 UBool
operator==(const FieldPositionIterator
&) const;
85 * Returns the complement of the result of operator==
86 * @param rhs The FieldPositionIterator to be compared for inequality
87 * @return the complement of the result of operator==
90 UBool
operator!=(const FieldPositionIterator
& rhs
) const { return !operator==(rhs
); }
93 * If the current position is valid, updates the FieldPosition values, advances the iterator,
94 * and returns TRUE, otherwise returns FALSE.
97 UBool
next(FieldPosition
& fp
);
100 friend class FieldPositionIteratorHandler
;
103 * Sets the data used by the iterator, and resets the position.
104 * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid
105 * (length is not a multiple of 3, or start >= limit for any run).
107 void setData(UVector32
*adopt
, UErrorCode
& status
);
115 #endif /* #if !UCONFIG_NO_FORMATTING */