ICU 73.2  73.2
parsepos.h
Go to the documentation of this file.
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 
00023 #if U_SHOW_CPLUSPLUS_API
00024 
00025 #include "unicode/uobject.h"
00026 
00027  
00028 U_NAMESPACE_BEGIN
00029 
00052 class U_COMMON_API ParsePosition : public UObject {
00053 public:
00058     ParsePosition()
00059         : UObject(),
00060         index(0),
00061         errorIndex(-1)
00062       {}
00063 
00069     ParsePosition(int32_t newIndex)
00070         : UObject(),
00071         index(newIndex),
00072         errorIndex(-1)
00073       {}
00074 
00080     ParsePosition(const ParsePosition& copy)
00081         : UObject(copy),
00082         index(copy.index),
00083         errorIndex(copy.errorIndex)
00084       {}
00085 
00090     virtual ~ParsePosition();
00091 
00096     inline ParsePosition&      operator=(const ParsePosition& copy);
00097 
00103     inline bool               operator==(const ParsePosition& that) const;
00104 
00110     inline bool               operator!=(const ParsePosition& that) const;
00111 
00123     ParsePosition *clone() const;
00124 
00132     inline int32_t getIndex(void) const;
00133 
00139     inline void setIndex(int32_t index);
00140 
00148     inline void setErrorIndex(int32_t ei);
00149 
00155     inline int32_t getErrorIndex(void) const;
00156 
00162     static UClassID U_EXPORT2 getStaticClassID();
00163 
00169     virtual UClassID getDynamicClassID() const override;
00170 
00171 private:
00178     int32_t index;
00179 
00183     int32_t errorIndex;
00184 
00185 };
00186 
00187 inline ParsePosition&
00188 ParsePosition::operator=(const ParsePosition& copy)
00189 {
00190   index = copy.index;
00191   errorIndex = copy.errorIndex;
00192   return *this;
00193 }
00194 
00195 inline bool
00196 ParsePosition::operator==(const ParsePosition& copy) const
00197 {
00198   if(index != copy.index || errorIndex != copy.errorIndex)
00199   return false;
00200   else
00201   return true;
00202 }
00203 
00204 inline bool
00205 ParsePosition::operator!=(const ParsePosition& copy) const
00206 {
00207   return !operator==(copy);
00208 }
00209 
00210 inline int32_t
00211 ParsePosition::getIndex() const
00212 {
00213   return index;
00214 }
00215 
00216 inline void
00217 ParsePosition::setIndex(int32_t offset)
00218 {
00219   this->index = offset;
00220 }
00221 
00222 inline int32_t
00223 ParsePosition::getErrorIndex() const
00224 {
00225   return errorIndex;
00226 }
00227 
00228 inline void
00229 ParsePosition::setErrorIndex(int32_t ei)
00230 {
00231   this->errorIndex = ei;
00232 }
00233 U_NAMESPACE_END
00234 
00235 #endif /* U_SHOW_CPLUSPLUS_API */
00236 
00237 #endif