12e5b6d6dSopenharmony_ci// © 2016 and later: Unicode, Inc. and others.
22e5b6d6dSopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html
32e5b6d6dSopenharmony_ci/*
42e5b6d6dSopenharmony_ci********************************************************************************
52e5b6d6dSopenharmony_ci*   Copyright (C) 2010-2012, International Business Machines
62e5b6d6dSopenharmony_ci*   Corporation and others.  All Rights Reserved.
72e5b6d6dSopenharmony_ci********************************************************************************
82e5b6d6dSopenharmony_ci*
92e5b6d6dSopenharmony_ci* File attiter.h
102e5b6d6dSopenharmony_ci*
112e5b6d6dSopenharmony_ci* Modification History:
122e5b6d6dSopenharmony_ci*
132e5b6d6dSopenharmony_ci*   Date        Name        Description
142e5b6d6dSopenharmony_ci*   12/15/2009  dougfelt    Created
152e5b6d6dSopenharmony_ci********************************************************************************
162e5b6d6dSopenharmony_ci*/
172e5b6d6dSopenharmony_ci
182e5b6d6dSopenharmony_ci#ifndef FPOSITER_H
192e5b6d6dSopenharmony_ci#define FPOSITER_H
202e5b6d6dSopenharmony_ci
212e5b6d6dSopenharmony_ci#include "unicode/utypes.h"
222e5b6d6dSopenharmony_ci
232e5b6d6dSopenharmony_ci#if U_SHOW_CPLUSPLUS_API
242e5b6d6dSopenharmony_ci
252e5b6d6dSopenharmony_ci#include "unicode/uobject.h"
262e5b6d6dSopenharmony_ci
272e5b6d6dSopenharmony_ci/**
282e5b6d6dSopenharmony_ci * \file
292e5b6d6dSopenharmony_ci * \brief C++ API: FieldPosition Iterator.
302e5b6d6dSopenharmony_ci */
312e5b6d6dSopenharmony_ci
322e5b6d6dSopenharmony_ci#if UCONFIG_NO_FORMATTING
332e5b6d6dSopenharmony_ci
342e5b6d6dSopenharmony_ciU_NAMESPACE_BEGIN
352e5b6d6dSopenharmony_ci
362e5b6d6dSopenharmony_ci/*
372e5b6d6dSopenharmony_ci * Allow the declaration of APIs with pointers to FieldPositionIterator
382e5b6d6dSopenharmony_ci * even when formatting is removed from the build.
392e5b6d6dSopenharmony_ci */
402e5b6d6dSopenharmony_ciclass FieldPositionIterator;
412e5b6d6dSopenharmony_ci
422e5b6d6dSopenharmony_ciU_NAMESPACE_END
432e5b6d6dSopenharmony_ci
442e5b6d6dSopenharmony_ci#else
452e5b6d6dSopenharmony_ci
462e5b6d6dSopenharmony_ci#include "unicode/fieldpos.h"
472e5b6d6dSopenharmony_ci#include "unicode/umisc.h"
482e5b6d6dSopenharmony_ci
492e5b6d6dSopenharmony_ciU_NAMESPACE_BEGIN
502e5b6d6dSopenharmony_ci
512e5b6d6dSopenharmony_ciclass UVector32;
522e5b6d6dSopenharmony_ci
532e5b6d6dSopenharmony_ci/**
542e5b6d6dSopenharmony_ci * FieldPositionIterator returns the field ids and their start/limit positions generated
552e5b6d6dSopenharmony_ci * by a call to Format::format.  See Format, NumberFormat, DecimalFormat.
562e5b6d6dSopenharmony_ci * @stable ICU 4.4
572e5b6d6dSopenharmony_ci */
582e5b6d6dSopenharmony_ciclass U_I18N_API FieldPositionIterator : public UObject {
592e5b6d6dSopenharmony_cipublic:
602e5b6d6dSopenharmony_ci    /**
612e5b6d6dSopenharmony_ci     * Destructor.
622e5b6d6dSopenharmony_ci     * @stable ICU 4.4
632e5b6d6dSopenharmony_ci     */
642e5b6d6dSopenharmony_ci    ~FieldPositionIterator();
652e5b6d6dSopenharmony_ci
662e5b6d6dSopenharmony_ci    /**
672e5b6d6dSopenharmony_ci     * Constructs a new, empty iterator.
682e5b6d6dSopenharmony_ci     * @stable ICU 4.4
692e5b6d6dSopenharmony_ci     */
702e5b6d6dSopenharmony_ci    FieldPositionIterator(void);
712e5b6d6dSopenharmony_ci
722e5b6d6dSopenharmony_ci    /**
732e5b6d6dSopenharmony_ci     * Copy constructor.  If the copy failed for some reason, the new iterator will
742e5b6d6dSopenharmony_ci     * be empty.
752e5b6d6dSopenharmony_ci     * @stable ICU 4.4
762e5b6d6dSopenharmony_ci     */
772e5b6d6dSopenharmony_ci    FieldPositionIterator(const FieldPositionIterator&);
782e5b6d6dSopenharmony_ci
792e5b6d6dSopenharmony_ci    /**
802e5b6d6dSopenharmony_ci     * Return true if another object is semantically equal to this
812e5b6d6dSopenharmony_ci     * one.
822e5b6d6dSopenharmony_ci     * <p>
832e5b6d6dSopenharmony_ci     * Return true if this FieldPositionIterator is at the same position in an
842e5b6d6dSopenharmony_ci     * equal array of run values.
852e5b6d6dSopenharmony_ci     * @stable ICU 4.4
862e5b6d6dSopenharmony_ci     */
872e5b6d6dSopenharmony_ci    bool operator==(const FieldPositionIterator&) const;
882e5b6d6dSopenharmony_ci
892e5b6d6dSopenharmony_ci    /**
902e5b6d6dSopenharmony_ci     * Returns the complement of the result of operator==
912e5b6d6dSopenharmony_ci     * @param rhs The FieldPositionIterator to be compared for inequality
922e5b6d6dSopenharmony_ci     * @return the complement of the result of operator==
932e5b6d6dSopenharmony_ci     * @stable ICU 4.4
942e5b6d6dSopenharmony_ci     */
952e5b6d6dSopenharmony_ci    bool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); }
962e5b6d6dSopenharmony_ci
972e5b6d6dSopenharmony_ci    /**
982e5b6d6dSopenharmony_ci     * If the current position is valid, updates the FieldPosition values, advances the iterator,
992e5b6d6dSopenharmony_ci     * and returns true, otherwise returns false.
1002e5b6d6dSopenharmony_ci     * @stable ICU 4.4
1012e5b6d6dSopenharmony_ci     */
1022e5b6d6dSopenharmony_ci    UBool next(FieldPosition& fp);
1032e5b6d6dSopenharmony_ci
1042e5b6d6dSopenharmony_ciprivate:
1052e5b6d6dSopenharmony_ci    /**
1062e5b6d6dSopenharmony_ci     * Sets the data used by the iterator, and resets the position.
1072e5b6d6dSopenharmony_ci     * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid
1082e5b6d6dSopenharmony_ci     * (length is not a multiple of 3, or start >= limit for any run).
1092e5b6d6dSopenharmony_ci     */
1102e5b6d6dSopenharmony_ci    void setData(UVector32 *adopt, UErrorCode& status);
1112e5b6d6dSopenharmony_ci
1122e5b6d6dSopenharmony_ci    friend class FieldPositionIteratorHandler;
1132e5b6d6dSopenharmony_ci
1142e5b6d6dSopenharmony_ci    UVector32 *data;
1152e5b6d6dSopenharmony_ci    int32_t pos;
1162e5b6d6dSopenharmony_ci};
1172e5b6d6dSopenharmony_ci
1182e5b6d6dSopenharmony_ciU_NAMESPACE_END
1192e5b6d6dSopenharmony_ci
1202e5b6d6dSopenharmony_ci#endif /* #if !UCONFIG_NO_FORMATTING */
1212e5b6d6dSopenharmony_ci
1222e5b6d6dSopenharmony_ci#endif /* U_SHOW_CPLUSPLUS_API */
1232e5b6d6dSopenharmony_ci
1242e5b6d6dSopenharmony_ci#endif // FPOSITER_H
125