muParser: mu::ParserError Class Reference

# mu::ParserError Class Reference

Error class of the parser. More...

`#include <muParserError.h>`

List of all members.

## Public Member Functions
| ParserError ()
| Default constructor.
| ParserError (EErrorCodes a_iErrc)
| This Constructor is used for internal exceptions only.
| ParserError (const string_type &sMsg)
| Construct an error from a message text.
| ParserError (EErrorCodes a_iErrc, const string_type &sTok, const string_type &sFormula=string_type(_T("(formula is not available)")), int a_iPos=-1)
| Construct an error object.
| ParserError (EErrorCodes a_iErrc, int a_iPos, const string_type &sTok)
| Construct an error object.
| ParserError (const char_type *a_szMsg, int a_iPos=-1, const string_type &sTok=string_type())
| Construct an error object.
| ParserError (const ParserError &a_Obj)
| Copy constructor.
ParserError & | operator= (const ParserError &a_Obj)
| Assignment operator.
void | SetFormula (const string_type &a_strFormula)
| Set the expression related to this error.
const string_type & | GetExpr () const
| gets the expression related tp this error.
const string_type & | GetMsg () const
| Returns the message string for this error.
std::size_t | GetPos () const
| Return the formula position related to the error.
const string_type & | GetToken () const
| Return string related with this token (if available).
EErrorCodes | GetCode () const
| Return the error code.
## Private Member Functions
void | ReplaceSubString (string_type &strSource, const string_type &strFind, const string_type &strReplaceWith)
| Replace all ocuurences of a substring with another string.
void | Reset ()
| Reset the erro object.
## Private Attributes
string_type | m_strMsg
| The message string.
string_type | m_strFormula
| Formula string.
string_type | m_strTok
| Token related with the error.
int | m_iPos
| Formula position related to the error.
EErrorCodes | m_iErrc
| Error code.
const ParserErrorMsg & | m_ErrMsg

## Detailed Description

Error class of the parser.

Part of the math parser package.

Author:
  Ingo Berg

Examples:

  calc.cpp.

## Constructor & Destructor Documentation

mu::ParserError::ParserError | ( | EErrorCodes | a_iErrc | ) | `[explicit]`

This Constructor is used for internal exceptions only.

It does not contain any information but the error code.

References m_strMsg, and Reset().

mu::ParserError::ParserError | ( | EErrorCodes | iErrc,
|  | const string_type & | sTok,
|  | const string_type & | sExpr = `string_type(_T("(formula is not available)"))`,
|  | int | iPos = `-1` |
| ) |  |  |

Construct an error object.

Parameters:

  `[in]` | a_iErrc | the error code.
  `[in]` | sTok | The token string related to this error.
  `[in]` | sExpr | The expression related to the error.
  `[in]` | a_iPos | the position in the expression where the error occured.

References m_iErrc, m_iPos, m_strMsg, m_strTok, and ReplaceSubString().

mu::ParserError::ParserError | ( | EErrorCodes | iErrc,
|  | int | iPos,
|  | const string_type & | sTok |
| ) |  |  |

Construct an error object.

Parameters:

  `[in]` | iErrc | the error code.
  `[in]` | iPos | the position in the expression where the error occured.
  `[in]` | sTok | The token string related to this error.

References m_iErrc, m_iPos, m_strMsg, m_strTok, and ReplaceSubString().

mu::ParserError::ParserError | ( | const char_type * | szMsg,
|  | int | iPos = `-1`,
|  | const string_type & | sTok = `string_type()` |
| ) |  |  |

Construct an error object.

Parameters:

  `[in]` | szMsg | The error message text.
  `[in]` | iPos | the position related to the error.
  `[in]` | sTok | The token string related to this error.

References m_iPos, m_strMsg, m_strTok, and ReplaceSubString().

## Member Function Documentation

void mu::ParserError::ReplaceSubString | ( | string_type & | strSource,
|  | const string_type & | strFind,
|  | const string_type & | strReplaceWith |
| ) |  |  | `[private]`

Replace all ocuurences of a substring with another string.

Parameters:

  | strFind | The string that shall be replaced.
  | strReplaceWith | The string that should be inserted instead of strFind

Referenced by ParserError().

std::size_t mu::ParserError::GetPos | ( |  | ) | const

Return the formula position related to the error.

If the error is not related to a distinct position this will return -1

Examples:
  calc.cpp.

References m_iPos.

The documentation for this class was generated from the following files:

- muParserError.h
- muParserError.cpp