00001 /* 00002 * Copyright (C) {1997-1999}, 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 00037 class U_I18N_API ParsePosition { 00038 public: 00043 ParsePosition() 00044 { this->index = 0; this->errorIndex = -1; } 00045 00051 ParsePosition(UTextOffset newIndex) 00052 { this->index = newIndex; this->errorIndex = -1; } 00053 00059 ParsePosition(const ParsePosition& copy) 00060 { this->index = copy.index; this->errorIndex = copy.errorIndex; } 00061 00066 ~ParsePosition() {} 00067 00072 ParsePosition& operator=(const ParsePosition& copy); 00073 00079 UBool operator==(const ParsePosition& that) const; 00080 00086 UBool operator!=(const ParsePosition& that) const; 00087 00095 UTextOffset getIndex(void) const; 00096 00102 void setIndex(UTextOffset index); 00103 00111 void setErrorIndex(UTextOffset ei); 00112 00118 UTextOffset getErrorIndex(void) const; 00119 00120 private: 00127 UTextOffset index; 00128 00132 UTextOffset errorIndex; 00133 }; 00134 00135 inline ParsePosition& 00136 ParsePosition::operator=(const ParsePosition& copy) 00137 { 00138 index = copy.index; 00139 errorIndex = copy.errorIndex; 00140 return *this; 00141 } 00142 00143 inline UBool 00144 ParsePosition::operator==(const ParsePosition& copy) const 00145 { 00146 if(index != copy.index || errorIndex != copy.errorIndex) 00147 return FALSE; 00148 else 00149 return TRUE; 00150 } 00151 00152 inline UBool 00153 ParsePosition::operator!=(const ParsePosition& copy) const 00154 { 00155 return !operator==(copy); 00156 } 00157 00158 inline UTextOffset 00159 ParsePosition::getIndex() const 00160 { 00161 return index; 00162 } 00163 00164 inline void 00165 ParsePosition::setIndex(UTextOffset offset) 00166 { 00167 this->index = offset; 00168 } 00169 00170 inline UTextOffset 00171 ParsePosition::getErrorIndex() const 00172 { 00173 return errorIndex; 00174 } 00175 00176 inline void 00177 ParsePosition::setErrorIndex(UTextOffset ei) 00178 { 00179 this->errorIndex = ei; 00180 } 00181 00182 #endif