ICU 58.2 58.2

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

- File List
- Globals

parsepos.h
Go to the documentation of this file.
1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 * Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved.
5 *******************************************************************************
6 *
7 * File PARSEPOS.H
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 07/09/97 helena Converted from java.
13 * 07/17/98 stephen Added errorIndex support.
14 * 05/11/99 stephen Cleaned up.
15 *******************************************************************************
16 */
17
18 #ifndef PARSEPOS_H
19 #define PARSEPOS_H
20
21 #include "unicode/utypes.h"
22 #include "unicode/uobject.h"
23
24
25 U_NAMESPACE_BEGIN
26
49 class U_COMMON_API ParsePosition : public UObject {
50 public:
55 ParsePosition()
56 : UObject(),
57 index(0),
58 errorIndex(-1)
59 {}
60
66 ParsePosition(int32_t newIndex)
67 : UObject(),
68 index(newIndex),
69 errorIndex(-1)
70 {}
71
77 ParsePosition(const ParsePosition& copy)
78 : UObject(copy),
79 index(copy.index),
80 errorIndex(copy.errorIndex)
81 {}
82
87 virtual ~ParsePosition();
88
93 ParsePosition& operator=(const ParsePosition& copy);
94
100 UBool operator==(const ParsePosition& that) const;
101
107 UBool operator!=(const ParsePosition& that) const;
108
120 ParsePosition *clone() const;
121
129 int32_t getIndex(void) const;
130
136 void setIndex(int32_t index);
137
145 void setErrorIndex(int32_t ei);
146
152 int32_t getErrorIndex(void) const;
153
159 static UClassID U_EXPORT2 getStaticClassID();
160
166 virtual UClassID getDynamicClassID() const;
167
168 private:
175 int32_t index;
176
180 int32_t errorIndex;
181
182 };
183
184 inline ParsePosition&
185 ParsePosition::operator=(const ParsePosition& copy)
186 {
187 index = copy.index;
188 errorIndex = copy.errorIndex;
189 return *this;
190 }
191
192 inline UBool
193 ParsePosition::operator==(const ParsePosition& copy) const
194 {
195 if(index != copy.index || errorIndex != copy.errorIndex)
196 return FALSE;
197 else
198 return TRUE;
199 }
200
201 inline UBool
202 ParsePosition::operator!=(const ParsePosition& copy) const
203 {
204 return !operator==(copy);
205 }
206
207 inline int32_t
208 ParsePosition::getIndex() const
209 {
210 return index;
211 }
212
213 inline void
214 ParsePosition::setIndex(int32_t offset)
215 {
216 this->index = offset;
217 }
218
219 inline int32_t
220 ParsePosition::getErrorIndex() const
221 {
222 return errorIndex;
223 }
224
225 inline void
226 ParsePosition::setErrorIndex(int32_t ei)
227 {
228 this->errorIndex = ei;
229 }
230 U_NAMESPACE_END
231
232 #endif
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man&#39;s RTTI", returns a UClassID for the actual ICU class.
icu::ParsePosition::setIndex
void setIndex(int32_t index)
Set the current parse position.
Definition: parsepos.h:214
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler&#39;s RTTI.
Definition: uobject.h:93
icu::ParsePosition::setErrorIndex
void setErrorIndex(int32_t ei)
Set the index at which a parse error occurred.
Definition: parsepos.h:226
icu::ParsePosition::operator!=
UBool operator!=(const ParsePosition &that) const
Equality operator.
Definition: parsepos.h:202
icu::ParsePosition::getIndex
int32_t getIndex(void) const
Retrieve the current parse position.
Definition: parsepos.h:208
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:131
icu::operator!=
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:220
icu::ParsePosition::operator==
UBool operator==(const ParsePosition &that) const
Equality operator.
Definition: parsepos.h:193
TRUE
#define TRUE
The TRUE value of a UBool.
Definition: umachine.h:263
uobject.h
C++ API: Common ICU base class UObject.
icu::ParsePosition::operator=
ParsePosition & operator=(const ParsePosition &copy)
Assignment operator.
Definition: parsepos.h:185
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:132
icu::ParsePosition::ParsePosition
ParsePosition()
Default constructor, the index starts with 0 as default.
Definition: parsepos.h:55
icu::ParsePosition::ParsePosition
ParsePosition(const ParsePosition &copy)
Copy constructor.
Definition: parsepos.h:77
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:49
icu::ParsePosition::getErrorIndex
int32_t getErrorIndex(void) const
Retrieve the index at which an error occurred, or -1 if the error index has not been set...
Definition: parsepos.h:220
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
icu::ParsePosition::ParsePosition
ParsePosition(int32_t newIndex)
Create a new ParsePosition with the given initial index.
Definition: parsepos.h:66
FALSE
#define FALSE
The FALSE value of a UBool.
Definition: umachine.h:267
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
Definition: utypes.h:359
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:259