00001 /* 00002 * Copyright (C) {1997-2003}, International Business Machines Corporation and others. All Rights Reserved. 00003 ******************************************************************************* 00004 * 00005 * File PARSEPOS.H 00006 * 00007 * Modification History: 00008 * 00009 * Date Name Description 00010 * 07/09/97 helena Converted from java. 00011 * 07/17/98 stephen Added errorIndex support. 00012 * 05/11/99 stephen Cleaned up. 00013 ******************************************************************************* 00014 */ 00015 00016 #ifndef PARSEPOS_H 00017 #define PARSEPOS_H 00018 00019 #include "unicode/utypes.h" 00020 #include "unicode/uobject.h" 00021 00022 U_NAMESPACE_BEGIN 00023 00042 class U_COMMON_API ParsePosition : public UObject { 00043 public: 00048 ParsePosition() 00049 : UObject() 00050 { this->index = 0; this->errorIndex = -1; } 00051 00057 ParsePosition(int32_t newIndex) 00058 : UObject() 00059 { this->index = newIndex; this->errorIndex = -1; } 00060 00066 ParsePosition(const ParsePosition& copy) 00067 : UObject(copy) 00068 { this->index = copy.index; this->errorIndex = copy.errorIndex; } 00069 00074 ~ParsePosition() {} 00075 00080 ParsePosition& operator=(const ParsePosition& copy); 00081 00087 UBool operator==(const ParsePosition& that) const; 00088 00094 UBool operator!=(const ParsePosition& that) const; 00095 00103 int32_t getIndex(void) const; 00104 00110 void setIndex(int32_t index); 00111 00119 void setErrorIndex(int32_t ei); 00120 00126 int32_t getErrorIndex(void) const; 00127 00133 virtual inline UClassID getDynamicClassID() const; 00134 00140 static inline UClassID getStaticClassID(); 00141 00142 private: 00149 int32_t index; 00150 00154 int32_t errorIndex; 00155 00160 static const char fgClassID; 00161 }; 00162 00163 inline UClassID 00164 ParsePosition::getStaticClassID() 00165 { return (UClassID)&fgClassID; } 00166 00167 inline UClassID 00168 ParsePosition::getDynamicClassID() const 00169 { return ParsePosition::getStaticClassID(); } 00170 00171 inline ParsePosition& 00172 ParsePosition::operator=(const ParsePosition& copy) 00173 { 00174 index = copy.index; 00175 errorIndex = copy.errorIndex; 00176 return *this; 00177 } 00178 00179 inline UBool 00180 ParsePosition::operator==(const ParsePosition& copy) const 00181 { 00182 if(index != copy.index || errorIndex != copy.errorIndex) 00183 return FALSE; 00184 else 00185 return TRUE; 00186 } 00187 00188 inline UBool 00189 ParsePosition::operator!=(const ParsePosition& copy) const 00190 { 00191 return !operator==(copy); 00192 } 00193 00194 inline int32_t 00195 ParsePosition::getIndex() const 00196 { 00197 return index; 00198 } 00199 00200 inline void 00201 ParsePosition::setIndex(int32_t offset) 00202 { 00203 this->index = offset; 00204 } 00205 00206 inline int32_t 00207 ParsePosition::getErrorIndex() const 00208 { 00209 return errorIndex; 00210 } 00211 00212 inline void 00213 ParsePosition::setErrorIndex(int32_t ei) 00214 { 00215 this->errorIndex = ei; 00216 } 00217 U_NAMESPACE_END 00218 00219 #endif