Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:05

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 ********************************************************************************
0005 *   Copyright (C) 2010-2012, International Business Machines
0006 *   Corporation and others.  All Rights Reserved.
0007 ********************************************************************************
0008 *
0009 * File attiter.h
0010 *
0011 * Modification History:
0012 *
0013 *   Date        Name        Description
0014 *   12/15/2009  dougfelt    Created
0015 ********************************************************************************
0016 */
0017 
0018 #ifndef FPOSITER_H
0019 #define FPOSITER_H
0020 
0021 #include "unicode/utypes.h"
0022 
0023 #if U_SHOW_CPLUSPLUS_API
0024 
0025 #include "unicode/uobject.h"
0026 
0027 /**
0028  * \file
0029  * \brief C++ API: FieldPosition Iterator.
0030  */
0031 
0032 #if UCONFIG_NO_FORMATTING
0033 
0034 U_NAMESPACE_BEGIN
0035 
0036 /*
0037  * Allow the declaration of APIs with pointers to FieldPositionIterator
0038  * even when formatting is removed from the build.
0039  */
0040 class FieldPositionIterator;
0041 
0042 U_NAMESPACE_END
0043 
0044 #else
0045 
0046 #include "unicode/fieldpos.h"
0047 #include "unicode/umisc.h"
0048 
0049 U_NAMESPACE_BEGIN
0050 
0051 class UVector32;
0052 
0053 /**
0054  * FieldPositionIterator returns the field ids and their start/limit positions generated
0055  * by a call to Format::format.  See Format, NumberFormat, DecimalFormat.
0056  * @stable ICU 4.4
0057  */
0058 class U_I18N_API FieldPositionIterator : public UObject {
0059 public:
0060     /**
0061      * Destructor.
0062      * @stable ICU 4.4
0063      */
0064     ~FieldPositionIterator();
0065 
0066     /**
0067      * Constructs a new, empty iterator.
0068      * @stable ICU 4.4
0069      */
0070     FieldPositionIterator(void);
0071 
0072     /**
0073      * Copy constructor.  If the copy failed for some reason, the new iterator will
0074      * be empty.
0075      * @stable ICU 4.4
0076      */
0077     FieldPositionIterator(const FieldPositionIterator&);
0078 
0079     /**
0080      * Return true if another object is semantically equal to this
0081      * one.
0082      * <p>
0083      * Return true if this FieldPositionIterator is at the same position in an
0084      * equal array of run values.
0085      * @stable ICU 4.4
0086      */
0087     bool operator==(const FieldPositionIterator&) const;
0088 
0089     /**
0090      * Returns the complement of the result of operator==
0091      * @param rhs The FieldPositionIterator to be compared for inequality
0092      * @return the complement of the result of operator==
0093      * @stable ICU 4.4
0094      */
0095     bool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); }
0096 
0097     /**
0098      * If the current position is valid, updates the FieldPosition values, advances the iterator,
0099      * and returns true, otherwise returns false.
0100      * @stable ICU 4.4
0101      */
0102     UBool next(FieldPosition& fp);
0103 
0104 private:
0105     /**
0106      * Sets the data used by the iterator, and resets the position.
0107      * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid 
0108      * (length is not a multiple of 3, or start >= limit for any run).
0109      */
0110     void setData(UVector32 *adopt, UErrorCode& status);
0111 
0112     friend class FieldPositionIteratorHandler;
0113 
0114     UVector32 *data;
0115     int32_t pos;
0116 };
0117 
0118 U_NAMESPACE_END
0119 
0120 #endif /* #if !UCONFIG_NO_FORMATTING */
0121 
0122 #endif /* U_SHOW_CPLUSPLUS_API */
0123 
0124 #endif // FPOSITER_H