00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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 index(0),
00051 errorIndex(-1)
00052 {}
00053
00059 ParsePosition(int32_t newIndex)
00060 : UObject(),
00061 index(newIndex),
00062 errorIndex(-1)
00063 {}
00064
00070 ParsePosition(const ParsePosition& copy)
00071 : UObject(copy),
00072 index(copy.index),
00073 errorIndex(copy.errorIndex)
00074 {}
00075
00080 virtual ~ParsePosition();
00081
00086 ParsePosition& operator=(const ParsePosition& copy);
00087
00093 UBool operator==(const ParsePosition& that) const;
00094
00100 UBool operator!=(const ParsePosition& that) const;
00101
00113 ParsePosition *clone() const;
00114
00122 int32_t getIndex(void) const;
00123
00129 void setIndex(int32_t index);
00130
00138 void setErrorIndex(int32_t ei);
00139
00145 int32_t getErrorIndex(void) const;
00146
00152 static UClassID U_EXPORT2 getStaticClassID();
00153
00159 virtual UClassID getDynamicClassID() const;
00160
00161 private:
00168 int32_t index;
00169
00173 int32_t errorIndex;
00174
00175 };
00176
00177 inline ParsePosition&
00178 ParsePosition::operator=(const ParsePosition& copy)
00179 {
00180 index = copy.index;
00181 errorIndex = copy.errorIndex;
00182 return *this;
00183 }
00184
00185 inline UBool
00186 ParsePosition::operator==(const ParsePosition& copy) const
00187 {
00188 if(index != copy.index || errorIndex != copy.errorIndex)
00189 return FALSE;
00190 else
00191 return TRUE;
00192 }
00193
00194 inline UBool
00195 ParsePosition::operator!=(const ParsePosition& copy) const
00196 {
00197 return !operator==(copy);
00198 }
00199
00200 inline int32_t
00201 ParsePosition::getIndex() const
00202 {
00203 return index;
00204 }
00205
00206 inline void
00207 ParsePosition::setIndex(int32_t offset)
00208 {
00209 this->index = offset;
00210 }
00211
00212 inline int32_t
00213 ParsePosition::getErrorIndex() const
00214 {
00215 return errorIndex;
00216 }
00217
00218 inline void
00219 ParsePosition::setErrorIndex(int32_t ei)
00220 {
00221 this->errorIndex = ei;
00222 }
00223 U_NAMESPACE_END
00224
00225 #endif