michael@0: /* michael@0: ******************************************************************************** michael@0: * Copyright (C) 2010-2012, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ******************************************************************************** michael@0: * michael@0: * File attiter.h michael@0: * michael@0: * Modification History: michael@0: * michael@0: * Date Name Description michael@0: * 12/15/2009 dougfelt Created michael@0: ******************************************************************************** michael@0: */ michael@0: michael@0: #ifndef FPOSITER_H michael@0: #define FPOSITER_H michael@0: michael@0: #include "unicode/utypes.h" michael@0: #include "unicode/uobject.h" michael@0: michael@0: /** michael@0: * \file michael@0: * \brief C++ API: FieldPosition Iterator. michael@0: */ michael@0: michael@0: #if UCONFIG_NO_FORMATTING michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: /* michael@0: * Allow the declaration of APIs with pointers to FieldPositionIterator michael@0: * even when formatting is removed from the build. michael@0: */ michael@0: class FieldPositionIterator; michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #else michael@0: michael@0: #include "unicode/fieldpos.h" michael@0: #include "unicode/umisc.h" michael@0: michael@0: U_NAMESPACE_BEGIN michael@0: michael@0: class UVector32; michael@0: michael@0: /** michael@0: * FieldPositionIterator returns the field ids and their start/limit positions generated michael@0: * by a call to Format::format. See Format, NumberFormat, DecimalFormat. michael@0: * @stable ICU 4.4 michael@0: */ michael@0: class U_I18N_API FieldPositionIterator : public UObject { michael@0: public: michael@0: /** michael@0: * Destructor. michael@0: * @stable ICU 4.4 michael@0: */ michael@0: ~FieldPositionIterator(); michael@0: michael@0: /** michael@0: * Constructs a new, empty iterator. michael@0: * @stable ICU 4.4 michael@0: */ michael@0: FieldPositionIterator(void); michael@0: michael@0: /** michael@0: * Copy constructor. If the copy failed for some reason, the new iterator will michael@0: * be empty. michael@0: * @stable ICU 4.4 michael@0: */ michael@0: FieldPositionIterator(const FieldPositionIterator&); michael@0: michael@0: /** michael@0: * Return true if another object is semantically equal to this michael@0: * one. michael@0: *
michael@0: * Return true if this FieldPositionIterator is at the same position in an michael@0: * equal array of run values. michael@0: * @stable ICU 4.4 michael@0: */ michael@0: UBool operator==(const FieldPositionIterator&) const; michael@0: michael@0: /** michael@0: * Returns the complement of the result of operator== michael@0: * @param rhs The FieldPositionIterator to be compared for inequality michael@0: * @return the complement of the result of operator== michael@0: * @stable ICU 4.4 michael@0: */ michael@0: UBool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); } michael@0: michael@0: /** michael@0: * If the current position is valid, updates the FieldPosition values, advances the iterator, michael@0: * and returns TRUE, otherwise returns FALSE. michael@0: * @stable ICU 4.4 michael@0: */ michael@0: UBool next(FieldPosition& fp); michael@0: michael@0: private: michael@0: friend class FieldPositionIteratorHandler; michael@0: michael@0: /** michael@0: * Sets the data used by the iterator, and resets the position. michael@0: * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid michael@0: * (length is not a multiple of 3, or start >= limit for any run). michael@0: */ michael@0: void setData(UVector32 *adopt, UErrorCode& status); michael@0: michael@0: UVector32 *data; michael@0: int32_t pos; michael@0: }; michael@0: michael@0: U_NAMESPACE_END michael@0: michael@0: #endif /* #if !UCONFIG_NO_FORMATTING */ michael@0: michael@0: #endif // FPOSITER_H