00001 // © 2016 and later: Unicode, Inc. and others. 00002 // License & terms of use: http://www.unicode.org/copyright.html 00003 /* 00004 * Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved. 00005 ******************************************************************************* 00006 * 00007 * File PARSEPOS.H 00008 * 00009 * Modification History: 00010 * 00011 * Date Name Description 00012 * 07/09/97 helena Converted from java. 00013 * 07/17/98 stephen Added errorIndex support. 00014 * 05/11/99 stephen Cleaned up. 00015 ******************************************************************************* 00016 */ 00017 00018 #ifndef PARSEPOS_H 00019 #define PARSEPOS_H 00020 00021 #include "unicode/utypes.h" 00022 #include "unicode/uobject.h" 00023 00024 00025 U_NAMESPACE_BEGIN 00026 00049 class U_COMMON_API ParsePosition : public UObject { 00050 public: 00055 ParsePosition() 00056 : UObject(), 00057 index(0), 00058 errorIndex(-1) 00059 {} 00060 00066 ParsePosition(int32_t newIndex) 00067 : UObject(), 00068 index(newIndex), 00069 errorIndex(-1) 00070 {} 00071 00077 ParsePosition(const ParsePosition& copy) 00078 : UObject(copy), 00079 index(copy.index), 00080 errorIndex(copy.errorIndex) 00081 {} 00082 00087 virtual ~ParsePosition(); 00088 00093 inline ParsePosition& operator=(const ParsePosition& copy); 00094 00100 inline UBool operator==(const ParsePosition& that) const; 00101 00107 inline UBool operator!=(const ParsePosition& that) const; 00108 00120 ParsePosition *clone() const; 00121 00129 inline int32_t getIndex(void) const; 00130 00136 inline void setIndex(int32_t index); 00137 00145 inline void setErrorIndex(int32_t ei); 00146 00152 inline int32_t getErrorIndex(void) const; 00153 00159 static UClassID U_EXPORT2 getStaticClassID(); 00160 00166 virtual UClassID getDynamicClassID() const; 00167 00168 private: 00175 int32_t index; 00176 00180 int32_t errorIndex; 00181 00182 }; 00183 00184 inline ParsePosition& 00185 ParsePosition::operator=(const ParsePosition& copy) 00186 { 00187 index = copy.index; 00188 errorIndex = copy.errorIndex; 00189 return *this; 00190 } 00191 00192 inline UBool 00193 ParsePosition::operator==(const ParsePosition& copy) const 00194 { 00195 if(index != copy.index || errorIndex != copy.errorIndex) 00196 return FALSE; 00197 else 00198 return TRUE; 00199 } 00200 00201 inline UBool 00202 ParsePosition::operator!=(const ParsePosition& copy) const 00203 { 00204 return !operator==(copy); 00205 } 00206 00207 inline int32_t 00208 ParsePosition::getIndex() const 00209 { 00210 return index; 00211 } 00212 00213 inline void 00214 ParsePosition::setIndex(int32_t offset) 00215 { 00216 this->index = offset; 00217 } 00218 00219 inline int32_t 00220 ParsePosition::getErrorIndex() const 00221 { 00222 return errorIndex; 00223 } 00224 00225 inline void 00226 ParsePosition::setErrorIndex(int32_t ei) 00227 { 00228 this->errorIndex = ei; 00229 } 00230 U_NAMESPACE_END 00231 00232 #endif
1.6.1