ICU 62.1 62.1
parsepos.h
Go to the documentation of this file.
1// © 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
26
50public:
56 : UObject(),
57 index(0),
58 errorIndex(-1)
59 {}
60
67 : UObject(),
68 index(newIndex),
69 errorIndex(-1)
70 {}
71
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
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
160
167
168private:
175 int32_t index;
176
180 int32_t errorIndex;
181
182};
183
184inline ParsePosition&
185ParsePosition::operator=(const ParsePosition& copy)
186{
187 index = copy.index;
188 errorIndex = copy.errorIndex;
189 return *this;
190}
191
192inline UBool
193ParsePosition::operator==(const ParsePosition& copy) const
194{
195 if(index != copy.index || errorIndex != copy.errorIndex)
196 return FALSE;
197 else
198 return TRUE;
199}
200
201inline UBool
202ParsePosition::operator!=(const ParsePosition& copy) const
203{
204 return !operator==(copy);
205}
206
207inline int32_t
208ParsePosition::getIndex() const
209{
210 return index;
211}
212
213inline void
214ParsePosition::setIndex(int32_t offset)
215{
216 this->index = offset;
217}
218
219inline int32_t
220ParsePosition::getErrorIndex() const
221{
222 return errorIndex;
223}
224
225inline void
226ParsePosition::setErrorIndex(int32_t ei)
227{
228 this->errorIndex = ei;
229}
231
232#endif
"Smart pointer" base class; do not use directly: use LocalPointer etc.
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition parsepos.h:49
virtual UClassID getDynamicClassID() const
ICU "poor man's RTTI", returns a UClassID for the actual class.
ParsePosition * clone() const
Clone this object.
ParsePosition(const ParsePosition &copy)
Copy constructor.
Definition parsepos.h:77
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
virtual ~ParsePosition()
Destructor.
ParsePosition()
Default constructor, the index starts with 0 as default.
Definition parsepos.h:55
ParsePosition(int32_t newIndex)
Create a new ParsePosition with the given initial index.
Definition parsepos.h:66
UObject is the common ICU "boilerplate" class.
Definition uobject.h:223
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:236
#define TRUE
The TRUE value of a UBool.
Definition umachine.h:240
#define FALSE
The FALSE value of a UBool.
Definition umachine.h:244
C++ API: Common ICU base class UObject.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition uobject.h:93
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:359
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition uversion.h:138
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition uversion.h:137