parsepos.h
Go to the documentation of this file.
// © 2016 and later: Unicode, Inc. and others.
// License & terms of use: http://www.unicode.org/copyright.html
/*
* Copyright (C) 1997-2005, International Business Machines Corporation and others. All Rights Reserved.
*******************************************************************************
*
* File PARSEPOS.H
*
* Modification History:
*
* Date Name Description
* 07/09/97 helena Converted from java.
* 07/17/98 stephen Added errorIndex support.
* 05/11/99 stephen Cleaned up.
*******************************************************************************
*/
#ifndef PARSEPOS_H
#define PARSEPOS_H
#include "unicode/utypes.h"
#if U_SHOW_CPLUSPLUS_API
#include "unicode/uobject.h"
U_NAMESPACE_BEGIN
class U_COMMON_API ParsePosition : public UObject {
public:
ParsePosition()
: UObject(),
index(0),
errorIndex(-1)
{}
ParsePosition(int32_t newIndex)
: UObject(),
index(newIndex),
errorIndex(-1)
{}
ParsePosition(const ParsePosition& copy)
: UObject(copy),
index(copy.index),
errorIndex(copy.errorIndex)
{}
virtual ~ParsePosition();
inline ParsePosition& operator=(const ParsePosition& copy);
inline bool operator==(const ParsePosition& that) const;
inline bool operator!=(const ParsePosition& that) const;
ParsePosition *clone() const;
inline int32_t getIndex(void) const;
inline void setIndex(int32_t index);
inline void setErrorIndex(int32_t ei);
inline int32_t getErrorIndex(void) const;
static UClassID U_EXPORT2 getStaticClassID();
virtual UClassID getDynamicClassID() const override;
private:
int32_t index;
int32_t errorIndex;
};
inline ParsePosition&
ParsePosition::operator=(const ParsePosition& copy)
{
index = copy.index;
errorIndex = copy.errorIndex;
return *this;
}
inline bool
ParsePosition::operator==(const ParsePosition& copy) const
{
if(index != copy.index || errorIndex != copy.errorIndex)
return false;
else
return true;
}
inline bool
ParsePosition::operator!=(const ParsePosition& copy) const
{
return !operator==(copy);
}
inline int32_t
ParsePosition::getIndex() const
{
return index;
}
inline void
ParsePosition::setIndex(int32_t offset)
{
this->index = offset;
}
inline int32_t
ParsePosition::getErrorIndex() const
{
return errorIndex;
}
inline void
ParsePosition::setErrorIndex(int32_t ei)
{
this->errorIndex = ei;
}
U_NAMESPACE_END
#endif /* U_SHOW_CPLUSPLUS_API */
#endif
icu::ParsePosition
ParsePosition is a simple class used by Format and its subclasses to keep track of the current positi...
Definition: parsepos.h:52
icu::ParsePosition::clone
ParsePosition * clone() const
Clone this object.
icu::ParsePosition::getDynamicClassID
virtual UClassID getDynamicClassID() const override
ICU "poor man's RTTI", returns a UClassID for the actual class.
icu::ParsePosition::ParsePosition
ParsePosition(const ParsePosition &copy)
Copy constructor.
Definition: parsepos.h:80
icu::ParsePosition::getStaticClassID
static UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
icu::ParsePosition::~ParsePosition
virtual ~ParsePosition()
Destructor.
icu::ParsePosition::ParsePosition
ParsePosition()
Default constructor, the index starts with 0 as default.
Definition: parsepos.h:58
icu::ParsePosition::ParsePosition
ParsePosition(int32_t newIndex)
Create a new ParsePosition with the given initial index.
Definition: parsepos.h:69
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition: uobject.h:223
icu::operator==
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
icu::operator!=
bool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition: stringpiece.h:335
uobject.h
C++ API: Common ICU base class UObject.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition: uobject.h:96
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
Definition: utypes.h:300