ICU 57.1 57.1
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
24
46
48public:
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
76 : UObject(copy),
77 index(copy.index),
78 errorIndex(copy.errorIndex)
79 {}
80
85 virtual ~ParsePosition();
86
92
98 UBool operator==(const ParsePosition& that) const;
99
105 UBool operator!=(const ParsePosition& that) const;
106
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
165
166private:
173 int32_t index;
174
178 int32_t errorIndex;
179
180};
181
182inline ParsePosition&
184{
185 index = copy.index;
186 errorIndex = copy.errorIndex;
187 return *this;
188}
189
190inline UBool
192{
193 if(index != copy.index || errorIndex != copy.errorIndex)
194 return FALSE;
195 else
196 return TRUE;
197}
198
199inline UBool
201{
202 return !operator==(copy);
203}
204
205inline int32_t
207{
208 return index;
209}
210
211inline void
213{
214 this->index = offset;
215}
216
217inline int32_t
219{
220 return errorIndex;
221}
222
223inline void
225{
226 this->errorIndex = ei;
227}
229
230#endif
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition parsepos.h:47
UBool operator!=(const ParsePosition &that) const
Equality operator.
Definition parsepos.h:200
ParsePosition(const ParsePosition &copy)
Copy constructor.
Definition parsepos.h:75
void setErrorIndex(int32_t ei)
Set the index at which a parse error occurred.
Definition parsepos.h:224
ParsePosition(int32_t newIndex)
Create a new ParsePosition with the given initial index.
Definition parsepos.h:64
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
ParsePosition & operator=(const ParsePosition &copy)
Assignment operator.
Definition parsepos.h:183
ParsePosition()
Default constructor, the index starts with 0 as default.
Definition parsepos.h:53
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:218
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
int32_t getIndex(void) const
Retrieve the current parse position.
Definition parsepos.h:206
void setIndex(int32_t index)
Set the current parse position.
Definition parsepos.h:212
virtual ~ParsePosition()
Destructor.
UBool operator==(const ParsePosition &that) const
Equality operator.
Definition parsepos.h:191
ParsePosition * clone() const
Clone this object.
UObject is the common ICU "boilerplate" class.
Definition uobject.h:221
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
int8_t UBool
The ICU boolean type.
Definition umachine.h:234
#define TRUE
The TRUE value of a UBool.
Definition umachine.h:238
#define FALSE
The FALSE value of a UBool.
Definition umachine.h:242
C++ API: Common ICU base class UObject.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition uobject.h:91
Basic definitions for ICU, for both C and C++ APIs.
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
Definition utypes.h:357
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:130
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:129