mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-21 08:21:56 +08:00
[muparser] Default ParserError's constructors
No need to define these explicitly when the defaults will do.
This commit is contained in:
parent
e9c106b881
commit
409173e0f0
@ -312,8 +312,10 @@ class ParserError {
|
||||
const string_type &sFormula = string_type(), int a_iPos = -1);
|
||||
ParserError(EErrorCodes a_iErrc, int a_iPos, const string_type &sTok);
|
||||
ParserError(const char_type *a_szMsg, int a_iPos = -1, const string_type &sTok = string_type());
|
||||
ParserError(const ParserError &a_Obj);
|
||||
ParserError &operator=(const ParserError &a_Obj);
|
||||
ParserError(ParserError &&) = default;
|
||||
ParserError &operator=(ParserError &&) = default;
|
||||
ParserError(const ParserError &a_Obj) = default;
|
||||
ParserError &operator=(const ParserError &a_Obj) = default;
|
||||
~ParserError();
|
||||
|
||||
void SetFormula(const string_type &a_strFormula);
|
||||
@ -327,8 +329,8 @@ class ParserError {
|
||||
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
|
||||
int m_iPos = -1; ///< Formula position related to the error
|
||||
EErrorCodes m_iErrc = ecUNDEFINED; ///< Error code
|
||||
} MUPARSER_ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
// OptionalError is used to optionally encapsulate an error.
|
||||
|
@ -116,16 +116,14 @@ string_type parser_error_for_code(EErrorCodes code) {
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
/** \brief Default constructor. */
|
||||
ParserError::ParserError()
|
||||
: m_strMsg(), m_strFormula(), m_strTok(), m_iPos(-1), m_iErrc(ecUNDEFINED) {}
|
||||
ParserError::ParserError() {}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/** \brief This Constructor is used for internal exceptions only.
|
||||
|
||||
It does not contain any information but the error code.
|
||||
*/
|
||||
ParserError::ParserError(EErrorCodes a_iErrc)
|
||||
: m_strMsg(), m_strFormula(), m_strTok(), m_iPos(-1), m_iErrc(a_iErrc) {
|
||||
ParserError::ParserError(EErrorCodes a_iErrc) : m_iErrc(a_iErrc) {
|
||||
m_strMsg = parser_error_for_code(m_iErrc);
|
||||
stringstream_type stream;
|
||||
stream << (int)m_iPos;
|
||||
@ -186,28 +184,6 @@ ParserError::ParserError(const char_type *szMsg, int iPos, const string_type &sT
|
||||
ReplaceSubString(m_strMsg, _T("$TOK$"), m_strTok);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/** \brief Copy constructor. */
|
||||
ParserError::ParserError(const ParserError &a_Obj)
|
||||
: m_strMsg(a_Obj.m_strMsg),
|
||||
m_strFormula(a_Obj.m_strFormula),
|
||||
m_strTok(a_Obj.m_strTok),
|
||||
m_iPos(a_Obj.m_iPos),
|
||||
m_iErrc(a_Obj.m_iErrc) {}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/** \brief Assignment operator. */
|
||||
ParserError &ParserError::operator=(const ParserError &a_Obj) {
|
||||
if (this == &a_Obj) return *this;
|
||||
|
||||
m_strMsg = a_Obj.m_strMsg;
|
||||
m_strFormula = a_Obj.m_strFormula;
|
||||
m_strTok = a_Obj.m_strTok;
|
||||
m_iPos = a_Obj.m_iPos;
|
||||
m_iErrc = a_Obj.m_iErrc;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ParserError::~ParserError() {}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user