[muparser] Clean up ParserCallback interface

Remove Clone() method and mark some functions as defaulted.
This commit is contained in:
ridiculousfish 2017-11-22 13:40:49 -08:00
parent 9443a4bf2d
commit c4c89dff4e
3 changed files with 3 additions and 17 deletions

View file

@ -46,7 +46,7 @@ namespace mu {
\author (C) 2004-2011 Ingo Berg
*/
class ParserCallback {
class ParserCallback final {
public:
ParserCallback(fun_type0 a_pFun, bool a_bAllowOpti);
ParserCallback(fun_type1 a_pFun, bool a_bAllowOpti, int a_iPrec = -1,
@ -70,8 +70,6 @@ class ParserCallback {
ParserCallback();
ParserCallback(const ParserCallback& a_Fun);
ParserCallback* Clone() const;
bool IsOptimizable() const;
void* GetAddr() const;
ECmdCode GetCode() const;

View file

@ -116,7 +116,7 @@ class ParserToken {
m_iType = a_Tok.m_iType;
m_fVal = a_Tok.m_fVal;
// create new callback object if a_Tok has one
m_pCallback.reset(a_Tok.m_pCallback.get() ? a_Tok.m_pCallback->Clone() : 0);
m_pCallback.reset(a_Tok.m_pCallback ? new ParserCallback(*a_Tok.m_pCallback) : nullptr);
}
//------------------------------------------------------------------------------

View file

@ -214,19 +214,7 @@ ParserCallback::ParserCallback()
//---------------------------------------------------------------------------
/** \brief Copy constructor.
*/
ParserCallback::ParserCallback(const ParserCallback& ref) {
m_pFun = ref.m_pFun;
m_iArgc = ref.m_iArgc;
m_bAllowOpti = ref.m_bAllowOpti;
m_iCode = ref.m_iCode;
m_iType = ref.m_iType;
m_iPri = ref.m_iPri;
m_eOprtAsct = ref.m_eOprtAsct;
}
//---------------------------------------------------------------------------
/** \brief Clone this instance and return a pointer to the new instance. */
ParserCallback* ParserCallback::Clone() const { return new ParserCallback(*this); }
ParserCallback::ParserCallback(const ParserCallback& ref) = default;
//---------------------------------------------------------------------------
/** \brief Return tru if the function is conservative.