]> git.saurik.com Git - apple/icu.git/blob - icuSources/i18n/unicode/fpositer.h
ICU-59180.0.1.tar.gz
[apple/icu.git] / icuSources / i18n / unicode / fpositer.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ********************************************************************************
5 * Copyright (C) 2010-2012, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 ********************************************************************************
8 *
9 * File attiter.h
10 *
11 * Modification History:
12 *
13 * Date Name Description
14 * 12/15/2009 dougfelt Created
15 ********************************************************************************
16 */
17
18 #ifndef FPOSITER_H
19 #define FPOSITER_H
20
21 #include "unicode/utypes.h"
22 #include "unicode/uobject.h"
23
24 /**
25 * \file
26 * \brief C++ API: FieldPosition Iterator.
27 */
28
29 #if UCONFIG_NO_FORMATTING
30
31 #if U_SHOW_CPLUSPLUS_API
32 U_NAMESPACE_BEGIN
33
34 /*
35 * Allow the declaration of APIs with pointers to FieldPositionIterator
36 * even when formatting is removed from the build.
37 */
38 class FieldPositionIterator;
39
40 U_NAMESPACE_END
41 #endif // U_SHOW_CPLUSPLUS_API
42
43 #else
44
45 #include "unicode/fieldpos.h"
46 #include "unicode/umisc.h"
47
48 #if U_SHOW_CPLUSPLUS_API
49 U_NAMESPACE_BEGIN
50
51 class UVector32;
52
53 /**
54 * FieldPositionIterator returns the field ids and their start/limit positions generated
55 * by a call to Format::format. See Format, NumberFormat, DecimalFormat.
56 * @stable ICU 4.4
57 */
58 class U_I18N_API FieldPositionIterator : public UObject {
59 public:
60 /**
61 * Destructor.
62 * @stable ICU 4.4
63 */
64 ~FieldPositionIterator();
65
66 /**
67 * Constructs a new, empty iterator.
68 * @stable ICU 4.4
69 */
70 FieldPositionIterator(void);
71
72 /**
73 * Copy constructor. If the copy failed for some reason, the new iterator will
74 * be empty.
75 * @stable ICU 4.4
76 */
77 FieldPositionIterator(const FieldPositionIterator&);
78
79 /**
80 * Return true if another object is semantically equal to this
81 * one.
82 * <p>
83 * Return true if this FieldPositionIterator is at the same position in an
84 * equal array of run values.
85 * @stable ICU 4.4
86 */
87 UBool operator==(const FieldPositionIterator&) const;
88
89 /**
90 * Returns the complement of the result of operator==
91 * @param rhs The FieldPositionIterator to be compared for inequality
92 * @return the complement of the result of operator==
93 * @stable ICU 4.4
94 */
95 UBool operator!=(const FieldPositionIterator& rhs) const { return !operator==(rhs); }
96
97 /**
98 * If the current position is valid, updates the FieldPosition values, advances the iterator,
99 * and returns TRUE, otherwise returns FALSE.
100 * @stable ICU 4.4
101 */
102 UBool next(FieldPosition& fp);
103
104 private:
105 friend class FieldPositionIteratorHandler;
106
107 /**
108 * Sets the data used by the iterator, and resets the position.
109 * Returns U_ILLEGAL_ARGUMENT_ERROR in status if the data is not valid
110 * (length is not a multiple of 3, or start >= limit for any run).
111 */
112 void setData(UVector32 *adopt, UErrorCode& status);
113
114 UVector32 *data;
115 int32_t pos;
116 };
117
118 U_NAMESPACE_END
119 #endif // U_SHOW_CPLUSPLUS_API
120
121 #endif /* #if !UCONFIG_NO_FORMATTING */
122
123 #endif // FPOSITER_H