Change NumericEvaluator::clear() to optionally accept an object to clear

This commit is contained in:
Maciej Suminski 2018-02-27 11:40:27 +01:00 committed by jean-pierre charras
parent 0d794b20bb
commit 5f2b8e0409
2 changed files with 5 additions and 3 deletions

View File

@ -96,12 +96,14 @@ NumericEvaluator :: init()
} }
void void
NumericEvaluator :: clear() NumericEvaluator :: clear(const void* pObj)
{ {
free(clToken.token); free(clToken.token);
clToken.token = nullptr; clToken.token = nullptr;
clToken.input = nullptr; clToken.input = nullptr;
bClError = true; bClError = true;
if (bClTextInputStorage && pObj) clObjMap.erase(pObj);
} }
void void

View File

@ -100,10 +100,10 @@ public:
/* Initialization and destruction. init() is invoked be the constructor and should not be needed /* Initialization and destruction. init() is invoked be the constructor and should not be needed
* by the user. * by the user.
* clear() should be invoked by the user if a new input string is to be processed. It will reset * clear() should be invoked by the user if a new input string is to be processed. It will reset
* the parser. User defined variables are retained. * the parser and clear the original expression value for a requested object (if pObj != null).
*/ */
void init(); void init();
void clear(); void clear(const void* pObj = nullptr);
/* Set the decimal separator for the input string. Defaults to '.' */ /* Set the decimal separator for the input string. Defaults to '.' */
void setDecimalSeparator(char sep); void setDecimalSeparator(char sep);