Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

parsepos.h

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 
00021 U_NAMESPACE_BEGIN
00022 
00039 class U_I18N_API ParsePosition {
00040 public:
00045     ParsePosition()
00046       { this->index = 0; this->errorIndex = -1; }
00047 
00053     ParsePosition(int32_t newIndex)
00054       {    this->index = newIndex; this->errorIndex = -1; }
00055 
00061     ParsePosition(const ParsePosition& copy)
00062       {    this->index = copy.index; this->errorIndex = copy.errorIndex; }
00063 
00068     ~ParsePosition() {}
00069 
00074     ParsePosition&      operator=(const ParsePosition& copy);
00075 
00081     UBool              operator==(const ParsePosition& that) const;
00082 
00088     UBool              operator!=(const ParsePosition& that) const;
00089 
00097     int32_t getIndex(void) const;
00098 
00104     void setIndex(int32_t index);
00105 
00113     void setErrorIndex(int32_t ei);
00114 
00120     int32_t getErrorIndex(void) const;
00121 
00122 private:
00129     int32_t index;
00130 
00134     int32_t errorIndex;
00135 };
00136 
00137 inline ParsePosition&
00138 ParsePosition::operator=(const ParsePosition& copy)
00139 {
00140   index = copy.index;
00141   errorIndex = copy.errorIndex;
00142   return *this;
00143 }
00144 
00145 inline UBool
00146 ParsePosition::operator==(const ParsePosition& copy) const
00147 {
00148   if(index != copy.index || errorIndex != copy.errorIndex)
00149   return FALSE;
00150   else
00151   return TRUE;
00152 }
00153 
00154 inline UBool
00155 ParsePosition::operator!=(const ParsePosition& copy) const
00156 {
00157   return !operator==(copy);
00158 }
00159 
00160 inline int32_t
00161 ParsePosition::getIndex() const
00162 {
00163   return index;
00164 }
00165 
00166 inline void
00167 ParsePosition::setIndex(int32_t offset)
00168 {
00169   this->index = offset;
00170 }
00171 
00172 inline int32_t
00173 ParsePosition::getErrorIndex() const
00174 {
00175   return errorIndex;
00176 }
00177 
00178 inline void
00179 ParsePosition::setErrorIndex(int32_t ei)
00180 {
00181   this->errorIndex = ei;
00182 }
00183 U_NAMESPACE_END
00184 
00185 #endif

Generated on Sun May 22 18:49:51 2005 for ICU 2.1 by  doxygen 1.4.2