Factory function for creating new parser variables. New methods what return

tokens and numbers.

--HG--
branch : feature
This commit is contained in:
dismine 2014-05-22 15:11:14 +03:00
parent 1bbee62a79
commit ccde48e3bf
16 changed files with 271 additions and 259 deletions

View File

@ -30,6 +30,8 @@
#include <QDebug> #include <QDebug>
#include "../widgets/vapplication.h" #include "../widgets/vapplication.h"
int Calculator::iVal = -1;
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief Calculator class constructor. * @brief Calculator class constructor.
@ -60,11 +62,14 @@ Calculator::Calculator(const VContainer *data)
DefinePostfixOprt(cm_Oprt, CmUnit); DefinePostfixOprt(cm_Oprt, CmUnit);
DefinePostfixOprt(mm_Oprt, MmUnit); DefinePostfixOprt(mm_Oprt, MmUnit);
DefinePostfixOprt(in_Oprt, InchUnit); DefinePostfixOprt(in_Oprt, InchUnit);
SetVarFactory(AddVariable, this);
} }
Calculator::~Calculator() Calculator::~Calculator()
{ {
delete [] vVarVal; delete [] vVarVal;
Calculator::iVal = -1;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -267,3 +272,35 @@ qreal Calculator::InchUnit(qreal val)
return unit; return unit;
} }
//---------------------------------------------------------------------------
// Factory function for creating new parser variables
// This could as well be a function performing database queries.
qreal* Calculator::AddVariable(const QString &a_szName, void *a_pUserData)
{
// I don't want dynamic allocation here, so i used this static buffer
// If you want dynamic allocation you must allocate all variables dynamically
// in order to delete them later on. Or you find other ways to keep track of
// variables that have been created implicitely.
static qreal afValBuf[100];
++iVal;
Q_UNUSED(a_szName)
Q_UNUSED(a_pUserData)
// qDebug() << "Generating new variable \""
// << a_szName << "\" (slots left: "
// << 99-iVal << ")"
// << " User data pointer is:"
// << QString::number(a_pUserData, 16);
afValBuf[iVal] = 0;
if (iVal>=99)
{
throw qmu::QmuParserError( "Variable buffer overflow." );
}
else
{
return &afValBuf[iVal];
}
}

View File

@ -39,14 +39,16 @@ class Calculator:public QmuParser
public: public:
explicit Calculator(const VContainer *data); explicit Calculator(const VContainer *data);
~Calculator(); ~Calculator();
qreal EvalFormula(const QString &formula); qreal EvalFormula(const QString &formula);
private: private:
Q_DISABLE_COPY(Calculator) Q_DISABLE_COPY(Calculator)
qreal *vVarVal; qreal *vVarVal;
void InitVariables(const VContainer *data); static int iVal;
static qreal CmUnit(qreal val); void InitVariables(const VContainer *data);
static qreal MmUnit(qreal val); static qreal CmUnit(qreal val);
static qreal InchUnit(qreal val); static qreal MmUnit(qreal val);
static qreal InchUnit(qreal val);
static qreal* AddVariable(const QString &a_szName, void *a_pUserData);
}; };
#endif // CALCULATOR_H #endif // CALCULATOR_H

View File

@ -202,11 +202,7 @@ int QmuParser::IsVal(const QString &a_szExpr, int *a_iPos, qreal *a_fVal)
{ {
qreal fVal(0); qreal fVal(0);
#if defined(_UNICODE) std::wstring a_szExprStd = a_szExpr.toStdWString();
std::wstring a_szExprStd = a_szExpr.toStdWString();
#else
std::string a_szExprStd = a_szExpr.toStdString();
#endif
stringstream_type stream(a_szExprStd); stringstream_type stream(a_szExprStd);
stream.seekg(0); // todo: check if this really is necessary stream.seekg(0); // todo: check if this really is necessary
stream.imbue(QmuParser::s_locale); stream.imbue(QmuParser::s_locale);

View File

@ -74,7 +74,7 @@ namespace qmu
static qreal Sign(qreal); static qreal Sign(qreal);
// Prefix operators // Prefix operators
// !!! Unary Minus is a MUST if you want to use negative signs !!! // !!! Unary Minus is a MUST if you want to use negative signs !!!
static qreal UnaryMinus(qreal v) Q_DECL_NOEXCEPT; static qreal UnaryMinus(qreal v);
// Functions with variable number of arguments // Functions with variable number of arguments
static qreal Sum(const qreal*, int); // sum static qreal Sum(const qreal*, int); // sum
static qreal Avg(const qreal*, int); // mean value static qreal Avg(const qreal*, int); // mean value
@ -88,7 +88,7 @@ namespace qmu
* @param v The value to negate * @param v The value to negate
* @return -v * @return -v
*/ */
inline qreal QmuParser::UnaryMinus(qreal v) Q_DECL_NOEXCEPT inline qreal QmuParser::UnaryMinus(qreal v)
{ {
return -v; return -v;
} }

View File

@ -64,7 +64,7 @@ QmuParserBase::QmuParserBase()
:m_pParseFormula(&QmuParserBase::ParseString), m_vRPN(), m_vStringBuf(), m_vStringVarBuf(), m_pTokenReader(), :m_pParseFormula(&QmuParserBase::ParseString), m_vRPN(), m_vStringBuf(), m_vStringVarBuf(), m_pTokenReader(),
m_FunDef(), m_PostOprtDef(), m_InfixOprtDef(), m_OprtDef(), m_ConstDef(), m_StrVarDef(), m_VarDef(), m_FunDef(), m_PostOprtDef(), m_InfixOprtDef(), m_OprtDef(), m_ConstDef(), m_StrVarDef(), m_VarDef(),
m_bBuiltInOp(true), m_sNameChars(), m_sOprtChars(), m_sInfixOprtChars(), m_nIfElseCounter(0), m_vStackBuffer(), m_bBuiltInOp(true), m_sNameChars(), m_sOprtChars(), m_sInfixOprtChars(), m_nIfElseCounter(0), m_vStackBuffer(),
m_nFinalResultIdx(0) m_nFinalResultIdx(0), m_Tokens(QMap<int, QString>()), m_Numbers(QMap<int, QString>())
{ {
InitTokenReader(); InitTokenReader();
} }
@ -79,7 +79,7 @@ QmuParserBase::QmuParserBase(const QmuParserBase &a_Parser)
:m_pParseFormula(&QmuParserBase::ParseString), m_vRPN(), m_vStringBuf(), m_vStringVarBuf(), m_pTokenReader(), :m_pParseFormula(&QmuParserBase::ParseString), m_vRPN(), m_vStringBuf(), m_vStringVarBuf(), m_pTokenReader(),
m_FunDef(), m_PostOprtDef(), m_InfixOprtDef(), m_OprtDef(), m_ConstDef(), m_StrVarDef(), m_VarDef(), m_FunDef(), m_PostOprtDef(), m_InfixOprtDef(), m_OprtDef(), m_ConstDef(), m_StrVarDef(), m_VarDef(),
m_bBuiltInOp(true), m_sNameChars(), m_sOprtChars(), m_sInfixOprtChars(), m_nIfElseCounter(0), m_vStackBuffer(), m_bBuiltInOp(true), m_sNameChars(), m_sOprtChars(), m_sInfixOprtChars(), m_nIfElseCounter(0), m_vStackBuffer(),
m_nFinalResultIdx(0) m_nFinalResultIdx(0), m_Tokens(QMap<int, QString>()), m_Numbers(QMap<int, QString>())
{ {
m_pTokenReader.reset(new token_reader_type(this)); m_pTokenReader.reset(new token_reader_type(this));
Assign(a_Parser); Assign(a_Parser);
@ -98,7 +98,7 @@ QmuParserBase::~QmuParserBase()
* @return *this * @return *this
* @throw nothrow * @throw nothrow
*/ */
QmuParserBase& QmuParserBase::operator=(const QmuParserBase &a_Parser) Q_DECL_NOEXCEPT QmuParserBase& QmuParserBase::operator=(const QmuParserBase &a_Parser)
{ {
Assign(a_Parser); Assign(a_Parser);
return *this; return *this;
@ -199,13 +199,15 @@ void QmuParserBase::ResetLocale()
* Clear bytecode, reset the token reader. * Clear bytecode, reset the token reader.
* @throw nothrow * @throw nothrow
*/ */
void QmuParserBase::ReInit() const Q_DECL_NOEXCEPT void QmuParserBase::ReInit() const
{ {
m_pParseFormula = &QmuParserBase::ParseString; m_pParseFormula = &QmuParserBase::ParseString;
m_vStringBuf.clear(); m_vStringBuf.clear();
m_vRPN.clear(); m_vRPN.clear();
m_pTokenReader->ReInit(); m_pTokenReader->ReInit();
m_nIfElseCounter = 0; m_nIfElseCounter = 0;
m_Tokens.clear();
m_Numbers.clear();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
@ -318,13 +320,9 @@ void QmuParserBase::AddCallback(const QString &a_strName, const QmuParserCallbac
void QmuParserBase::CheckOprt(const QString &a_sName, const QmuParserCallback &a_Callback, void QmuParserBase::CheckOprt(const QString &a_sName, const QmuParserCallback &a_Callback,
const QString &a_szCharSet) const const QString &a_szCharSet) const
{ {
#if defined(_UNICODE)
const std::wstring a_sNameStd = a_sName.toStdWString(); const std::wstring a_sNameStd = a_sName.toStdWString();
const std::wstring a_szCharSetStd = a_szCharSet.toStdWString(); const std::wstring a_szCharSetStd = a_szCharSet.toStdWString();
#else
const std::string a_sNameStd = a_sName.toStdString();
const std::string a_szCharSetStd = a_szCharSet.toStdString();
#endif
if ( a_sNameStd.length() == false || (a_sNameStd.find_first_not_of(a_szCharSetStd)!=string_type::npos) || if ( a_sNameStd.length() == false || (a_sNameStd.find_first_not_of(a_szCharSetStd)!=string_type::npos) ||
(a_sNameStd.at(0)>='0' && a_sNameStd.at(0)<='9')) (a_sNameStd.at(0)>='0' && a_sNameStd.at(0)<='9'))
{ {
@ -385,13 +383,9 @@ void QmuParserBase::CheckOprt(const QString &a_sName, const QmuParserCallback &a
*/ */
void QmuParserBase::CheckName(const QString &a_sName, const QString &a_szCharSet) const void QmuParserBase::CheckName(const QString &a_sName, const QString &a_szCharSet) const
{ {
#if defined(_UNICODE)
std::wstring a_sNameStd = a_sName.toStdWString(); std::wstring a_sNameStd = a_sName.toStdWString();
std::wstring a_szCharSetStd = a_szCharSet.toStdWString(); std::wstring a_szCharSetStd = a_szCharSet.toStdWString();
#else
std::string a_sNameStd = a_sName.toStdString();
std::string a_szCharSetStd = a_szCharSet.toStdString();
#endif
if ( a_sNameStd.length() == false || (a_sNameStd.find_first_not_of(a_szCharSetStd)!=string_type::npos) || if ( a_sNameStd.length() == false || (a_sNameStd.find_first_not_of(a_szCharSetStd)!=string_type::npos) ||
(a_sNameStd[0]>='0' && a_sNameStd[0]<='9')) (a_sNameStd[0]>='0' && a_sNameStd[0]<='9'))
{ {
@ -1494,14 +1488,17 @@ void QmuParserBase::CreateRPN() const
opt.SetIdx(m_vStringBuf.size()); // Assign buffer index to token opt.SetIdx(m_vStringBuf.size()); // Assign buffer index to token
stVal.push(opt); stVal.push(opt);
m_vStringBuf.push_back(opt.GetAsString()); // Store string in internal buffer m_vStringBuf.push_back(opt.GetAsString()); // Store string in internal buffer
m_Tokens.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString());
break; break;
case cmVAR: case cmVAR:
stVal.push(opt); stVal.push(opt);
m_vRPN.AddVar( static_cast<qreal*>(opt.GetVar()) ); m_vRPN.AddVar( static_cast<qreal*>(opt.GetVar()) );
m_Tokens.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString());
break; break;
case cmVAL: case cmVAL:
stVal.push(opt); stVal.push(opt);
m_vRPN.AddVal( opt.GetVal() ); m_vRPN.AddVal( opt.GetVal() );
m_Numbers.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString());
break; break;
case cmELSE: case cmELSE:
m_nIfElseCounter--; m_nIfElseCounter--;
@ -1643,10 +1640,12 @@ void QmuParserBase::CreateRPN() const
case cmFUNC_BULK: case cmFUNC_BULK:
case cmFUNC_STR: case cmFUNC_STR:
stOpt.push(opt); stOpt.push(opt);
m_Tokens.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString());
break; break;
case cmOPRT_POSTFIX: case cmOPRT_POSTFIX:
stOpt.push(opt); stOpt.push(opt);
ApplyFunc(stOpt, stVal, 1); // this is the postfix operator ApplyFunc(stOpt, stVal, 1); // this is the postfix operator
m_Tokens.insert(m_pTokenReader->GetPos()-opt.GetAsString().length(), opt.GetAsString());
break; break;
case cmENDIF: case cmENDIF:
case cmVARPOW2: case cmVARPOW2:
@ -1753,7 +1752,7 @@ void Q_NORETURN QmuParserBase::Error(EErrorCodes a_iErrc, int a_iPos, const QStr
* Resets the parser to string parsing mode by calling #ReInit. * Resets the parser to string parsing mode by calling #ReInit.
*/ */
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void QmuParserBase::ClearVar() Q_DECL_NOEXCEPT void QmuParserBase::ClearVar()
{ {
m_VarDef.clear(); m_VarDef.clear();
ReInit(); ReInit();
@ -1766,7 +1765,7 @@ void QmuParserBase::ClearVar() Q_DECL_NOEXCEPT
* *
* Removes a variable if it exists. If the Variable does not exist nothing will be done. * Removes a variable if it exists. If the Variable does not exist nothing will be done.
*/ */
void QmuParserBase::RemoveVar(const QString &a_strVarName) Q_DECL_NOEXCEPT void QmuParserBase::RemoveVar(const QString &a_strVarName)
{ {
varmap_type::iterator item = m_VarDef.find(a_strVarName); varmap_type::iterator item = m_VarDef.find(a_strVarName);
if (item!=m_VarDef.end()) if (item!=m_VarDef.end())
@ -1783,7 +1782,7 @@ void QmuParserBase::RemoveVar(const QString &a_strVarName) Q_DECL_NOEXCEPT
* @throw nothrow * @throw nothrow
*/ */
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void QmuParserBase::ClearFun() Q_DECL_NOEXCEPT void QmuParserBase::ClearFun()
{ {
m_FunDef.clear(); m_FunDef.clear();
ReInit(); ReInit();
@ -1797,7 +1796,7 @@ void QmuParserBase::ClearFun() Q_DECL_NOEXCEPT
* @post Resets the parser to string parsing mode. * @post Resets the parser to string parsing mode.
* @throw nothrow * @throw nothrow
*/ */
void QmuParserBase::ClearConst() Q_DECL_NOEXCEPT void QmuParserBase::ClearConst()
{ {
m_ConstDef.clear(); m_ConstDef.clear();
m_StrVarDef.clear(); m_StrVarDef.clear();
@ -1810,7 +1809,7 @@ void QmuParserBase::ClearConst() Q_DECL_NOEXCEPT
* @post Resets the parser to string parsing mode. * @post Resets the parser to string parsing mode.
* @throw nothrow * @throw nothrow
*/ */
void QmuParserBase::ClearPostfixOprt() Q_DECL_NOEXCEPT void QmuParserBase::ClearPostfixOprt()
{ {
m_PostOprtDef.clear(); m_PostOprtDef.clear();
ReInit(); ReInit();
@ -1823,7 +1822,7 @@ void QmuParserBase::ClearPostfixOprt() Q_DECL_NOEXCEPT
* @throw nothrow * @throw nothrow
*/ */
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void QmuParserBase::ClearOprt() Q_DECL_NOEXCEPT void QmuParserBase::ClearOprt()
{ {
m_OprtDef.clear(); m_OprtDef.clear();
ReInit(); ReInit();
@ -1836,7 +1835,7 @@ void QmuParserBase::ClearOprt() Q_DECL_NOEXCEPT
* @throw nothrow * @throw nothrow
*/ */
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
void QmuParserBase::ClearInfixOprt() Q_DECL_NOEXCEPT void QmuParserBase::ClearInfixOprt()
{ {
m_InfixOprtDef.clear(); m_InfixOprtDef.clear();
ReInit(); ReInit();
@ -1848,7 +1847,7 @@ void QmuParserBase::ClearInfixOprt() Q_DECL_NOEXCEPT
* @post Resets the parser to string parser mode. * @post Resets the parser to string parser mode.
* @throw nothrow * @throw nothrow
*/ */
void QmuParserBase::EnableOptimizer(bool a_bIsOn) Q_DECL_NOEXCEPT void QmuParserBase::EnableOptimizer(bool a_bIsOn)
{ {
m_vRPN.EnableOptimizer(a_bIsOn); m_vRPN.EnableOptimizer(a_bIsOn);
ReInit(); ReInit();
@ -1879,7 +1878,7 @@ void QmuParserBase::EnableDebugDump(bool bDumpCmd, bool bDumpStack)
* manually one by one. It is not possible to disable built in operators selectively. This function will Reinitialize * manually one by one. It is not possible to disable built in operators selectively. This function will Reinitialize
* the parser by calling ReInit(). * the parser by calling ReInit().
*/ */
void QmuParserBase::EnableBuiltInOprt(bool a_bIsOn) Q_DECL_NOEXCEPT void QmuParserBase::EnableBuiltInOprt(bool a_bIsOn)
{ {
m_bBuiltInOp = a_bIsOn; m_bBuiltInOp = a_bIsOn;
ReInit(); ReInit();

View File

@ -58,22 +58,22 @@ class QMUPARSERSHARED_EXPORT QmuParserBase
public: public:
QmuParserBase(); QmuParserBase();
QmuParserBase(const QmuParserBase &a_Parser); QmuParserBase(const QmuParserBase &a_Parser);
QmuParserBase& operator=(const QmuParserBase &a_Parser) Q_DECL_NOEXCEPT; QmuParserBase& operator=(const QmuParserBase &a_Parser);
virtual ~QmuParserBase(); virtual ~QmuParserBase();
static void EnableDebugDump(bool bDumpCmd, bool bDumpStack); static void EnableDebugDump(bool bDumpCmd, bool bDumpStack);
qreal Eval() const; qreal Eval() const;
qreal* Eval(int &nStackSize) const; qreal* Eval(int &nStackSize) const;
void Eval(qreal *results, int nBulkSize) const; void Eval(qreal *results, int nBulkSize) const;
int GetNumResults() const Q_DECL_NOEXCEPT; int GetNumResults() const;
void SetExpr(const QString &a_sExpr); void SetExpr(const QString &a_sExpr);
void SetVarFactory(facfun_type a_pFactory, void *pUserData = nullptr); void SetVarFactory(facfun_type a_pFactory, void *pUserData = nullptr);
void SetDecSep(char_type cDecSep); void SetDecSep(char_type cDecSep);
void SetThousandsSep(char_type cThousandsSep = 0); void SetThousandsSep(char_type cThousandsSep = 0);
void ResetLocale(); void ResetLocale();
void EnableOptimizer(bool a_bIsOn=true) Q_DECL_NOEXCEPT; void EnableOptimizer(bool a_bIsOn=true);
void EnableBuiltInOprt(bool a_bIsOn=true) Q_DECL_NOEXCEPT; void EnableBuiltInOprt(bool a_bIsOn=true);
bool HasBuiltInOprt() const Q_DECL_NOEXCEPT; bool HasBuiltInOprt() const;
void AddValIdent(identfun_type a_pCallback); void AddValIdent(identfun_type a_pCallback);
void DefineOprt(const QString &a_strName, fun_type2 a_pFun, unsigned a_iPri=0, void DefineOprt(const QString &a_strName, fun_type2 a_pFun, unsigned a_iPri=0,
EOprtAssociativity a_eAssociativity = oaLEFT, bool a_bAllowOpt = false); EOprtAssociativity a_eAssociativity = oaLEFT, bool a_bAllowOpt = false);
@ -84,23 +84,25 @@ public:
void DefineInfixOprt(const QString &a_strName, fun_type1 a_pOprt, int a_iPrec=prINFIX, void DefineInfixOprt(const QString &a_strName, fun_type1 a_pOprt, int a_iPrec=prINFIX,
bool a_bAllowOpt=true); bool a_bAllowOpt=true);
// Clear user defined variables, constants or functions // Clear user defined variables, constants or functions
void ClearVar() Q_DECL_NOEXCEPT; void ClearVar();
void ClearFun() Q_DECL_NOEXCEPT; void ClearFun();
void ClearConst() Q_DECL_NOEXCEPT; void ClearConst();
void ClearInfixOprt() Q_DECL_NOEXCEPT; void ClearInfixOprt();
void ClearPostfixOprt() Q_DECL_NOEXCEPT; void ClearPostfixOprt();
void ClearOprt() Q_DECL_NOEXCEPT; void ClearOprt();
void RemoveVar(const QString &a_strVarName) Q_DECL_NOEXCEPT; void RemoveVar(const QString &a_strVarName);
const varmap_type& GetUsedVar() const; const varmap_type& GetUsedVar() const;
const varmap_type& GetVar() const Q_DECL_NOEXCEPT; const varmap_type& GetVar() const;
const valmap_type& GetConst() const Q_DECL_NOEXCEPT; const valmap_type& GetConst() const;
const QString& GetExpr() const; const QString& GetExpr() const;
const funmap_type& GetFunDef() const Q_DECL_NOEXCEPT; const funmap_type& GetFunDef() const;
static QString GetVersion(EParserVersionInfo eInfo = pviFULL); static QString GetVersion(EParserVersionInfo eInfo = pviFULL);
static const QStringList& GetOprtDef() Q_DECL_NOEXCEPT; static const QStringList& GetOprtDef();
void DefineNameChars(const QString &a_szCharset) Q_DECL_NOEXCEPT; QMap<int, QString> GetTokens() const;
void DefineOprtChars(const QString &a_szCharset) Q_DECL_NOEXCEPT; QMap<int, QString> GetNumbers() const;
void DefineInfixOprtChars(const QString &a_szCharset) Q_DECL_NOEXCEPT; void DefineNameChars(const QString &a_szCharset);
void DefineOprtChars(const QString &a_szCharset);
void DefineInfixOprtChars(const QString &a_szCharset);
const QString& ValidNameChars() const; const QString& ValidNameChars() const;
const QString& ValidOprtChars() const; const QString& ValidOprtChars() const;
const QString& ValidInfixOprtChars() const; const QString& ValidInfixOprtChars() const;
@ -232,10 +234,12 @@ private:
// items merely used for caching state information // items merely used for caching state information
mutable valbuf_type m_vStackBuffer; ///< This is merely a buffer used for the stack in the cmd parsing routine mutable valbuf_type m_vStackBuffer; ///< This is merely a buffer used for the stack in the cmd parsing routine
mutable int m_nFinalResultIdx; mutable int m_nFinalResultIdx;
mutable QMap<int, QString> m_Tokens;///< Keep all tokens that we can translate
mutable QMap<int, QString> m_Numbers;///< Keep all numbers what exist in formula
void Assign(const QmuParserBase &a_Parser); void Assign(const QmuParserBase &a_Parser);
void InitTokenReader(); void InitTokenReader();
void ReInit() const Q_DECL_NOEXCEPT; void ReInit() const;
void AddCallback(const QString &a_strName, const QmuParserCallback &a_Callback, void AddCallback(const QString &a_strName, const QmuParserCallback &a_Callback,
funmap_type &a_Storage, const QString &a_szCharSet ); funmap_type &a_Storage, const QString &a_szCharSet );
void ApplyRemainingOprt(QStack<token_type> &a_stOpt, QStack<token_type> &a_stVal) const; void ApplyRemainingOprt(QStack<token_type> &a_stOpt, QStack<token_type> &a_stVal) const;
@ -297,16 +301,26 @@ inline void QmuParserBase::SetVarFactory(facfun_type a_pFactory, void *pUserData
* @brief Get the default symbols used for the built in operators. * @brief Get the default symbols used for the built in operators.
* @sa c_DefaultOprt * @sa c_DefaultOprt
*/ */
inline const QStringList &QmuParserBase::GetOprtDef() Q_DECL_NOEXCEPT inline const QStringList &QmuParserBase::GetOprtDef()
{ {
return c_DefaultOprt; return c_DefaultOprt;
} }
inline QMap<int, QString> QmuParserBase::GetTokens() const
{
return m_Tokens;
}
inline QMap<int, QString> QmuParserBase::GetNumbers() const
{
return m_Numbers;
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief Define the set of valid characters to be used in names of functions, variables, constants. * @brief Define the set of valid characters to be used in names of functions, variables, constants.
*/ */
inline void QmuParserBase::DefineNameChars(const QString &a_szCharset) Q_DECL_NOEXCEPT inline void QmuParserBase::DefineNameChars(const QString &a_szCharset)
{ {
m_sNameChars = a_szCharset; m_sNameChars = a_szCharset;
} }
@ -315,7 +329,7 @@ inline void QmuParserBase::DefineNameChars(const QString &a_szCharset) Q_DECL_NO
/** /**
* @brief Define the set of valid characters to be used in names of binary operators and postfix operators. * @brief Define the set of valid characters to be used in names of binary operators and postfix operators.
*/ */
inline void QmuParserBase::DefineOprtChars(const QString &a_szCharset) Q_DECL_NOEXCEPT inline void QmuParserBase::DefineOprtChars(const QString &a_szCharset)
{ {
m_sOprtChars = a_szCharset; m_sOprtChars = a_szCharset;
} }
@ -324,7 +338,7 @@ inline void QmuParserBase::DefineOprtChars(const QString &a_szCharset) Q_DECL_NO
/** /**
* @brief Define the set of valid characters to be used in names of infix operators. * @brief Define the set of valid characters to be used in names of infix operators.
*/ */
inline void QmuParserBase::DefineInfixOprtChars(const QString &a_szCharset) Q_DECL_NOEXCEPT inline void QmuParserBase::DefineInfixOprtChars(const QString &a_szCharset)
{ {
m_sInfixOprtChars = a_szCharset; m_sInfixOprtChars = a_szCharset;
} }
@ -333,7 +347,7 @@ inline void QmuParserBase::DefineInfixOprtChars(const QString &a_szCharset) Q_DE
/** /**
* @brief Return a map containing the used variables only. * @brief Return a map containing the used variables only.
*/ */
inline const varmap_type &QmuParserBase::GetVar() const Q_DECL_NOEXCEPT inline const varmap_type &QmuParserBase::GetVar() const
{ {
return m_VarDef; return m_VarDef;
} }
@ -342,7 +356,7 @@ inline const varmap_type &QmuParserBase::GetVar() const Q_DECL_NOEXCEPT
/** /**
* @brief Return a map containing all parser constants. * @brief Return a map containing all parser constants.
*/ */
inline const valmap_type &QmuParserBase::GetConst() const Q_DECL_NOEXCEPT inline const valmap_type &QmuParserBase::GetConst() const
{ {
return m_ConstDef; return m_ConstDef;
} }
@ -358,7 +372,7 @@ inline const valmap_type &QmuParserBase::GetConst() const Q_DECL_NOEXCEPT
* parser functions. String functions are not part of this map. The Prototype definition is encapsulated in objects * parser functions. String functions are not part of this map. The Prototype definition is encapsulated in objects
* of the class FunProt one per parser function each associated with function names via a map construct. * of the class FunProt one per parser function each associated with function names via a map construct.
*/ */
inline const funmap_type &QmuParserBase::GetFunDef() const Q_DECL_NOEXCEPT inline const funmap_type &QmuParserBase::GetFunDef() const
{ {
return m_FunDef; return m_FunDef;
} }
@ -378,7 +392,7 @@ inline const QString& QmuParserBase::GetExpr() const
* @return #m_bBuiltInOp; true if built in operators are enabled. * @return #m_bBuiltInOp; true if built in operators are enabled.
* @throw nothrow * @throw nothrow
*/ */
inline bool QmuParserBase::HasBuiltInOprt() const Q_DECL_NOEXCEPT inline bool QmuParserBase::HasBuiltInOprt() const
{ {
return m_bBuiltInOp; return m_bBuiltInOp;
} }
@ -391,7 +405,7 @@ inline bool QmuParserBase::HasBuiltInOprt() const Q_DECL_NOEXCEPT
* value. This function returns the number of available results. * value. This function returns the number of available results.
*/ */
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
inline int QmuParserBase::GetNumResults() const Q_DECL_NOEXCEPT inline int QmuParserBase::GetNumResults() const
{ {
return m_nFinalResultIdx; return m_nFinalResultIdx;
} }

View File

@ -40,7 +40,7 @@ namespace qmu
* @brief Bytecode default constructor. * @brief Bytecode default constructor.
*/ */
// cppcheck-suppress uninitMemberVar // cppcheck-suppress uninitMemberVar
QmuParserByteCode::QmuParserByteCode() Q_DECL_NOEXCEPT QmuParserByteCode::QmuParserByteCode()
:m_iStackPos(0), m_iMaxStackSize(0), m_vRPN(), m_bEnableOptimizer(true) :m_iStackPos(0), m_iMaxStackSize(0), m_vRPN(), m_bEnableOptimizer(true)
{ {
m_vRPN.reserve(50); m_vRPN.reserve(50);
@ -53,7 +53,7 @@ QmuParserByteCode::QmuParserByteCode() Q_DECL_NOEXCEPT
* Implemented in Terms of Assign(const QParserByteCode &a_ByteCode) * Implemented in Terms of Assign(const QParserByteCode &a_ByteCode)
*/ */
// cppcheck-suppress uninitMemberVar // cppcheck-suppress uninitMemberVar
QmuParserByteCode::QmuParserByteCode(const QmuParserByteCode &a_ByteCode) Q_DECL_NOEXCEPT QmuParserByteCode::QmuParserByteCode(const QmuParserByteCode &a_ByteCode)
:m_iStackPos(a_ByteCode.m_iStackPos), m_iMaxStackSize(a_ByteCode.m_iMaxStackSize), m_vRPN(a_ByteCode.m_vRPN), :m_iStackPos(a_ByteCode.m_iStackPos), m_iMaxStackSize(a_ByteCode.m_iMaxStackSize), m_vRPN(a_ByteCode.m_vRPN),
m_bEnableOptimizer(true) m_bEnableOptimizer(true)
{ {
@ -67,7 +67,7 @@ QmuParserByteCode::QmuParserByteCode(const QmuParserByteCode &a_ByteCode) Q_DECL
* Implemented in Terms of Assign(const QParserByteCode &a_ByteCode) * Implemented in Terms of Assign(const QParserByteCode &a_ByteCode)
*/ */
// cppcheck-suppress operatorEqVarError // cppcheck-suppress operatorEqVarError
QmuParserByteCode& QmuParserByteCode::operator=(const QmuParserByteCode &a_ByteCode) Q_DECL_NOEXCEPT QmuParserByteCode& QmuParserByteCode::operator=(const QmuParserByteCode &a_ByteCode)
{ {
Assign(a_ByteCode); Assign(a_ByteCode);
return *this; return *this;
@ -79,7 +79,7 @@ QmuParserByteCode& QmuParserByteCode::operator=(const QmuParserByteCode &a_ByteC
* *
* @throw nowthrow * @throw nowthrow
*/ */
void QmuParserByteCode::Assign(const QmuParserByteCode &a_ByteCode) Q_DECL_NOEXCEPT void QmuParserByteCode::Assign(const QmuParserByteCode &a_ByteCode)
{ {
if (this==&a_ByteCode) if (this==&a_ByteCode)
{ {
@ -98,7 +98,7 @@ void QmuParserByteCode::Assign(const QmuParserByteCode &a_ByteCode) Q_DECL_NOEXC
* @param a_pVar Pointer to be added. * @param a_pVar Pointer to be added.
* @throw nothrow * @throw nothrow
*/ */
void QmuParserByteCode::AddVar(qreal *a_pVar) Q_DECL_NOEXCEPT void QmuParserByteCode::AddVar(qreal *a_pVar)
{ {
++m_iStackPos; ++m_iStackPos;
m_iMaxStackSize = qMax(m_iMaxStackSize, static_cast<size_t>(m_iStackPos)); m_iMaxStackSize = qMax(m_iMaxStackSize, static_cast<size_t>(m_iStackPos));
@ -126,7 +126,7 @@ void QmuParserByteCode::AddVar(qreal *a_pVar) Q_DECL_NOEXCEPT
* @param a_pVal Value to be added. * @param a_pVal Value to be added.
* @throw nothrow * @throw nothrow
*/ */
void QmuParserByteCode::AddVal(qreal a_fVal) Q_DECL_NOEXCEPT void QmuParserByteCode::AddVal(qreal a_fVal)
{ {
++m_iStackPos; ++m_iStackPos;
m_iMaxStackSize = qMax(m_iMaxStackSize, static_cast<size_t>(m_iStackPos)); m_iMaxStackSize = qMax(m_iMaxStackSize, static_cast<size_t>(m_iStackPos));
@ -472,7 +472,7 @@ void QmuParserByteCode::AddOp(ECmdCode a_Oprt)
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void QmuParserByteCode::AddIfElse(ECmdCode a_Oprt) Q_DECL_NOEXCEPT void QmuParserByteCode::AddIfElse(ECmdCode a_Oprt)
{ {
SToken tok; SToken tok;
tok.Cmd = a_Oprt; tok.Cmd = a_Oprt;
@ -491,7 +491,7 @@ void QmuParserByteCode::AddIfElse(ECmdCode a_Oprt) Q_DECL_NOEXCEPT
* *
* @sa ParserToken::ECmdCode * @sa ParserToken::ECmdCode
*/ */
void QmuParserByteCode::AddAssignOp(qreal *a_pVar) Q_DECL_NOEXCEPT void QmuParserByteCode::AddAssignOp(qreal *a_pVar)
{ {
--m_iStackPos; --m_iStackPos;
@ -508,7 +508,7 @@ void QmuParserByteCode::AddAssignOp(qreal *a_pVar) Q_DECL_NOEXCEPT
* @param a_iArgc Number of arguments, negative numbers indicate multiarg functions. * @param a_iArgc Number of arguments, negative numbers indicate multiarg functions.
* @param a_pFun Pointer to function callback. * @param a_pFun Pointer to function callback.
*/ */
void QmuParserByteCode::AddFun(generic_fun_type a_pFun, int a_iArgc) Q_DECL_NOEXCEPT void QmuParserByteCode::AddFun(generic_fun_type a_pFun, int a_iArgc)
{ {
if (a_iArgc>=0) if (a_iArgc>=0)
{ {
@ -535,7 +535,7 @@ void QmuParserByteCode::AddFun(generic_fun_type a_pFun, int a_iArgc) Q_DECL_NOEX
* @param a_iArgc Number of arguments, negative numbers indicate multiarg functions. * @param a_iArgc Number of arguments, negative numbers indicate multiarg functions.
* @param a_pFun Pointer to function callback. * @param a_pFun Pointer to function callback.
*/ */
void QmuParserByteCode::AddBulkFun(generic_fun_type a_pFun, int a_iArgc) Q_DECL_NOEXCEPT void QmuParserByteCode::AddBulkFun(generic_fun_type a_pFun, int a_iArgc)
{ {
m_iStackPos = m_iStackPos - a_iArgc + 1; m_iStackPos = m_iStackPos - a_iArgc + 1;
m_iMaxStackSize = qMax(m_iMaxStackSize, static_cast<size_t>(m_iStackPos)); m_iMaxStackSize = qMax(m_iMaxStackSize, static_cast<size_t>(m_iStackPos));
@ -555,7 +555,7 @@ void QmuParserByteCode::AddBulkFun(generic_fun_type a_pFun, int a_iArgc) Q_DECL_
* A string function entry consists of the stack position of the return value, followed by a cmSTRFUNC code, the * A string function entry consists of the stack position of the return value, followed by a cmSTRFUNC code, the
* function pointer and an index into the string buffer maintained by the parser. * function pointer and an index into the string buffer maintained by the parser.
*/ */
void QmuParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx) Q_DECL_NOEXCEPT void QmuParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx)
{ {
m_iStackPos = m_iStackPos - a_iArgc + 1; m_iStackPos = m_iStackPos - a_iArgc + 1;
@ -575,7 +575,7 @@ void QmuParserByteCode::AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iI
* *
* @throw nothrow * @throw nothrow
*/ */
void QmuParserByteCode::Finalize() Q_DECL_NOEXCEPT void QmuParserByteCode::Finalize()
{ {
SToken tok; SToken tok;
tok.Cmd = cmEND; tok.Cmd = cmEND;
@ -662,7 +662,7 @@ const SToken* QmuParserByteCode::GetBase() const
* The name of this function is a violation of my own coding guidelines but this way it's more in line with the STL * The name of this function is a violation of my own coding guidelines but this way it's more in line with the STL
* functions thus more intuitive. * functions thus more intuitive.
*/ */
void QmuParserByteCode::clear() Q_DECL_NOEXCEPT void QmuParserByteCode::clear()
{ {
m_vRPN.clear(); m_vRPN.clear();
m_iStackPos = 0; m_iStackPos = 0;

View File

@ -81,23 +81,23 @@ struct SToken
class QmuParserByteCode class QmuParserByteCode
{ {
public: public:
QmuParserByteCode() Q_DECL_NOEXCEPT; QmuParserByteCode();
QmuParserByteCode(const QmuParserByteCode &a_ByteCode) Q_DECL_NOEXCEPT; QmuParserByteCode(const QmuParserByteCode &a_ByteCode);
QmuParserByteCode& operator=(const QmuParserByteCode &a_ByteCode) Q_DECL_NOEXCEPT; QmuParserByteCode& operator=(const QmuParserByteCode &a_ByteCode);
void Assign(const QmuParserByteCode &a_ByteCode) Q_DECL_NOEXCEPT; void Assign(const QmuParserByteCode &a_ByteCode);
void AddVar(qreal *a_pVar) Q_DECL_NOEXCEPT; void AddVar(qreal *a_pVar);
void AddVal(qreal a_fVal) Q_DECL_NOEXCEPT; void AddVal(qreal a_fVal);
void AddOp(ECmdCode a_Oprt); void AddOp(ECmdCode a_Oprt);
void AddIfElse(ECmdCode a_Oprt) Q_DECL_NOEXCEPT; void AddIfElse(ECmdCode a_Oprt);
void AddAssignOp(qreal *a_pVar) Q_DECL_NOEXCEPT; void AddAssignOp(qreal *a_pVar);
void AddFun(generic_fun_type a_pFun, int a_iArgc) Q_DECL_NOEXCEPT; void AddFun(generic_fun_type a_pFun, int a_iArgc);
void AddBulkFun(generic_fun_type a_pFun, int a_iArgc) Q_DECL_NOEXCEPT; void AddBulkFun(generic_fun_type a_pFun, int a_iArgc);
void AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx) Q_DECL_NOEXCEPT; void AddStrFun(generic_fun_type a_pFun, int a_iArgc, int a_iIdx);
void EnableOptimizer(bool bStat) Q_DECL_NOEXCEPT; void EnableOptimizer(bool bStat);
void Finalize() Q_DECL_NOEXCEPT; void Finalize();
void clear() Q_DECL_NOEXCEPT; void clear();
std::size_t GetMaxStackSize() const Q_DECL_NOEXCEPT; std::size_t GetMaxStackSize() const;
std::size_t GetSize() const Q_DECL_NOEXCEPT; std::size_t GetSize() const;
const SToken* GetBase() const; const SToken* GetBase() const;
void AsciiDump(); void AsciiDump();
private: private:
@ -122,13 +122,13 @@ private:
}; };
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
inline void QmuParserByteCode::EnableOptimizer(bool bStat) Q_DECL_NOEXCEPT inline void QmuParserByteCode::EnableOptimizer(bool bStat)
{ {
m_bEnableOptimizer = bStat; m_bEnableOptimizer = bStat;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
inline std::size_t QmuParserByteCode::GetMaxStackSize() const Q_DECL_NOEXCEPT inline std::size_t QmuParserByteCode::GetMaxStackSize() const
{ {
return m_iMaxStackSize+1; return m_iMaxStackSize+1;
} }
@ -138,7 +138,7 @@ inline std::size_t QmuParserByteCode::GetMaxStackSize() const Q_DECL_NOEXCEPT
* @brief Returns the number of entries in the bytecode. * @brief Returns the number of entries in the bytecode.
*/ */
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
inline std::size_t QmuParserByteCode::GetSize() const Q_DECL_NOEXCEPT inline std::size_t QmuParserByteCode::GetSize() const
{ {
return m_vRPN.size(); return m_vRPN.size();
} }

View File

@ -34,7 +34,7 @@ namespace qmu
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type0 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( fun_type0 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -44,7 +44,6 @@ QmuParserCallback::QmuParserCallback ( fun_type0 a_pFun, bool a_bAllowOpti ) Q_D
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec, ECmdCode a_iCode ) QmuParserCallback::QmuParserCallback ( fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec, ECmdCode a_iCode )
Q_DECL_NOEXCEPT
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 1 ), m_iPri ( a_iPrec ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 1 ), m_iPri ( a_iPrec ), m_eOprtAsct ( oaNONE ),
m_iCode ( a_iCode ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( a_iCode ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -57,7 +56,7 @@ Q_DECL_NOEXCEPT
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type2 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( fun_type2 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -75,7 +74,7 @@ QmuParserCallback::QmuParserCallback ( fun_type2 a_pFun, bool a_bAllowOpti ) Q_D
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, QmuParserCallback::QmuParserCallback ( fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec,
EOprtAssociativity a_eOprtAsct ) Q_DECL_NOEXCEPT EOprtAssociativity a_eOprtAsct )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( a_iPrec ), m_eOprtAsct ( a_eOprtAsct ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( a_iPrec ), m_eOprtAsct ( a_eOprtAsct ),
m_iCode ( cmOPRT_BIN ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmOPRT_BIN ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -84,7 +83,7 @@ QmuParserCallback::QmuParserCallback ( fun_type2 a_pFun, bool a_bAllowOpti, int
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type3 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( fun_type3 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 3 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 3 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -94,7 +93,7 @@ QmuParserCallback::QmuParserCallback ( fun_type3 a_pFun, bool a_bAllowOpti ) Q_D
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type4 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( fun_type4 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 4 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 4 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -104,7 +103,7 @@ QmuParserCallback::QmuParserCallback ( fun_type4 a_pFun, bool a_bAllowOpti ) Q_D
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type5 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( fun_type5 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 5 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 5 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -113,7 +112,7 @@ QmuParserCallback::QmuParserCallback ( fun_type5 a_pFun, bool a_bAllowOpti ) Q_D
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type6 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( fun_type6 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 6 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 6 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -122,7 +121,7 @@ QmuParserCallback::QmuParserCallback ( fun_type6 a_pFun, bool a_bAllowOpti ) Q_D
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type7 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( fun_type7 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 7 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 7 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -131,7 +130,7 @@ QmuParserCallback::QmuParserCallback ( fun_type7 a_pFun, bool a_bAllowOpti ) Q_D
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type8 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( fun_type8 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 8 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 8 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -140,7 +139,7 @@ QmuParserCallback::QmuParserCallback ( fun_type8 a_pFun, bool a_bAllowOpti ) Q_D
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type9 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( fun_type9 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 9 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 9 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -149,7 +148,7 @@ QmuParserCallback::QmuParserCallback ( fun_type9 a_pFun, bool a_bAllowOpti ) Q_D
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( fun_type10 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( fun_type10 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 10 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 10 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -158,7 +157,7 @@ QmuParserCallback::QmuParserCallback ( fun_type10 a_pFun, bool a_bAllowOpti ) Q_
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type0 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type0 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -167,7 +166,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type0 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type1 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type1 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 1 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 1 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -180,7 +179,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type1 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type2 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type2 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -189,7 +188,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type2 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type3 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type3 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 3 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 3 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -198,7 +197,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type3 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type4 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type4 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 4 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 4 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -207,7 +206,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type4 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type5 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type5 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 5 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 5 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -216,7 +215,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type5 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type6 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type6 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 6 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 6 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -225,7 +224,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type6 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type7 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type7 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 7 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 7 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -234,7 +233,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type7 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type8 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type8 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 8 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 8 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -243,7 +242,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type8 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type9 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type9 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 9 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 9 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -252,7 +251,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type9 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( bulkfun_type10 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( bulkfun_type10 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 10 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 10 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_BULK ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -261,7 +260,7 @@ QmuParserCallback::QmuParserCallback ( bulkfun_type10 a_pFun, bool a_bAllowOpti
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( multfun_type a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( multfun_type a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( -1 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( -1 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC ), m_iType ( tpDBL ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -270,7 +269,7 @@ QmuParserCallback::QmuParserCallback ( multfun_type a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( strfun_type1 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( strfun_type1 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_STR ), m_iType ( tpSTR ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_STR ), m_iType ( tpSTR ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -279,7 +278,7 @@ QmuParserCallback::QmuParserCallback ( strfun_type1 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( strfun_type2 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( strfun_type2 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 1 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 1 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_STR ), m_iType ( tpSTR ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_STR ), m_iType ( tpSTR ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -288,7 +287,7 @@ QmuParserCallback::QmuParserCallback ( strfun_type2 a_pFun, bool a_bAllowOpti )
#ifdef __GNUC__ #ifdef __GNUC__
__extension__ __extension__
#endif #endif
QmuParserCallback::QmuParserCallback ( strfun_type3 a_pFun, bool a_bAllowOpti ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( strfun_type3 a_pFun, bool a_bAllowOpti )
: m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), : m_pFun ( reinterpret_cast<void*> ( a_pFun ) ), m_iArgc ( 2 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ),
m_iCode ( cmFUNC_STR ), m_iType ( tpSTR ), m_bAllowOpti ( a_bAllowOpti ) m_iCode ( cmFUNC_STR ), m_iType ( tpSTR ), m_bAllowOpti ( a_bAllowOpti )
{} {}
@ -298,7 +297,7 @@ QmuParserCallback::QmuParserCallback ( strfun_type3 a_pFun, bool a_bAllowOpti )
* @brief Default constructor. * @brief Default constructor.
* @throw nothrow * @throw nothrow
*/ */
QmuParserCallback::QmuParserCallback() Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback()
: m_pFun ( 0 ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), m_iCode ( cmUNKNOWN ), m_iType ( tpVOID ), : m_pFun ( 0 ), m_iArgc ( 0 ), m_iPri ( -1 ), m_eOprtAsct ( oaNONE ), m_iCode ( cmUNKNOWN ), m_iType ( tpVOID ),
m_bAllowOpti ( 0 ) m_bAllowOpti ( 0 )
{} {}
@ -308,7 +307,7 @@ QmuParserCallback::QmuParserCallback() Q_DECL_NOEXCEPT
* @brief Copy constructor. * @brief Copy constructor.
* @throw nothrow * @throw nothrow
*/ */
QmuParserCallback::QmuParserCallback ( const QmuParserCallback &ref ) Q_DECL_NOEXCEPT QmuParserCallback::QmuParserCallback ( const QmuParserCallback &ref )
: m_pFun ( ref.m_pFun ), m_iArgc ( ref.m_iArgc ), m_iPri ( ref.m_iPri ), m_eOprtAsct ( ref.m_eOprtAsct ), : m_pFun ( ref.m_pFun ), m_iArgc ( ref.m_iArgc ), m_iPri ( ref.m_iPri ), m_eOprtAsct ( ref.m_eOprtAsct ),
m_iCode ( ref.m_iCode ), m_iType ( ref.m_iType ), m_bAllowOpti ( ref.m_bAllowOpti ) m_iCode ( ref.m_iCode ), m_iType ( ref.m_iType ), m_bAllowOpti ( ref.m_bAllowOpti )
{ {

View File

@ -46,47 +46,47 @@ namespace qmu
class QmuParserCallback class QmuParserCallback
{ {
public: public:
QmuParserCallback(fun_type0 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type0 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec = -1, ECmdCode a_iCode=cmFUNC);
QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eAssociativity) QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti, int a_iPrec, EOprtAssociativity a_eAssociativity)
Q_DECL_NOEXCEPT; ;
QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type2 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type3 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type3 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type4 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type4 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type5 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type5 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type6 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type6 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type7 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type7 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type8 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type8 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type9 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type9 a_pFun, bool a_bAllowOpti);
QmuParserCallback(fun_type10 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(fun_type10 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type0 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type0 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type1 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type1 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type2 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type2 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type3 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type3 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type4 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type4 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type5 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type5 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type6 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type6 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type7 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type7 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type8 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type8 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type9 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type9 a_pFun, bool a_bAllowOpti);
QmuParserCallback(bulkfun_type10 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(bulkfun_type10 a_pFun, bool a_bAllowOpti);
QmuParserCallback(multfun_type a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(multfun_type a_pFun, bool a_bAllowOpti);
QmuParserCallback(strfun_type1 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(strfun_type1 a_pFun, bool a_bAllowOpti);
QmuParserCallback(strfun_type2 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(strfun_type2 a_pFun, bool a_bAllowOpti);
QmuParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti) Q_DECL_NOEXCEPT; QmuParserCallback(strfun_type3 a_pFun, bool a_bAllowOpti);
QmuParserCallback() Q_DECL_NOEXCEPT; QmuParserCallback();
QmuParserCallback(const QmuParserCallback &a_Fun) Q_DECL_NOEXCEPT; QmuParserCallback(const QmuParserCallback &a_Fun);
QmuParserCallback* Clone() const; QmuParserCallback* Clone() const;
bool IsOptimizable() const Q_DECL_NOEXCEPT; bool IsOptimizable() const;
void* GetAddr() const Q_DECL_NOEXCEPT; void* GetAddr() const;
ECmdCode GetCode() const Q_DECL_NOEXCEPT; ECmdCode GetCode() const;
ETypeCode GetType() const Q_DECL_NOEXCEPT; ETypeCode GetType() const;
int GetPri() const Q_DECL_NOEXCEPT; int GetPri() const;
EOprtAssociativity GetAssociativity() const Q_DECL_NOEXCEPT; EOprtAssociativity GetAssociativity() const;
int GetArgc() const Q_DECL_NOEXCEPT; int GetArgc() const;
private: private:
void *m_pFun; ///< Pointer to the callback function, casted to void void *m_pFun; ///< Pointer to the callback function, casted to void
@ -127,7 +127,7 @@ inline QmuParserCallback* QmuParserCallback::Clone() const
* @throw nothrow * @throw nothrow
*/ */
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
inline bool QmuParserCallback::IsOptimizable() const Q_DECL_NOEXCEPT inline bool QmuParserCallback::IsOptimizable() const
{ {
return m_bAllowOpti; return m_bAllowOpti;
} }
@ -141,7 +141,7 @@ inline bool QmuParserCallback::IsOptimizable() const Q_DECL_NOEXCEPT
* @throw nothrow * @throw nothrow
* @return #pFun * @return #pFun
*/ */
inline void* QmuParserCallback::GetAddr() const Q_DECL_NOEXCEPT inline void* QmuParserCallback::GetAddr() const
{ {
return m_pFun; return m_pFun;
} }
@ -150,13 +150,13 @@ inline void* QmuParserCallback::GetAddr() const Q_DECL_NOEXCEPT
/** /**
* @brief Return the callback code. * @brief Return the callback code.
*/ */
inline ECmdCode QmuParserCallback::GetCode() const Q_DECL_NOEXCEPT inline ECmdCode QmuParserCallback::GetCode() const
{ {
return m_iCode; return m_iCode;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
inline ETypeCode QmuParserCallback::GetType() const Q_DECL_NOEXCEPT inline ETypeCode QmuParserCallback::GetType() const
{ {
return m_iType; return m_iType;
} }
@ -168,7 +168,7 @@ inline ETypeCode QmuParserCallback::GetType() const Q_DECL_NOEXCEPT
* *
* Only valid if the callback token is an operator token (binary or infix). * Only valid if the callback token is an operator token (binary or infix).
*/ */
inline int QmuParserCallback::GetPri() const Q_DECL_NOEXCEPT inline int QmuParserCallback::GetPri() const
{ {
return m_iPri; return m_iPri;
} }
@ -180,7 +180,7 @@ inline int QmuParserCallback::GetPri() const Q_DECL_NOEXCEPT
* *
* Only valid if the callback token is a binary operator token. * Only valid if the callback token is a binary operator token.
*/ */
inline EOprtAssociativity QmuParserCallback::GetAssociativity() const Q_DECL_NOEXCEPT inline EOprtAssociativity QmuParserCallback::GetAssociativity() const
{ {
return m_eOprtAsct; return m_eOprtAsct;
} }
@ -189,7 +189,7 @@ inline EOprtAssociativity QmuParserCallback::GetAssociativity() const Q_DECL_NOE
/** /**
* @brief Returns the number of function Arguments. * @brief Returns the number of function Arguments.
*/ */
inline int QmuParserCallback::GetArgc() const Q_DECL_NOEXCEPT inline int QmuParserCallback::GetArgc() const
{ {
return m_iArgc; return m_iArgc;
} }

View File

@ -46,13 +46,8 @@
*/ */
//#define QMUP_USE_OPENMP //#define QMUP_USE_OPENMP
#if defined(_UNICODE) /** @brief Definition of the basic parser string type. */
/** @brief Definition of the basic parser string type. */ #define QMUP_STRING_TYPE std::wstring
#define QMUP_STRING_TYPE std::wstring
#else
/** @brief Definition of the basic parser string type. */
#define QMUP_STRING_TYPE std::string
#endif
namespace qmu namespace qmu
{ {

View File

@ -100,7 +100,7 @@ public:
QmuParserErrorMsg(); QmuParserErrorMsg();
~QmuParserErrorMsg(); ~QmuParserErrorMsg();
static const QmuParserErrorMsg& Instance() Q_DECL_NOEXCEPT; static const QmuParserErrorMsg& Instance();
QString operator[] ( unsigned a_iIdx ) const; QString operator[] ( unsigned a_iIdx ) const;
private: private:
@ -111,7 +111,7 @@ private:
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction // cppcheck-suppress unusedFunction
inline const QmuParserErrorMsg& QmuParserErrorMsg::Instance() Q_DECL_NOEXCEPT inline const QmuParserErrorMsg& QmuParserErrorMsg::Instance()
{ {
return m_Instance; return m_Instance;
} }
@ -141,12 +141,12 @@ public:
QmuParserError& operator= ( const QmuParserError &a_Obj ); QmuParserError& operator= ( const QmuParserError &a_Obj );
virtual ~QmuParserError() noexcept (true){} virtual ~QmuParserError() noexcept (true){}
void SetFormula ( const QString &a_strFormula ) Q_DECL_NOEXCEPT; void SetFormula ( const QString &a_strFormula );
const QString& GetExpr() const Q_DECL_NOEXCEPT; const QString& GetExpr() const;
const QString& GetMsg() const Q_DECL_NOEXCEPT; const QString& GetMsg() const;
int GetPos() const Q_DECL_NOEXCEPT; int GetPos() const;
const QString& GetToken() const Q_DECL_NOEXCEPT; const QString& GetToken() const;
EErrorCodes GetCode() const Q_DECL_NOEXCEPT; EErrorCodes GetCode() const;
virtual void raise() const; virtual void raise() const;
virtual QmuParserError *clone() const; virtual QmuParserError *clone() const;
private: private:
@ -186,7 +186,7 @@ inline QmuParserError *QmuParserError::clone() const
/** /**
* @brief Set the expression related to this error. * @brief Set the expression related to this error.
*/ */
inline void QmuParserError::SetFormula ( const QString &a_strFormula ) Q_DECL_NOEXCEPT inline void QmuParserError::SetFormula ( const QString &a_strFormula )
{ {
m_sExpr = a_strFormula; m_sExpr = a_strFormula;
} }
@ -195,7 +195,7 @@ inline void QmuParserError::SetFormula ( const QString &a_strFormula ) Q_DECL_NO
/** /**
* @brief gets the expression related tp this error. * @brief gets the expression related tp this error.
*/ */
inline const QString& QmuParserError::GetExpr() const Q_DECL_NOEXCEPT inline const QString& QmuParserError::GetExpr() const
{ {
return m_sExpr; return m_sExpr;
} }
@ -204,7 +204,7 @@ inline const QString& QmuParserError::GetExpr() const Q_DECL_NOEXCEPT
/** /**
* @brief Returns the message string for this error. * @brief Returns the message string for this error.
*/ */
inline const QString& QmuParserError::GetMsg() const Q_DECL_NOEXCEPT inline const QString& QmuParserError::GetMsg() const
{ {
return m_sMsg; return m_sMsg;
} }
@ -215,7 +215,7 @@ inline const QString& QmuParserError::GetMsg() const Q_DECL_NOEXCEPT
* *
* If the error is not related to a distinct position this will return -1 * If the error is not related to a distinct position this will return -1
*/ */
inline int QmuParserError::GetPos() const Q_DECL_NOEXCEPT inline int QmuParserError::GetPos() const
{ {
return m_iPos; return m_iPos;
} }
@ -224,7 +224,7 @@ inline int QmuParserError::GetPos() const Q_DECL_NOEXCEPT
/** /**
* @brief Return string related with this token (if available). * @brief Return string related with this token (if available).
*/ */
inline const QString& QmuParserError::GetToken() const Q_DECL_NOEXCEPT inline const QString& QmuParserError::GetToken() const
{ {
return m_sTok; return m_sTok;
} }
@ -233,7 +233,7 @@ inline const QString& QmuParserError::GetToken() const Q_DECL_NOEXCEPT
/** /**
* @brief Return the error code. * @brief Return the error code.
*/ */
inline EErrorCodes QmuParserError::GetCode() const Q_DECL_NOEXCEPT inline EErrorCodes QmuParserError::GetCode() const
{ {
return m_iErrc; return m_iErrc;
} }

View File

@ -69,11 +69,7 @@ int QmuParserTester::IsHexVal ( const QString &a_szExpr, int *a_iPos, qreal *a_f
unsigned iVal ( 0 ); unsigned iVal ( 0 );
#if defined(_UNICODE)
std::wstring a_szExprStd = a_szExpr.mid(2).toStdWString(); std::wstring a_szExprStd = a_szExpr.mid(2).toStdWString();
#else
std::string a_szExprStd = a_szExpr.mid(2).toStdString();
#endif
// New code based on streams for UNICODE compliance: // New code based on streams for UNICODE compliance:
stringstream_type::pos_type nPos(0); stringstream_type::pos_type nPos(0);

View File

@ -270,7 +270,7 @@ public:
* @return #m_iType * @return #m_iType
* @throw nothrow * @throw nothrow
*/ */
ECmdCode GetCode() const Q_DECL_NOEXCEPT ECmdCode GetCode() const
{ {
if ( m_pCallback.get() ) if ( m_pCallback.get() )
{ {
@ -442,7 +442,7 @@ public:
* @throw nothrow * @throw nothrow
* @sa m_strTok * @sa m_strTok
*/ */
const TString& GetAsString() const Q_DECL_NOEXCEPT const TString& GetAsString() const
{ {
return m_strTok; return m_strTok;
} }

View File

@ -43,7 +43,7 @@ class QmuParserBase;
* @sa Assign * @sa Assign
* @throw nothrow * @throw nothrow
*/ */
QmuParserTokenReader::QmuParserTokenReader ( const QmuParserTokenReader &a_Reader ) Q_DECL_NOEXCEPT QmuParserTokenReader::QmuParserTokenReader ( const QmuParserTokenReader &a_Reader )
:m_pParser( a_Reader.m_pParser ), m_strFormula( a_Reader.m_strFormula ), m_iPos( a_Reader.m_iPos ), :m_pParser( a_Reader.m_pParser ), m_strFormula( a_Reader.m_strFormula ), m_iPos( a_Reader.m_iPos ),
m_iSynFlags( a_Reader.m_iSynFlags ), m_bIgnoreUndefVar( a_Reader.m_bIgnoreUndefVar ), m_iSynFlags( a_Reader.m_iSynFlags ), m_bIgnoreUndefVar( a_Reader.m_bIgnoreUndefVar ),
m_pFunDef( a_Reader.m_pFunDef ), m_pPostOprtDef( a_Reader.m_pPostOprtDef ), m_pFunDef( a_Reader.m_pFunDef ), m_pPostOprtDef( a_Reader.m_pPostOprtDef ),
@ -63,7 +63,7 @@ QmuParserTokenReader::QmuParserTokenReader ( const QmuParserTokenReader &a_Reade
* @param a_Reader Object to copy to this token reader. * @param a_Reader Object to copy to this token reader.
* @throw nothrow * @throw nothrow
*/ */
QmuParserTokenReader& QmuParserTokenReader::operator= ( const QmuParserTokenReader &a_Reader ) Q_DECL_NOEXCEPT QmuParserTokenReader& QmuParserTokenReader::operator= ( const QmuParserTokenReader &a_Reader )
{ {
if ( &a_Reader != this ) if ( &a_Reader != this )
{ {
@ -80,7 +80,7 @@ QmuParserTokenReader& QmuParserTokenReader::operator= ( const QmuParserTokenRead
* @param a_Reader Object from which the state should be copied. * @param a_Reader Object from which the state should be copied.
* @throw nothrow * @throw nothrow
*/ */
void QmuParserTokenReader::Assign ( const QmuParserTokenReader &a_Reader ) Q_DECL_NOEXCEPT void QmuParserTokenReader::Assign ( const QmuParserTokenReader &a_Reader )
{ {
m_pParser = a_Reader.m_pParser; m_pParser = a_Reader.m_pParser;
m_strFormula = a_Reader.m_strFormula; m_strFormula = a_Reader.m_strFormula;
@ -116,7 +116,7 @@ void QmuParserTokenReader::Assign ( const QmuParserTokenReader &a_Reader ) Q_DEC
* @post #m_pParser==a_pParser * @post #m_pParser==a_pParser
* @param a_pParent Parent parser object of the token reader. * @param a_pParent Parent parser object of the token reader.
*/ */
QmuParserTokenReader::QmuParserTokenReader ( QmuParserBase *a_pParent ) Q_DECL_NOEXCEPT QmuParserTokenReader::QmuParserTokenReader ( QmuParserBase *a_pParent )
: m_pParser ( a_pParent ), m_strFormula(), m_iPos ( 0 ), m_iSynFlags ( 0 ), m_bIgnoreUndefVar ( false ), : m_pParser ( a_pParent ), m_strFormula(), m_iPos ( 0 ), m_iSynFlags ( 0 ), m_bIgnoreUndefVar ( false ),
m_pFunDef ( nullptr ), m_pPostOprtDef ( nullptr ), m_pInfixOprtDef ( nullptr ), m_pOprtDef ( nullptr ), m_pFunDef ( nullptr ), m_pPostOprtDef ( nullptr ), m_pInfixOprtDef ( nullptr ), m_pOprtDef ( nullptr ),
m_pConstDef ( nullptr ), m_pStrVarDef ( nullptr ), m_pVarDef ( nullptr ), m_pFactory ( nullptr ), m_pConstDef ( nullptr ), m_pStrVarDef ( nullptr ), m_pVarDef ( nullptr ), m_pFactory ( nullptr ),
@ -136,7 +136,7 @@ QmuParserTokenReader::QmuParserTokenReader ( QmuParserBase *a_pParent ) Q_DECL_N
* @return A new QParserTokenReader object. * @return A new QParserTokenReader object.
* @throw nothrow * @throw nothrow
*/ */
QmuParserTokenReader* QmuParserTokenReader::Clone ( QmuParserBase *a_pParent ) const Q_DECL_NOEXCEPT QmuParserTokenReader* QmuParserTokenReader::Clone ( QmuParserBase *a_pParent ) const
{ {
std::unique_ptr<QmuParserTokenReader> ptr ( new QmuParserTokenReader ( *this ) ); std::unique_ptr<QmuParserTokenReader> ptr ( new QmuParserTokenReader ( *this ) );
ptr->SetParent ( a_pParent ); ptr->SetParent ( a_pParent );
@ -144,7 +144,7 @@ QmuParserTokenReader* QmuParserTokenReader::Clone ( QmuParserBase *a_pParent ) c
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
QmuParserTokenReader::token_type& QmuParserTokenReader::SaveBeforeReturn ( const token_type &tok ) Q_DECL_NOEXCEPT QmuParserTokenReader::token_type& QmuParserTokenReader::SaveBeforeReturn ( const token_type &tok )
{ {
m_lastTok = tok; m_lastTok = tok;
return m_lastTok; return m_lastTok;
@ -163,7 +163,7 @@ void QmuParserTokenReader::AddValIdent ( identfun_type a_pCallback )
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void QmuParserTokenReader::SetVarCreator ( facfun_type a_pFactory, void *pUserData ) Q_DECL_NOEXCEPT void QmuParserTokenReader::SetVarCreator ( facfun_type a_pFactory, void *pUserData )
{ {
m_pFactory = a_pFactory; m_pFactory = a_pFactory;
m_pFactoryData = pUserData; m_pFactoryData = pUserData;
@ -176,7 +176,7 @@ void QmuParserTokenReader::SetVarCreator ( facfun_type a_pFactory, void *pUserDa
* Sets the formula position index to zero and set Syntax flags to default for initial formula parsing. * Sets the formula position index to zero and set Syntax flags to default for initial formula parsing.
* @pre [assert] triggered if a_szFormula==0 * @pre [assert] triggered if a_szFormula==0
*/ */
void QmuParserTokenReader::SetFormula ( const QString &a_strFormula ) Q_DECL_NOEXCEPT void QmuParserTokenReader::SetFormula ( const QString &a_strFormula )
{ {
m_strFormula = a_strFormula; m_strFormula = a_strFormula;
ReInit(); ReInit();
@ -191,7 +191,7 @@ void QmuParserTokenReader::SetFormula ( const QString &a_strFormula ) Q_DECL_NOE
* @throw nothrow * @throw nothrow
* @sa ESynCodes * @sa ESynCodes
*/ */
void QmuParserTokenReader::ReInit() Q_DECL_NOEXCEPT void QmuParserTokenReader::ReInit()
{ {
m_iPos = 0; m_iPos = 0;
m_iSynFlags = sfSTART_OF_LINE; m_iSynFlags = sfSTART_OF_LINE;
@ -289,7 +289,7 @@ QmuParserTokenReader::token_type QmuParserTokenReader::ReadNextToken()
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void QmuParserTokenReader::SetParent ( QmuParserBase *a_pParent ) Q_DECL_NOEXCEPT void QmuParserTokenReader::SetParent ( QmuParserBase *a_pParent )
{ {
m_pParser = a_pParent; m_pParser = a_pParent;
m_pFunDef = &a_pParent->m_FunDef; m_pFunDef = &a_pParent->m_FunDef;
@ -311,15 +311,10 @@ void QmuParserTokenReader::SetParent ( QmuParserBase *a_pParent ) Q_DECL_NOEXCEP
* @return The Position of the first character not listed in a_szCharSet. * @return The Position of the first character not listed in a_szCharSet.
* @throw nothrow * @throw nothrow
*/ */
int QmuParserTokenReader::ExtractToken ( const QString &a_szCharSet, QString &a_sTok, int a_iPos ) const Q_DECL_NOEXCEPT int QmuParserTokenReader::ExtractToken ( const QString &a_szCharSet, QString &a_sTok, int a_iPos ) const
{ {
#if defined(_UNICODE)
const std::wstring m_strFormulaStd = m_strFormula.toStdWString(); const std::wstring m_strFormulaStd = m_strFormula.toStdWString();
const std::wstring a_szCharSetStd = a_szCharSet.toStdWString(); const std::wstring a_szCharSetStd = a_szCharSet.toStdWString();
#else
const std::string m_strFormulaStd = m_strFormula.toStdString();
const std::string a_szCharSetStd = a_szCharSet.toStdString();
#endif
int iEnd = static_cast<int>(m_strFormulaStd.find_first_not_of ( a_szCharSetStd, a_iPos )); int iEnd = static_cast<int>(m_strFormulaStd.find_first_not_of ( a_szCharSetStd, a_iPos ));
@ -331,13 +326,8 @@ int QmuParserTokenReader::ExtractToken ( const QString &a_szCharSet, QString &a_
// Assign token string if there was something found // Assign token string if there was something found
if ( a_iPos != iEnd ) if ( a_iPos != iEnd )
{ {
#if defined(_UNICODE)
a_sTok = QString().fromStdWString ( std::wstring ( m_strFormulaStd.begin() + a_iPos, a_sTok = QString().fromStdWString ( std::wstring ( m_strFormulaStd.begin() + a_iPos,
m_strFormulaStd.begin() + iEnd ) ); m_strFormulaStd.begin() + iEnd ) );
#else
a_sTok = QString().fromStdString ( std::string ( m_strFormulaStd.begin() + a_iPos,
m_strFormulaStd.begin() + iEnd ) );
#endif
} }
return iEnd; return iEnd;
@ -353,13 +343,9 @@ int QmuParserTokenReader::ExtractToken ( const QString &a_szCharSet, QString &a_
*/ */
int QmuParserTokenReader::ExtractOperatorToken ( QString &a_sTok, int a_iPos ) const int QmuParserTokenReader::ExtractOperatorToken ( QString &a_sTok, int a_iPos ) const
{ {
#if defined(_UNICODE)
const std::wstring m_strFormulaStd = m_strFormula.toStdWString(); const std::wstring m_strFormulaStd = m_strFormula.toStdWString();
const std::wstring oprtCharsStd = m_pParser->ValidInfixOprtChars().toStdWString(); const std::wstring oprtCharsStd = m_pParser->ValidInfixOprtChars().toStdWString();
#else
const std::string m_strFormulaStd = m_strFormula.toStdString();
const std::string oprtCharsStd = m_pParser->ValidInfixOprtChars().toStdString();
#endif
int iEnd = static_cast<int>( m_strFormulaStd.find_first_not_of ( oprtCharsStd, a_iPos ) ); int iEnd = static_cast<int>( m_strFormulaStd.find_first_not_of ( oprtCharsStd, a_iPos ) );
if ( iEnd == static_cast<int>( string_type::npos ) ) if ( iEnd == static_cast<int>( string_type::npos ) )
{ {
@ -369,13 +355,8 @@ int QmuParserTokenReader::ExtractOperatorToken ( QString &a_sTok, int a_iPos ) c
// Assign token string if there was something found // Assign token string if there was something found
if ( a_iPos != iEnd ) if ( a_iPos != iEnd )
{ {
#if defined(_UNICODE)
a_sTok = QString().fromStdWString ( string_type ( m_strFormulaStd.begin() + a_iPos, a_sTok = QString().fromStdWString ( string_type ( m_strFormulaStd.begin() + a_iPos,
m_strFormulaStd.begin() + iEnd ) ); m_strFormulaStd.begin() + iEnd ) );
#else
a_sTok = QString().fromStdString ( string_type ( m_strFormulaStd.begin() + a_iPos,
m_strFormulaStd.begin() + iEnd ) );
#endif
return iEnd; return iEnd;
} }
else else
@ -549,12 +530,6 @@ bool QmuParserTokenReader::IsArgSep ( token_type &a_Tok )
*/ */
bool QmuParserTokenReader::IsEOF ( token_type &a_Tok ) bool QmuParserTokenReader::IsEOF ( token_type &a_Tok )
{ {
//#if defined(_UNICODE)
// const char_type* szFormula = m_strFormula.toStdWString().c_str();
//#else
// const char_type* szFormula = m_strFormula.toStdString().c_str();
//#endif
// check for EOF // check for EOF
if ( m_strFormula.data()[m_iPos] == false /*|| szFormula[m_iPos] == '\n'*/ ) if ( m_strFormula.data()[m_iPos] == false /*|| szFormula[m_iPos] == '\n'*/ )
{ {
@ -848,8 +823,7 @@ bool QmuParserTokenReader::IsValTok ( token_type &a_Tok )
if ( ( *item ) ( m_strFormula.mid ( m_iPos ), &m_iPos, &fVal ) == 1 ) if ( ( *item ) ( m_strFormula.mid ( m_iPos ), &m_iPos, &fVal ) == 1 )
{ {
// 2013-11-27 Issue 2: https://code.google.com/p/muparser/issues/detail?id=2 // 2013-11-27 Issue 2: https://code.google.com/p/muparser/issues/detail?id=2
//strTok = m_strFormula.mid ( iStart, m_iPos-iStart ); strTok = m_strFormula.mid ( iStart, m_iPos-iStart );
strTok = m_strFormula.mid ( iStart, m_iPos );
if ( m_iSynFlags & noVAL ) if ( m_iSynFlags & noVAL )
{ {
Error ( ecUNEXPECTED_VAL, m_iPos - strTok.length(), strTok ); Error ( ecUNEXPECTED_VAL, m_iPos - strTok.length(), strTok );
@ -955,7 +929,7 @@ bool QmuParserTokenReader::IsStrVarTok ( token_type &a_Tok )
* @return true if a variable token has been found. * @return true if a variable token has been found.
* @throw nothrow * @throw nothrow
*/ */
bool QmuParserTokenReader::IsUndefVarTok ( token_type &a_Tok ) Q_DECL_NOEXCEPT bool QmuParserTokenReader::IsUndefVarTok ( token_type &a_Tok )
{ {
QString strTok; QString strTok;
int iEnd ( ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos ) ); int iEnd ( ExtractToken ( m_pParser->ValidNameChars(), strTok, m_iPos ) );

View File

@ -45,19 +45,19 @@ class QmuParserTokenReader
private: private:
typedef QmuParserToken<qreal, QString> token_type; typedef QmuParserToken<qreal, QString> token_type;
public: public:
QmuParserTokenReader(QmuParserBase *a_pParent) Q_DECL_NOEXCEPT; QmuParserTokenReader(QmuParserBase *a_pParent);
QmuParserTokenReader* Clone(QmuParserBase *a_pParent) const Q_DECL_NOEXCEPT; QmuParserTokenReader* Clone(QmuParserBase *a_pParent) const;
void AddValIdent(identfun_type a_pCallback); void AddValIdent(identfun_type a_pCallback);
void SetVarCreator(facfun_type a_pFactory, void *pUserData) Q_DECL_NOEXCEPT; void SetVarCreator(facfun_type a_pFactory, void *pUserData);
void SetFormula(const QString &a_strFormula) Q_DECL_NOEXCEPT; void SetFormula(const QString &a_strFormula);
void SetArgSep(char_type cArgSep) Q_DECL_NOEXCEPT; void SetArgSep(char_type cArgSep);
int GetPos() const Q_DECL_NOEXCEPT; int GetPos() const;
const QString& GetExpr() const Q_DECL_NOEXCEPT; const QString& GetExpr() const;
varmap_type& GetUsedVar() Q_DECL_NOEXCEPT; varmap_type& GetUsedVar();
QChar GetArgSep() const Q_DECL_NOEXCEPT; QChar GetArgSep() const;
void IgnoreUndefVar(bool bIgnore) Q_DECL_NOEXCEPT; void IgnoreUndefVar(bool bIgnore);
void ReInit() Q_DECL_NOEXCEPT; void ReInit();
token_type ReadNextToken(); token_type ReadNextToken();
private: private:
@ -88,12 +88,12 @@ private:
noANY = ~0 ///< All of he above flags set noANY = ~0 ///< All of he above flags set
}; };
QmuParserTokenReader(const QmuParserTokenReader &a_Reader) Q_DECL_NOEXCEPT; QmuParserTokenReader(const QmuParserTokenReader &a_Reader);
QmuParserTokenReader& operator=(const QmuParserTokenReader &a_Reader) Q_DECL_NOEXCEPT; QmuParserTokenReader& operator=(const QmuParserTokenReader &a_Reader);
void Assign(const QmuParserTokenReader &a_Reader) Q_DECL_NOEXCEPT; void Assign(const QmuParserTokenReader &a_Reader);
void SetParent(QmuParserBase *a_pParent) Q_DECL_NOEXCEPT; void SetParent(QmuParserBase *a_pParent);
int ExtractToken(const QString &a_szCharSet, QString &a_strTok, int a_iPos) const Q_DECL_NOEXCEPT; int ExtractToken(const QString &a_szCharSet, QString &a_strTok, int a_iPos) const;
int ExtractOperatorToken(QString &a_sTok, int a_iPos) const; int ExtractOperatorToken(QString &a_sTok, int a_iPos) const;
bool IsBuiltIn(token_type &a_Tok); bool IsBuiltIn(token_type &a_Tok);
@ -106,11 +106,11 @@ private:
bool IsValTok(token_type &a_Tok); bool IsValTok(token_type &a_Tok);
bool IsVarTok(token_type &a_Tok); bool IsVarTok(token_type &a_Tok);
bool IsStrVarTok(token_type &a_Tok); bool IsStrVarTok(token_type &a_Tok);
bool IsUndefVarTok(token_type &a_Tok) Q_DECL_NOEXCEPT; bool IsUndefVarTok(token_type &a_Tok);
bool IsString(token_type &a_Tok); bool IsString(token_type &a_Tok);
void Q_NORETURN Error(EErrorCodes a_iErrc, int a_iPos = -1, const QString &a_sTok = QString() ) const; void Q_NORETURN Error(EErrorCodes a_iErrc, int a_iPos = -1, const QString &a_sTok = QString() ) const;
token_type& SaveBeforeReturn(const token_type &tok) Q_DECL_NOEXCEPT; token_type& SaveBeforeReturn(const token_type &tok);
QmuParserBase *m_pParser; QmuParserBase *m_pParser;
QString m_strFormula; QString m_strFormula;
@ -142,7 +142,7 @@ private:
* @return #m_iPos * @return #m_iPos
* @throw nothrow * @throw nothrow
*/ */
inline int QmuParserTokenReader::GetPos() const Q_DECL_NOEXCEPT inline int QmuParserTokenReader::GetPos() const
{ {
return m_iPos; return m_iPos;
} }
@ -154,7 +154,7 @@ inline int QmuParserTokenReader::GetPos() const Q_DECL_NOEXCEPT
* @return #m_strFormula * @return #m_strFormula
* @throw nothrow * @throw nothrow
*/ */
inline const QString& QmuParserTokenReader::GetExpr() const Q_DECL_NOEXCEPT inline const QString& QmuParserTokenReader::GetExpr() const
{ {
return m_strFormula; return m_strFormula;
} }
@ -163,7 +163,7 @@ inline const QString& QmuParserTokenReader::GetExpr() const Q_DECL_NOEXCEPT
/** /**
* @brief Return a map containing the used variables only. * @brief Return a map containing the used variables only.
*/ */
inline varmap_type& QmuParserTokenReader::GetUsedVar() Q_DECL_NOEXCEPT inline varmap_type& QmuParserTokenReader::GetUsedVar()
{ {
return m_UsedVar; return m_UsedVar;
} }
@ -177,19 +177,19 @@ inline varmap_type& QmuParserTokenReader::GetUsedVar() Q_DECL_NOEXCEPT
* Those function should return a complete list of variables including * Those function should return a complete list of variables including
* those the are not defined by the time of it's call. * those the are not defined by the time of it's call.
*/ */
inline void QmuParserTokenReader::IgnoreUndefVar ( bool bIgnore ) Q_DECL_NOEXCEPT inline void QmuParserTokenReader::IgnoreUndefVar ( bool bIgnore )
{ {
m_bIgnoreUndefVar = bIgnore; m_bIgnoreUndefVar = bIgnore;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
inline void QmuParserTokenReader::SetArgSep ( char_type cArgSep ) Q_DECL_NOEXCEPT inline void QmuParserTokenReader::SetArgSep ( char_type cArgSep )
{ {
m_cArgSep = cArgSep; m_cArgSep = cArgSep;
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
inline QChar QmuParserTokenReader::GetArgSep() const Q_DECL_NOEXCEPT inline QChar QmuParserTokenReader::GetArgSep() const
{ {
return m_cArgSep; return m_cArgSep;
} }