Try use QString where posible.

--HG--
branch : feature
This commit is contained in:
dismine 2014-04-26 11:16:19 +03:00
parent 9c6cac2ec4
commit 7c1d22c5f4
2 changed files with 25 additions and 12 deletions

View File

@ -435,7 +435,7 @@ void QmuParserBase::SetExpr(const string_type &a_sExpr)
/** \brief Define the set of valid characters to be used in names of
functions, variables, constants.
*/
void QmuParserBase::DefineNameChars(const char_type *a_szCharset)
void QmuParserBase::DefineNameChars(const QString &a_szCharset)
{
m_sNameChars = a_szCharset;
}
@ -444,7 +444,7 @@ void QmuParserBase::SetExpr(const string_type &a_sExpr)
/** \brief Define the set of valid characters to be used in names of
binary operators and postfix operators.
*/
void QmuParserBase::DefineOprtChars(const char_type *a_szCharset)
void QmuParserBase::DefineOprtChars(const QString &a_szCharset)
{
m_sOprtChars = a_szCharset;
}
@ -453,7 +453,7 @@ void QmuParserBase::SetExpr(const string_type &a_sExpr)
/** \brief Define the set of valid characters to be used in names of
infix operators.
*/
void QmuParserBase::DefineInfixOprtChars(const char_type *a_szCharset)
void QmuParserBase::DefineInfixOprtChars(const QString &a_szCharset)
{
m_sInfixOprtChars = a_szCharset;
}
@ -465,7 +465,11 @@ void QmuParserBase::SetExpr(const string_type &a_sExpr)
const char_type* QmuParserBase::ValidNameChars() const
{
assert(m_sNameChars.size());
return m_sNameChars.c_str();
#if defined(_UNICODE)
return m_sNameChars.toStdWString().c_str();
#else
return m_sNameChars.toStdString().c_str();
#endif
}
//---------------------------------------------------------------------------
@ -475,7 +479,11 @@ void QmuParserBase::SetExpr(const string_type &a_sExpr)
const char_type* QmuParserBase::ValidOprtChars() const
{
assert(m_sOprtChars.size());
return m_sOprtChars.c_str();
#if defined(_UNICODE)
return m_sOprtChars.toStdWString().c_str();
#else
return m_sOprtChars.toStdString().c_str();
#endif
}
//---------------------------------------------------------------------------
@ -485,7 +493,11 @@ void QmuParserBase::SetExpr(const string_type &a_sExpr)
const char_type* QmuParserBase::ValidInfixOprtChars() const
{
assert(m_sInfixOprtChars.size());
return m_sInfixOprtChars.c_str();
#if defined(_UNICODE)
return m_sInfixOprtChars.toStdWString().c_str();
#else
return m_sInfixOprtChars.toStdString().c_str();
#endif
}
//---------------------------------------------------------------------------

View File

@ -31,6 +31,7 @@
#include <memory>
#include <locale>
#include <QStack>
#include <QString>
//--- Parser includes --------------------------------------------------------------------------
#include "qmuparserdef.h"
@ -160,9 +161,9 @@ private:
string_type GetVersion(EParserVersionInfo eInfo = pviFULL) const;
const char_type ** GetOprtDef() const;
void DefineNameChars(const char_type *a_szCharset);
void DefineOprtChars(const char_type *a_szCharset);
void DefineInfixOprtChars(const char_type *a_szCharset);
void DefineNameChars(const QString &a_szCharset);
void DefineOprtChars(const QString &a_szCharset);
void DefineInfixOprtChars(const QString &a_szCharset);
const char_type* ValidNameChars() const;
const char_type* ValidOprtChars() const;
@ -285,9 +286,9 @@ private:
bool m_bBuiltInOp; ///< Flag that can be used for switching built in operators on and off
string_type m_sNameChars; ///< Charset for names
string_type m_sOprtChars; ///< Charset for postfix/ binary operator tokens
string_type m_sInfixOprtChars; ///< Charset for infix operator tokens
QString m_sNameChars; ///< Charset for names
QString m_sOprtChars; ///< Charset for postfix/ binary operator tokens
QString m_sInfixOprtChars; ///< Charset for infix operator tokens
mutable int m_nIfElseCounter; ///< Internal counter for keeping track of nested if-then-else clauses