ICU 56.1: parsepos.h Source File

ICU 56.1 56.1

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

- File List
- Globals

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
icu::UObject::getDynamicClassID
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
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's RTTI.
Definition: uobject.h:91
U_NAMESPACE_BEGIN
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
icu::operator!=
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:218
TRUE
#define TRUE
The TRUE value of a UBool.
Definition: umachine.h:238
uobject.h
C++ API: Common ICU base class UObject.
U_NAMESPACE_END
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
icu::ParsePosition::ParsePosition
ParsePosition()
Default constructor, the index starts with 0 as default.
Definition: parsepos.h:53
icu::ParsePosition::ParsePosition
ParsePosition(const ParsePosition &copy)
Copy constructor.
Definition: parsepos.h:75
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:47
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:64
FALSE
#define FALSE
The FALSE value of a UBool.
Definition: umachine.h:242
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:357
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:221
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234