mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-24 23:46:30 +08:00
[muparser] Make ParserTokenReader non-copyable
There's no reason to copy these.
This commit is contained in:
parent
3b1b5b30ca
commit
83799832bc
|
@ -47,15 +47,13 @@ namespace mu {
|
|||
class ParserBase;
|
||||
|
||||
/** \brief Token reader for the ParserBase class.
|
||||
|
||||
*/
|
||||
class ParserTokenReader {
|
||||
class ParserTokenReader final {
|
||||
private:
|
||||
typedef ParserToken<value_type, string_type> 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;
|
||||
|
|
|
@ -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<ParserTokenReader> ptr(new ParserTokenReader(*this));
|
||||
ptr->SetParent(a_pParent);
|
||||
return ptr.release();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
ParserTokenReader::token_type &ParserTokenReader::SaveBeforeReturn(const token_type &tok) {
|
||||
m_lastTok = tok;
|
||||
|
|
Loading…
Reference in New Issue
Block a user