ICU 55.1 55.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
parsepos.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved.
3 *******************************************************************************
4 *
5 * File PARSEPOS.H
6 *
7 * Modification History:
8 *
9 * Date Name Description
10 * 07/09/97 helena Converted from java.
11 * 07/17/98 stephen Added errorIndex support.
12 * 05/11/99 stephen Cleaned up.
13 *******************************************************************************
14 */
15
16 #ifndef PARSEPOS_H
17 #define PARSEPOS_H
18
19 #include "unicode/utypes.h"
20 #include "unicode/uobject.h"
21
22
23 U_NAMESPACE_BEGIN
24
47 class U_COMMON_API ParsePosition : public UObject {
48 public:
53 ParsePosition()
54 : UObject(),
55 index(0),
56 errorIndex(-1)
57 {}
58
64 ParsePosition(int32_t newIndex)
65 : UObject(),
66 index(newIndex),
67 errorIndex(-1)
68 {}
69
75 ParsePosition(const ParsePosition& copy)
76 : UObject(copy),
77 index(copy.index),
78 errorIndex(copy.errorIndex)
79 {}
80
85 virtual ~ParsePosition();
86
91 ParsePosition& operator=(const ParsePosition& copy);
92
98 UBool operator==(const ParsePosition& that) const;
99
105 UBool operator!=(const ParsePosition& that) const;
106
118 ParsePosition *clone() const;
119
127 int32_t getIndex(void) const;
128
134 void setIndex(int32_t index);
135
143 void setErrorIndex(int32_t ei);
144
150 int32_t getErrorIndex(void) const;
151
157 static UClassID U_EXPORT2 getStaticClassID();
158
164 virtual UClassID getDynamicClassID() const;
165
166 private:
173 int32_t index;
174
178 int32_t errorIndex;
179
180 };
181
182 inline ParsePosition&
183 ParsePosition::operator=(const ParsePosition& copy)
184 {
185 index = copy.index;
186 errorIndex = copy.errorIndex;
187 return *this;
188 }
189
190 inline UBool
191 ParsePosition::operator==(const ParsePosition& copy) const
192 {
193 if(index != copy.index || errorIndex != copy.errorIndex)
194 return FALSE;
195 else
196 return TRUE;
197 }
198
199 inline UBool
200 ParsePosition::operator!=(const ParsePosition& copy) const
201 {
202 return !operator==(copy);
203 }
204
205 inline int32_t
206 ParsePosition::getIndex() const
207 {
208 return index;
209 }
210
211 inline void
212 ParsePosition::setIndex(int32_t offset)
213 {
214 this->index = offset;
215 }
216
217 inline int32_t
218 ParsePosition::getErrorIndex() const
219 {
220 return errorIndex;
221 }
222
223 inline void
224 ParsePosition::setErrorIndex(int32_t ei)
225 {
226 this->errorIndex = ei;
227 }
228 U_NAMESPACE_END
229
230 #endif