From 83799832bc3f49a8d7c452cb360af4739ebb43cb Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Wed, 22 Nov 2017 13:54:53 -0800 Subject: [PATCH] [muparser] Make ParserTokenReader non-copyable There's no reason to copy these. --- muparser-2.2.5/include/muParserTokenReader.h | 9 +-- muparser-2.2.5/src/muParserTokenReader.cpp | 66 -------------------- 2 files changed, 3 insertions(+), 72 deletions(-) diff --git a/muparser-2.2.5/include/muParserTokenReader.h b/muparser-2.2.5/include/muParserTokenReader.h index 143069b43..d91766a8b 100644 --- a/muparser-2.2.5/include/muParserTokenReader.h +++ b/muparser-2.2.5/include/muParserTokenReader.h @@ -47,15 +47,13 @@ namespace mu { class ParserBase; /** \brief Token reader for the ParserBase class. - */ -class ParserTokenReader { +class ParserTokenReader final { private: typedef ParserToken token_type; public: ParserTokenReader(ParserBase *a_pParent); - ParserTokenReader *Clone(ParserBase *a_pParent) const; void AddValIdent(identfun_type a_pCallback); void SetVarCreator(facfun_type a_pFactory, void *pUserData); @@ -97,9 +95,8 @@ class ParserTokenReader { noANY = ~0 ///< All of he above flags set }; - ParserTokenReader(const ParserTokenReader &a_Reader); - ParserTokenReader &operator=(const ParserTokenReader &a_Reader); - void Assign(const ParserTokenReader &a_Reader); + ParserTokenReader(const ParserTokenReader &a_Reader) = delete; + ParserTokenReader &operator=(const ParserTokenReader &a_Reader) = delete; void SetParent(ParserBase *a_pParent); int ExtractToken(const char_type *a_szCharSet, string_type &a_strTok, int a_iPos) const; diff --git a/muparser-2.2.5/src/muParserTokenReader.cpp b/muparser-2.2.5/src/muParserTokenReader.cpp index 23af05444..57ead44e3 100644 --- a/muparser-2.2.5/src/muParserTokenReader.cpp +++ b/muparser-2.2.5/src/muParserTokenReader.cpp @@ -38,58 +38,6 @@ namespace mu { -// Forward declaration -class ParserBase; - -//--------------------------------------------------------------------------- -/** \brief Copy constructor. - - \sa Assign -*/ -ParserTokenReader::ParserTokenReader(const ParserTokenReader &a_Reader) { Assign(a_Reader); } - -//--------------------------------------------------------------------------- -/** \brief Assignment operator. - - Self assignment will be suppressed otherwise #Assign is called. - - \param a_Reader Object to copy to this token reader. -*/ -ParserTokenReader &ParserTokenReader::operator=(const ParserTokenReader &a_Reader) { - if (&a_Reader != this) Assign(a_Reader); - - return *this; -} - -//--------------------------------------------------------------------------- -/** \brief Assign state of a token reader to this token reader. - - \param a_Reader Object from which the state should be copied. -*/ -void ParserTokenReader::Assign(const ParserTokenReader &a_Reader) { - 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_UsedVar = a_Reader.m_UsedVar; - m_pFunDef = a_Reader.m_pFunDef; - m_pConstDef = a_Reader.m_pConstDef; - m_pVarDef = a_Reader.m_pVarDef; - m_pStrVarDef = a_Reader.m_pStrVarDef; - m_pPostOprtDef = a_Reader.m_pPostOprtDef; - m_pInfixOprtDef = a_Reader.m_pInfixOprtDef; - m_pOprtDef = a_Reader.m_pOprtDef; - m_bIgnoreUndefVar = a_Reader.m_bIgnoreUndefVar; - m_vIdentFun = a_Reader.m_vIdentFun; - m_pFactory = a_Reader.m_pFactory; - m_pFactoryData = a_Reader.m_pFactoryData; - m_iBrackets = a_Reader.m_iBrackets; - m_cArgSep = a_Reader.m_cArgSep; - m_fZero = a_Reader.m_fZero; - m_lastTok = a_Reader.m_lastTok; -} - //--------------------------------------------------------------------------- /** \brief Constructor. @@ -124,20 +72,6 @@ ParserTokenReader::ParserTokenReader(ParserBase *a_pParent) SetParent(m_pParser); } -//--------------------------------------------------------------------------- -/** \brief Create instance of a ParserTokenReader identical with this - and return its pointer. - - This is a factory method the calling function must take care of the object destruction. - - \return A new ParserTokenReader object. -*/ -ParserTokenReader *ParserTokenReader::Clone(ParserBase *a_pParent) const { - std::auto_ptr ptr(new ParserTokenReader(*this)); - ptr->SetParent(a_pParent); - return ptr.release(); -} - //--------------------------------------------------------------------------- ParserTokenReader::token_type &ParserTokenReader::SaveBeforeReturn(const token_type &tok) { m_lastTok = tok;