MCPcopy Create free account
hub / github.com/LibreCAD/LibreCAD / DefineVar

Method DefineVar

libraries/muparser/src/muParserBase.cpp:617–632  ·  view source on GitHub ↗

--------------------------------------------------------------------------- \brief Add a user defined variable. \param [in] a_sName the variable name \param [in] a_pVar A pointer to the variable value. \post Will reset the Parser to string parsing mode. \throw ParserException in case the name contains invalid signs or a_pVar is nullptr. */

Source from the content-addressed store, hash-verified

615 \throw ParserException in case the name contains invalid signs or a_pVar is nullptr.
616 */
617 void ParserBase::DefineVar(const string_type& a_sName, value_type* a_pVar)
618 {
619 if (a_pVar == 0)
620 Error(ecINVALID_VAR_PTR);
621
622 if (a_sName.length() > MaxLenIdentifier)
623 Error(ecIDENTIFIER_TOO_LONG);
624
625 // Test if a constant with that names already exists
626 if (m_ConstDef.find(a_sName) != m_ConstDef.end())
627 Error(ecNAME_CONFLICT);
628
629 CheckName(a_sName, ValidNameChars());
630 m_VarDef[a_sName] = a_pVar;
631 ReInit();
632 }
633
634 //---------------------------------------------------------------------------
635 /** \brief Add a user defined constant.

Callers 3

muParserDLL.cppFile · 0.80
execCommMethod · 0.80
drawEquationMethod · 0.80

Calls 2

findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected