ICU 50.1.2  50.1.2
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 
48 public:
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 
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
192 {
193  if(index != copy.index || errorIndex != copy.errorIndex)
194  return FALSE;
195  else
196  return TRUE;
197 }
198 
199 inline UBool
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 }
229 
230 #endif
virtual UClassID getDynamicClassID() const =0
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
Definition: uversion.h:129
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:218
#define TRUE
The TRUE value of a UBool.
Definition: umachine.h:204
C++ API: Common ICU base class UObject.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
Definition: uversion.h:130
ParsePosition()
Default constructor, the index starts with 0 as default.
Definition: parsepos.h:53
ParsePosition(const ParsePosition &copy)
Copy constructor.
Definition: parsepos.h:75
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:47
Basic definitions for ICU, for both C and C++ APIs.
ParsePosition(int32_t newIndex)
Create a new ParsePosition with the given initial index.
Definition: parsepos.h:64
#define FALSE
The FALSE value of a UBool.
Definition: umachine.h:208
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
Definition: utypes.h:357
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:229
int8_t UBool
The ICU boolean type.
Definition: umachine.h:200