Change in name of class EvaluationValue 53/168553/4
authorLukasz Wlazly <l.wlazly@partner.samsung.com>
Mon, 29 Jan 2018 08:18:06 +0000 (09:18 +0100)
committerLukasz Wlazly <l.wlazly@partner.samsung.com>
Tue, 30 Jan 2018 10:04:45 +0000 (11:04 +0100)
Change-Id: I573c53a5f2ca6ee34b08f4e50a20f4146ad0fdda

14 files changed:
src/NavigationInterface.cpp
src/batch/BatchRunner.cpp
src/batch/EvaluationContext.cpp
src/batch/EvaluationContext.hpp
src/batch/EvaluationValue.cpp
src/batch/EvaluationValue.hpp
src/batch/EvaluationValueBase.cpp
src/batch/EvaluationValueBase.hpp
src/batch/EvaluationValueFunction.cpp
src/batch/EvaluationValueVector.cpp
src/batch/EvaluationValueWait.cpp
src/batch/Evaluator.cpp
src/batch/Evaluator.hpp
tests/no-ui-scenarios/BatchExecTests.cpp

index 157c02b..02b08bd 100644 (file)
@@ -108,7 +108,8 @@ public:
                initializeRebuildingContext(true);
        }
 
-       ~NavigationImpl() {
+       ~NavigationImpl()
+       {
                terminate();
        }
 
index ac97017..7d1d063 100644 (file)
@@ -209,7 +209,7 @@ struct TestExecutor : ExecutorInterface {
                Mode mode;
        };
        Monitor<TTSInfo> ttsInfo;
-       std::unordered_map<std::string, EvaluationValue_> variables;
+       std::unordered_map<std::string, EvaluationValue> variables;
        std::ostream &output;
 
        // NOTE: constructor of TestExecutor must be called on main thread
@@ -247,7 +247,7 @@ struct TestExecutor : ExecutorInterface {
                                                           registerCb<NavigationCallbackType::ContextChanged>(std::move(updateContextInfo));
        }
 
-       EvaluationValue_ getVariableByName(const std::string &name) override
+       EvaluationValue getVariableByName(const std::string &name) override
        {
                auto it = variables.find(name);
                if (it != variables.end())
@@ -426,7 +426,7 @@ struct TestExecutor : ExecutorInterface {
 
        void insertMethods()
        {
-               variables["sleep"] = [&](double tm) -> EvaluationValue_ {
+               variables["sleep"] = [&](double tm) -> EvaluationValue {
                        if (tm > 0)
                        {
                                auto sleepTime = std::chrono::milliseconds{ static_cast<int>(std::floor(1000.0 * tm + 0.5)) };
@@ -434,18 +434,18 @@ struct TestExecutor : ExecutorInterface {
                        }
                        return {};
                };
-               variables["print"] = [&](std::string txt) -> EvaluationValue_ {
+               variables["print"] = [&](std::string txt) -> EvaluationValue {
                        output << txt << "\n";
                        return {};
                };
-               variables["get_at_point"] = [&](Point pt) -> EvaluationValue_ {
+               variables["get_at_point"] = [&](Point pt) -> EvaluationValue {
                        return convertToUIElement(pt);
                };
-               variables["assert"] = [&](bool condition) -> EvaluationValue_ {
+               variables["assert"] = [&](bool condition) -> EvaluationValue {
                        if (!condition) throw EvaluationFailure{} << "assertion failed";
                        return {};
                };
-               variables["find_by_name"] = EvaluationValueFunction{ [&](std::string name, std::vector<int> roles, std::vector<int> states) -> EvaluationValue_ {
+               variables["find_by_name"] = EvaluationValueFunction{ [&](std::string name, std::vector<int> roles, std::vector<int> states) -> EvaluationValue {
                                auto root = getVisibleRoot();
                                if (!root) throw EvaluationFailure{} << "no visible root (context changed didn't happen)";
                                ASSERT(root->getObject());
@@ -495,7 +495,7 @@ struct TestExecutor : ExecutorInterface {
                        }
                };
 
-               auto waitTTSImpl = [&](std::string pattern) -> EvaluationValue_ {
+               auto waitTTSImpl = [&](std::string pattern) -> EvaluationValue {
                        std::regex regex;
                        if (!pattern.empty())
                        {
@@ -520,9 +520,9 @@ struct TestExecutor : ExecutorInterface {
                        impl->self = this;
                        impl->untilMoment = std::chrono::high_resolution_clock::now() + 3s;
                        impl->pattern = std::move(pattern);
-                       return EvaluationValue_{ impl };
+                       return EvaluationValue{ impl };
                };
-               variables["tts"] = EvaluationValueFunction{ std::move(waitTTSImpl), { { "pattern", EvaluationValue_{ "" } } } };
+               variables["tts"] = EvaluationValueFunction{ std::move(waitTTSImpl), { { "pattern", EvaluationValue{ "" } } } };
 
                struct WaitGuiImpl : public EvaluationValueWaitInterface {
                        TestExecutor *self;
@@ -553,7 +553,7 @@ struct TestExecutor : ExecutorInterface {
                        }
                };
 
-               auto waitGuiImpl = [&](std::string name) -> EvaluationValue_ {
+               auto waitGuiImpl = [&](std::string name) -> EvaluationValue {
                        auto impl = std::make_shared<WaitGuiImpl>();
                        impl->self = this;
                        impl->untilMoment = std::chrono::high_resolution_clock::now() + 3s;
@@ -564,15 +564,15 @@ struct TestExecutor : ExecutorInterface {
                                impl->currentRootName = h->rootName;
                                impl->searchForAnyChange = true;
                        }
-                       return EvaluationValue_{ impl };
+                       return EvaluationValue{ impl };
                };
-               variables["gui"] = EvaluationValueFunction{ std::move(waitGuiImpl), { { "name", EvaluationValue_{ "" } } } };
+               variables["gui"] = EvaluationValueFunction{ std::move(waitGuiImpl), { { "name", EvaluationValue{ "" } } } };
        }
 
        void insertActivities()
        {
                for (auto activityName : ActivityFactory::getInstance()->getAllActivityTypes()) {
-                       variables[activityName] = [ = ](EvaluationValueFunction::Args args) -> EvaluationValue_ {
+                       variables[activityName] = [ = ](EvaluationValueFunction::Args args) -> EvaluationValue {
                                auto activity = executeOnMainThread([&]()
                                {
                                        return ActivityFactory::getInstance()->createActivity(activityName);
@@ -816,6 +816,65 @@ struct TestExecutor : ExecutorInterface {
        }
 };
 
+void threadFunc(StatPtr result, std::unique_ptr<TestExecutor> exec, std::unique_ptr<std::ostream> outputPtr, Dlog dlog)
+{
+       EvaluationContext ec(*exec);
+       exec->outputStream() << "waiting for context change...\n";
+       auto until = std::chrono::high_resolution_clock::now() + std::chrono::seconds{ 2 };
+       bool hasContext = false;
+       {
+               auto h = exec->contextInfo.lock();
+               hasContext = h.waitForCondition(until, [&]() {
+                       // h->root is pointer to root of visible at-spi hierarchy
+                       // if it's null, then either context building machinery didn't yet finish,
+                       // there's nothing visible to show or something went wrong
+                       // here we wait for it to be non-null (context finished constructing)
+                       // if it timeouts - something went wrong, so we bail out with an error
+                       return bool(h->root);
+               });
+       }
+       if (hasContext) {
+               auto ttsMainRegex = std::regex {
+                       "^D/SCREEN-READER[^>]*?> READ COMMAND PARAMS, TEXT: (.*?), DISCARDABLE: 0",
+                       std::regex_constants::optimize | std::regex_constants::ECMAScript
+               };
+               auto ttsDlogHandler = dlog.registerCallback([&exec, ttsMainRegex = std::move(ttsMainRegex)](const std::string & txt) {
+                       auto h = exec->ttsInfo.lock();
+                       if (h->mode == TestExecutor::TTSInfo::Mode::search) {
+                               if (!h->searchLine) {
+                                       h->mode = TestExecutor::TTSInfo::Mode::found;
+                               } else {
+                                       std::smatch result;
+                                       if (std::regex_search(txt, result, ttsMainRegex)) {
+                                               auto sub = result[1].str();
+                                               if (std::regex_search(sub, *h->searchLine))
+                                                       h->mode = TestExecutor::TTSInfo::Mode::found;
+                                       }
+                               }
+                       }
+               });
+               exec->outputStream() << "evaluation started\n";
+               try {
+                       result->evaluate();
+                       exec->outputStream() << "evaluation successed\n";
+               } catch (EvaluationFailure &e) {
+                       if (e.hasLocation())
+                               exec->outputStream() << e.location().toString() << ": ";
+                       exec->outputStream() << e.message() << "\nevaluation failed\n";
+               } catch (...) {
+                       exec->outputStream() << "unhandled exception\nevaluation failed\n";
+               }
+       } else {
+               exec->outputStream() << "timeouted\n";
+               DEBUG("timeouted, when waiting for context change");
+       }
+       outputPtr->flush();
+       executeOnMainThread([]() {
+               ecore_main_loop_quit();
+       });
+       DEBUG("done batch");
+}
+
 Optional<std::thread> runBatch(const std::array<Optional<std::string>, (size_t)utils::Argument::_count> &arguments)
 {
        const std::string &sourceName = *arguments[static_cast<size_t>(utils::Argument::SourcePath)];
@@ -884,66 +943,5 @@ Optional<std::thread> runBatch(const std::array<Optional<std::string>, (size_t)u
                *outputPtr << os.str() << "\n\n";
        }
        auto exec = std::make_unique<TestExecutor>(*outputPtr);
-       auto threadFunc = [result = std::move(result), exec = std::move(exec), outputPtr = std::move(outputPtr), dlog = std::move(dlog) ]() mutable {
-               EvaluationContext ec(*exec);
-               exec->outputStream() << "waiting for context change...\n";
-               auto until = std::chrono::high_resolution_clock::now() + std::chrono::seconds{ 2 };
-               bool hasContext = false;
-               {
-                       auto h = exec->contextInfo.lock();
-                       hasContext = h.waitForCondition(until, [&]()
-                       {
-                               // h->root is pointer to root of visible at-spi hierarchy
-                               // if it's null, then either context building machinery didn't yet finish,
-                               // there's nothing visible to show or something went wrong
-                               // here we wait for it to be non-null (context finished constructing)
-                               // if it timeouts - something went wrong, so we bail out with an error
-                               return bool(h->root);
-                       });
-               }
-               if (hasContext)
-               {
-                       auto ttsMainRegex = std::regex {
-                               "^D/SCREEN-READER[^>]*?> READ COMMAND PARAMS, TEXT: (.*?), DISCARDABLE: 0",
-                               std::regex_constants::optimize | std::regex_constants::ECMAScript
-                       };
-                       auto ttsDlogHandler = dlog.registerCallback([&exec, ttsMainRegex = std::move(ttsMainRegex)](const std::string & txt) {
-                               auto h = exec->ttsInfo.lock();
-                               if (h->mode == TestExecutor::TTSInfo::Mode::search) {
-                                       if (!h->searchLine) {
-                                               h->mode = TestExecutor::TTSInfo::Mode::found;
-                                       } else {
-                                               std::smatch result;
-                                               if (std::regex_search(txt, result, ttsMainRegex)) {
-                                                       auto sub = result[1].str();
-                                                       if (std::regex_search(sub, *h->searchLine))
-                                                               h->mode = TestExecutor::TTSInfo::Mode::found;
-                                               }
-                                       }
-                               }
-                       });
-                       exec->outputStream() << "evaluation started\n";
-                       try {
-                               result->evaluate();
-                               exec->outputStream() << "evaluation successed\n";
-                       } catch (EvaluationFailure &e) {
-                               if (e.hasLocation())
-                                       exec->outputStream() << e.location().toString() << ": ";
-                               exec->outputStream() << e.message() << "\nevaluation failed\n";
-                       } catch (...) {
-                               exec->outputStream() << "unhandled exception\nevaluation failed\n";
-                       }
-               } else
-               {
-                       exec->outputStream() << "timeouted\n";
-                       DEBUG("timeouted, when waiting for context change");
-               }
-               outputPtr->flush();
-               executeOnMainThread([]()
-               {
-                       ecore_main_loop_quit();
-               });
-               DEBUG("done batch");
-       };
-       return std::thread { std::move(threadFunc) };
+       return std::thread { threadFunc, std::move(result), std::move(exec), std::move(outputPtr), std::move(dlog) };
 }
index 3681cf6..6878307 100644 (file)
@@ -56,12 +56,12 @@ ExecutorInterface &EvaluationContext::executionInterface() const
        return globalContext->executionInterface;
 }
 
-void EvaluationContext::setVariable(const std::string &ident, EvaluationValue_ val)
+void EvaluationContext::setVariable(const std::string &ident, EvaluationValue val)
 {
        variables[ident] = std::move(val);
 }
 
-EvaluationValue_ EvaluationContext::getVariable(const Optional<TokenLocation> &loc, const std::string &ident)
+EvaluationValue EvaluationContext::getVariable(const Optional<TokenLocation> &loc, const std::string &ident)
 {
        EvaluationContext *self = this;
        while (self) {
@@ -97,7 +97,7 @@ std::shared_ptr<UIElement> ExecutorInterface::convertToUIElement(const std::stri
        throw EvaluationFailure{} << "convertToUIElement from String not implemeneted";
 }
 
-EvaluationValue_ ExecutorInterface::getVariableByName(const std::string &name)
+EvaluationValue ExecutorInterface::getVariableByName(const std::string &name)
 {
        throw EvaluationFailure{} << "getVariableByName not implemeneted";
 }
index 23af7a4..4f28e3e 100644 (file)
@@ -49,7 +49,7 @@ struct ExecutorInterface {
         * }
         * will print 1 even if getVariableByName would return different value for foo.
         */
-       virtual EvaluationValue_ getVariableByName(const std::string &name);
+       virtual EvaluationValue getVariableByName(const std::string &name);
 
        /**
         * @brief Finds object on screen by position
@@ -131,7 +131,7 @@ public:
         * This variables hides variable with the same name from some parent EvaluationContext,
         * but it doesn't overwrite it.
         */
-       void setVariable(const std::string &ident, EvaluationValue_ val);
+       void setVariable(const std::string &ident, EvaluationValue val);
 
        /**
         * @brief Returns variable with name
@@ -140,7 +140,7 @@ public:
         * order until value is found. At last ExecutionInterface object will be requested to provide the value
         * by calling getVariableByName.
         */
-       EvaluationValue_ getVariable(const Optional<TokenLocation> &loc, const std::string &ident);
+       EvaluationValue getVariable(const Optional<TokenLocation> &loc, const std::string &ident);
 
        /**
         * @brief Returns reference to ExecutionInterface object
@@ -163,7 +163,7 @@ public:
 private:
        void initializeGlobalContext(ExecutorInterface &ei);
 
-       std::unordered_map<std::string, EvaluationValue_> variables;
+       std::unordered_map<std::string, EvaluationValue> variables;
        EvaluationContext *parent = nullptr;
        std::shared_ptr<GlobalContext> globalContext;
 };
index 3e4a862..0ae50ac 100644 (file)
 #include "../UniversalSwitch.hpp"
 #include <cmath>
 
-EvaluationValue_::EvaluationValue_() : value(EvaluationValueBase::create())
+EvaluationValue::EvaluationValue() : value(EvaluationValueBase::create())
 {
 }
 
-EvaluationValue_::EvaluationValue_(std::nullptr_t) : value(EvaluationValueBase::create())
+EvaluationValue::EvaluationValue(std::nullptr_t) : value(EvaluationValueBase::create())
 {
 }
 
-EvaluationValue_::EvaluationValue_(EvaluationValuePtr v) : value(std::move(v))
+EvaluationValue::EvaluationValue(EvaluationValuePtr v) : value(std::move(v))
 {
 }
 
-void EvaluationValue_::convertTo(int &v) const
+void EvaluationValue::convertTo(int &v) const
 {
        EvaluationValueInteger tmp = {};
        convertTo(tmp);
        v = static_cast<std::remove_reference<decltype(v)>::type>(tmp);
 }
-void EvaluationValue_::convertTo(unsigned int &v) const
+void EvaluationValue::convertTo(unsigned int &v) const
 {
        EvaluationValueInteger tmp = {};
        convertTo(tmp);
        v = static_cast<std::remove_reference<decltype(v)>::type>(tmp);
 }
-void EvaluationValue_::convertTo(short &v) const
+void EvaluationValue::convertTo(short &v) const
 {
        EvaluationValueInteger tmp = {};
        convertTo(tmp);
        v = static_cast<std::remove_reference<decltype(v)>::type>(tmp);
 }
-void EvaluationValue_::convertTo(unsigned short &v) const
+void EvaluationValue::convertTo(unsigned short &v) const
 {
        EvaluationValueInteger tmp = {};
        convertTo(tmp);
        v = static_cast<std::remove_reference<decltype(v)>::type>(tmp);
 }
-void EvaluationValue_::convertTo(signed char &v) const
+void EvaluationValue::convertTo(signed char &v) const
 {
        EvaluationValueInteger tmp = {};
        convertTo(tmp);
        v = static_cast<std::remove_reference<decltype(v)>::type>(tmp);
 }
-void EvaluationValue_::convertTo(unsigned char &v) const
+void EvaluationValue::convertTo(unsigned char &v) const
 {
        EvaluationValueInteger tmp = {};
        convertTo(tmp);
@@ -70,15 +70,15 @@ void EvaluationValue_::convertTo(unsigned char &v) const
 }
 
 #define Q(type) \
-       EvaluationValue_::EvaluationValue_(EvaluationValue ## type v) : value(EvaluationValueBase::create(std::move(v))) { } \
-       EvaluationValue ## type EvaluationValue_::convertTo ## type() const { \
+       EvaluationValue::EvaluationValue(EvaluationValue ## type v) : value(EvaluationValueBase::create(std::move(v))) { } \
+       EvaluationValue ## type EvaluationValue::convertTo ## type() const { \
                EvaluationValue ## type tmp; \
                convertTo(tmp); \
                return std::move(tmp); \
        } \
-       const EvaluationValue ## type &EvaluationValue_::as ## type() { return value->as ## type(); } \
-       bool EvaluationValue_::is ## type() const { return value->is ## type(); } \
-       void EvaluationValue_::convertTo(EvaluationValue ## type &r) const { \
+       const EvaluationValue ## type &EvaluationValue::as ## type() { return value->as ## type(); } \
+       bool EvaluationValue::is ## type() const { return value->is ## type(); } \
+       void EvaluationValue::convertTo(EvaluationValue ## type &r) const { \
                auto t = value->convertTo ## type(); \
                if (t.get() == value.get()) r = value->as ## type(); \
                else r = std::move(t->as ## type()); \
@@ -97,86 +97,86 @@ Q(Dict)
 Q(Wait)
 #undef Q
 
-std::string EvaluationValue_::typeName() const
+std::string EvaluationValue::typeName() const
 {
        return value->typeName();
 }
 
-bool EvaluationValue_::operator == (const EvaluationValue_ &other) const
+bool EvaluationValue::operator == (const EvaluationValue &other) const
 {
        return value->oper_cmp(EvaluationValueBase::Cmp::Equal, other.value);
 }
-bool EvaluationValue_::operator != (const EvaluationValue_ &other) const
+bool EvaluationValue::operator != (const EvaluationValue &other) const
 {
        return value->oper_cmp(EvaluationValueBase::Cmp::NotEqual, other.value);
 }
-bool EvaluationValue_::operator < (const EvaluationValue_ &other) const
+bool EvaluationValue::operator < (const EvaluationValue &other) const
 {
        return value->oper_order(EvaluationValueBase::Order::Less, other.value);
 }
-bool EvaluationValue_::operator > (const EvaluationValue_ &other) const
+bool EvaluationValue::operator > (const EvaluationValue &other) const
 {
        return value->oper_order(EvaluationValueBase::Order::More, other.value);
 }
-bool EvaluationValue_::operator <= (const EvaluationValue_ &other) const
+bool EvaluationValue::operator <= (const EvaluationValue &other) const
 {
        return value->oper_order(EvaluationValueBase::Order::LessThan, other.value);
 }
-bool EvaluationValue_::operator >= (const EvaluationValue_ &other) const
+bool EvaluationValue::operator >= (const EvaluationValue &other) const
 {
        return value->oper_order(EvaluationValueBase::Order::MoreThan, other.value);
 }
 
-size_t EvaluationValue_::hash() const
+size_t EvaluationValue::hash() const
 {
        return value->oper_hash();
 }
-bool EvaluationValue_::contains(const EvaluationValue_ &val) const
+bool EvaluationValue::contains(const EvaluationValue &val) const
 {
        return value->oper_contains(val.value);
 }
 
-EvaluationValue_::operator bool() const
+EvaluationValue::operator bool() const
 {
        return value->oper_is_true();
 }
 
-EvaluationValue_ EvaluationValue_::operator()(const std::vector<EvaluationValue_> &values, const std::unordered_map<std::string, EvaluationValue_> &keyArgs)
+EvaluationValue EvaluationValue::operator()(const std::vector<EvaluationValue> &values, const std::unordered_map<std::string, EvaluationValue> &keyArgs)
 {
        return value->oper_call(values, keyArgs);
 }
-EvaluationValue_ EvaluationValue_::index_get(const EvaluationValue_ &i1) const
+EvaluationValue EvaluationValue::index_get(const EvaluationValue &i1) const
 {
        return value->oper_index_get(i1.value);
 }
-EvaluationValue_ EvaluationValue_::index_get(const EvaluationValue_ &i1, const EvaluationValue_ &i2) const
+EvaluationValue EvaluationValue::index_get(const EvaluationValue &i1, const EvaluationValue &i2) const
 {
        return value->oper_index_get(i1.value, i2.value);
 }
-EvaluationValue_ EvaluationValue_::index_set(const EvaluationValue_ &i1, const EvaluationValue_ &val)
+EvaluationValue EvaluationValue::index_set(const EvaluationValue &i1, const EvaluationValue &val)
 {
        return value->oper_index_set(i1.value, val.value);
 }
-EvaluationValue_ EvaluationValue_::index_set(const EvaluationValue_ &i1, const EvaluationValue_ &i2, const EvaluationValue_ &val)
+EvaluationValue EvaluationValue::index_set(const EvaluationValue &i1, const EvaluationValue &i2, const EvaluationValue &val)
 {
        return value->oper_index_set(i1.value, i2.value, val.value);
 }
 
-EvaluationValue_ EvaluationValue_::operator - () const
+EvaluationValue EvaluationValue::operator - () const
 {
        return value->oper_negate();
 }
 
-EvaluationValue_ EvaluationValue_::attr_get(const std::string &name) const
+EvaluationValue EvaluationValue::attr_get(const std::string &name) const
 {
        return value->oper_attr_get(name);
 }
-EvaluationValue_ EvaluationValue_::attr_set(const std::string &name, const EvaluationValue_ &val)
+EvaluationValue EvaluationValue::attr_set(const std::string &name, const EvaluationValue &val)
 {
        return value->oper_attr_set(name, val.value);
 }
 
-std::ostream &operator << (std::ostream &s, const EvaluationValue_ &v)
+std::ostream &operator << (std::ostream &s, const EvaluationValue &v)
 {
        return s << v.value;
 }
index 8e999ce..1ef4571 100644 (file)
@@ -62,12 +62,12 @@ private:
        mutable std::string cachedText;
 };
 
-class EvaluationValue_;
+class EvaluationValue;
 
 namespace std
 {
-       template <> struct hash<EvaluationValue_> {
-               size_t operator()(const EvaluationValue_ &) const;
+       template <> struct hash<EvaluationValue> {
+               size_t operator()(const EvaluationValue &) const;
        };
 }
 
@@ -84,9 +84,9 @@ using EvaluationValueUIElement = std::shared_ptr<UIElement>;
 using EvaluationValueBoolean = bool;
 using EvaluationValuePoint = Point;
 class EvaluationValueFunction;
-using EvaluationValueVector = std::vector<EvaluationValue_>;
-using EvaluationValueSet = std::unordered_set<EvaluationValue_>;
-using EvaluationValueDict = std::unordered_map<EvaluationValue_, EvaluationValue_>;
+using EvaluationValueVector = std::vector<EvaluationValue>;
+using EvaluationValueSet = std::unordered_set<EvaluationValue>;
+using EvaluationValueDict = std::unordered_map<EvaluationValue, EvaluationValue>;
 
 class EvaluationValueWaitInterface
 {
@@ -107,37 +107,37 @@ public:
  * implementing values of all supported types (see EvaluationValue***.cpp files). Those classes
  * override virtual methods of the EvaluationValueBase interface to add required functionality.
  *
- * EvaluationValue_ supports implicit cast from C++ types, which can be used in batch script (for example
+ * EvaluationValue supports implicit cast from C++ types, which can be used in batch script (for example
  * chars shorts and ints can be converted to EvaluationValueInteger, std::string can be converted to
  * EvaluationValueString and so on).
  */
-class EvaluationValue_
+class EvaluationValue
 {
 public:
-       EvaluationValue_();
-       EvaluationValue_(const EvaluationValue_ &) = default;
-       EvaluationValue_(EvaluationValue_ &&) = default;
-       EvaluationValue_(std::nullptr_t);
-       EvaluationValue_(EvaluationValuePtr v);
-       EvaluationValue_(unsigned char v) : EvaluationValue_(static_cast<EvaluationValueInteger>(v)) { }
-       EvaluationValue_(signed char v) : EvaluationValue_(static_cast<EvaluationValueInteger>(v)) { }
-       EvaluationValue_(unsigned short v) : EvaluationValue_(static_cast<EvaluationValueInteger>(v)) { }
-       EvaluationValue_(short v) : EvaluationValue_(static_cast<EvaluationValueInteger>(v)) { }
-       EvaluationValue_(unsigned int v) : EvaluationValue_(static_cast<EvaluationValueInteger>(v)) { }
-       EvaluationValue_(int v) : EvaluationValue_(static_cast<EvaluationValueInteger>(v)) { }
-       template <typename T> EvaluationValue_(std::vector<T> tmp) : EvaluationValue_(fromVector(std::move(tmp))) { }
-       template <typename T> EvaluationValue_(std::unordered_set<T> tmp) : EvaluationValue_(fromSet(std::move(tmp))) { }
-       template <typename K, typename EvaluationValuePtr> EvaluationValue_(std::unordered_map<K, EvaluationValuePtr> tmp) : EvaluationValue_(fromMap(std::move(tmp))) { }
-
-       EvaluationValue_ &operator = (const EvaluationValue_ &) = default;
-       EvaluationValue_ &operator = (EvaluationValue_ &&) = default;
-       template <typename T> EvaluationValue_ &operator = (T &&t)
+       EvaluationValue();
+       EvaluationValue(const EvaluationValue &) = default;
+       EvaluationValue(EvaluationValue &&) = default;
+       EvaluationValue(std::nullptr_t);
+       EvaluationValue(EvaluationValuePtr v);
+       EvaluationValue(unsigned char v) : EvaluationValue(static_cast<EvaluationValueInteger>(v)) { }
+       EvaluationValue(signed char v) : EvaluationValue(static_cast<EvaluationValueInteger>(v)) { }
+       EvaluationValue(unsigned short v) : EvaluationValue(static_cast<EvaluationValueInteger>(v)) { }
+       EvaluationValue(short v) : EvaluationValue(static_cast<EvaluationValueInteger>(v)) { }
+       EvaluationValue(unsigned int v) : EvaluationValue(static_cast<EvaluationValueInteger>(v)) { }
+       EvaluationValue(int v) : EvaluationValue(static_cast<EvaluationValueInteger>(v)) { }
+       template <typename T> EvaluationValue(std::vector<T> tmp) : EvaluationValue(fromVector(std::move(tmp))) { }
+       template <typename T> EvaluationValue(std::unordered_set<T> tmp) : EvaluationValue(fromSet(std::move(tmp))) { }
+       template <typename K, typename EvaluationValuePtr> EvaluationValue(std::unordered_map<K, EvaluationValuePtr> tmp) : EvaluationValue(fromMap(std::move(tmp))) { }
+
+       EvaluationValue &operator = (const EvaluationValue &) = default;
+       EvaluationValue &operator = (EvaluationValue &&) = default;
+       template <typename T> EvaluationValue &operator = (T &&t)
        {
-               *this = EvaluationValue_{ std::forward<T>(t) };
+               *this = EvaluationValue{ std::forward<T>(t) };
                return *this;
        }
 
-       void convertTo(EvaluationValue_ &o) const
+       void convertTo(EvaluationValue &o) const
        {
                o = *this;
        }
@@ -178,7 +178,7 @@ public:
                }
        }
 #define Q(type) \
-       EvaluationValue_(EvaluationValue ## type); \
+       EvaluationValue(EvaluationValue ## type); \
        EvaluationValue ## type convertTo ## type() const; \
        void convertTo(EvaluationValue ## type &) const; \
        const EvaluationValue ## type &as ## type(); \
@@ -198,34 +198,34 @@ public:
 #undef Q
 
        std::string typeName() const;
-       bool operator == (const EvaluationValue_ &) const;
-       bool operator != (const EvaluationValue_ &) const;
-       bool operator < (const EvaluationValue_ &) const;
-       bool operator > (const EvaluationValue_ &) const;
-       bool operator <= (const EvaluationValue_ &) const;
-       bool operator >= (const EvaluationValue_ &) const;
+       bool operator == (const EvaluationValue &) const;
+       bool operator != (const EvaluationValue &) const;
+       bool operator < (const EvaluationValue &) const;
+       bool operator > (const EvaluationValue &) const;
+       bool operator <= (const EvaluationValue &) const;
+       bool operator >= (const EvaluationValue &) const;
 
        size_t hash() const;
-       bool contains(const EvaluationValue_ &) const;
+       bool contains(const EvaluationValue &) const;
        explicit operator bool() const;
 
-       EvaluationValue_ operator()(const std::vector<EvaluationValue_> &values, const std::unordered_map<std::string, EvaluationValue_> &keyArgs);
-       EvaluationValue_ index_get(const EvaluationValue_ &) const;
-       EvaluationValue_ index_get(const EvaluationValue_ &, const EvaluationValue_ &) const;
-       EvaluationValue_ index_set(const EvaluationValue_ &, const EvaluationValue_ &value);
-       EvaluationValue_ index_set(const EvaluationValue_ &, const EvaluationValue_ &, const EvaluationValue_ &value);
+       EvaluationValue operator()(const std::vector<EvaluationValue> &values, const std::unordered_map<std::string, EvaluationValue> &keyArgs);
+       EvaluationValue index_get(const EvaluationValue &) const;
+       EvaluationValue index_get(const EvaluationValue &, const EvaluationValue &) const;
+       EvaluationValue index_set(const EvaluationValue &, const EvaluationValue &value);
+       EvaluationValue index_set(const EvaluationValue &, const EvaluationValue &, const EvaluationValue &value);
 
-       EvaluationValue_ operator - () const;
+       EvaluationValue operator - () const;
 
-       EvaluationValue_ attr_get(const std::string &name) const;
-       EvaluationValue_ attr_set(const std::string &name, const EvaluationValue_ &value);
+       EvaluationValue attr_get(const std::string &name) const;
+       EvaluationValue attr_set(const std::string &name, const EvaluationValue &value);
 
        const auto &getInternalValue() const
        {
                return value;
        }
 
-       friend std::ostream &operator << (std::ostream &s, const EvaluationValue_ &v);
+       friend std::ostream &operator << (std::ostream &s, const EvaluationValue &v);
 private:
        EvaluationValuePtr value;
 
@@ -284,7 +284,7 @@ namespace detail
                template <typename SARGS, typename ... ARGS> static void convert(std::tuple<ARGS...> &dst,
                                const SARGS &sourceArgs,
                                size_t firstDefaultArgIndex,
-                               const std::vector<EvaluationValue_> &defaultArguments,
+                               const std::vector<EvaluationValue> &defaultArguments,
                                size_t consumeOnlyArguments = std::numeric_limits<size_t>::max())
                {
                        DEBUG("%d %d", (int)I, (int)consumeOnlyArguments);
@@ -299,7 +299,7 @@ namespace detail
                        Converter < I + 1, S >::convert(dst, sourceArgs, firstDefaultArgIndex, defaultArguments, consumeOnlyArguments);
                }
                template <typename ... ARGS> static void convertSingleArgumentByIndex(std::tuple<ARGS...> &dst,
-                               const EvaluationValue_ &arg,
+                               const EvaluationValue &arg,
                                size_t index)
                {
                        if (I == index) {
@@ -316,11 +316,11 @@ namespace detail
        };
        template <size_t S> struct Converter<S, S> {
                template <typename SARGS, typename ... ARGS> static void convert(std::tuple<ARGS...> &, const SARGS &,
-                               size_t, const std::vector<EvaluationValue_> &, size_t = std::numeric_limits<size_t>::max())
+                               size_t, const std::vector<EvaluationValue> &, size_t = std::numeric_limits<size_t>::max())
                {
                }
                template <typename ... ARGS> static void convertSingleArgumentByIndex(std::tuple<ARGS...> &,
-                               const EvaluationValue_ &,
+                               const EvaluationValue &,
                                size_t)
                {
                        ASSERT(0);
@@ -364,7 +364,7 @@ namespace detail
        template <> struct is_allowed_evaluatation_value_type<unsigned char> {
                enum { value = 1 };
        };
-       template <> struct is_allowed_evaluatation_value_type<EvaluationValue_> {
+       template <> struct is_allowed_evaluatation_value_type<EvaluationValue> {
                enum { value = 1 };
        };
        template <> struct is_allowed_evaluatation_value_type<EvaluationValueEmpty> {
@@ -423,11 +423,11 @@ namespace detail
        {
                template<typename T> struct make_tuple_from_args { };
                template<typename C, typename ... ARGS>
-               struct make_tuple_from_args<EvaluationValue_(C::*)(ARGS...)> {
+               struct make_tuple_from_args<EvaluationValue(C::*)(ARGS...)> {
                        using type = std::tuple<ARGS...>;
                };
                template<typename C, typename ... ARGS>
-               struct make_tuple_from_args<EvaluationValue_(C::*)(ARGS...) const> {
+               struct make_tuple_from_args<EvaluationValue(C::*)(ARGS...) const> {
                        using type = std::tuple<ARGS...>;
                };
        }
@@ -450,7 +450,7 @@ public:
                {
                        ASSERT(!this->name.empty());
                }
-               Arg(std::string name, EvaluationValue_ val) : name(std::move(name)), defaultValue(std::move(val)) { }
+               Arg(std::string name, EvaluationValue val) : name(std::move(name)), defaultValue(std::move(val)) { }
 
                std::string getName() const
                {
@@ -460,7 +460,7 @@ public:
                {
                        return bool(defaultValue);
                }
-               EvaluationValue_ stealDefaultValue()
+               EvaluationValue stealDefaultValue()
                {
                        auto tmp = std::move(*defaultValue);
                        defaultValue = {};
@@ -468,13 +468,13 @@ public:
                }
        private:
                std::string name;
-               Optional<EvaluationValue_> defaultValue;
+               Optional<EvaluationValue> defaultValue;
        };
        class Args
        {
        public:
-               Args(const std::vector<EvaluationValue_> &args,
-                        const std::unordered_map<std::string, EvaluationValue_> &keyArgs = {}) : args(args), keyArgs(keyArgs) { }
+               Args(const std::vector<EvaluationValue> &args,
+                        const std::unordered_map<std::string, EvaluationValue> &keyArgs = {}) : args(args), keyArgs(keyArgs) { }
 
                bool empty() const
                {
@@ -484,11 +484,11 @@ public:
                {
                        return args.size();
                }
-               const EvaluationValue_ &operator [](size_t index) const
+               const EvaluationValue &operator [](size_t index) const
                {
                        return args[index];
                }
-               const std::unordered_map<std::string, EvaluationValue_> &keywords() const
+               const std::unordered_map<std::string, EvaluationValue> &keywords() const
                {
                        return keyArgs;
                }
@@ -497,10 +497,10 @@ public:
                        return !keyArgs.empty();
                }
        private:
-               const std::vector<EvaluationValue_> &args;
-               const std::unordered_map<std::string, EvaluationValue_> &keyArgs;
+               const std::vector<EvaluationValue> &args;
+               const std::unordered_map<std::string, EvaluationValue> &keyArgs;
        };
-       using Type = std::function<EvaluationValue_(const Args &)>;
+       using Type = std::function<EvaluationValue(const Args &)>;
 
        EvaluationValueFunction() = default;
        template <typename T, typename ARGS_TUPLE = typename detail::get_args_as_tuple_from_lambda<T>::type,
@@ -508,7 +508,7 @@ public:
        EvaluationValueFunction(T && f, std::vector<Arg> argDescriptions = {}) :
                function(constructConvertingArgsFunction<ARGS_TUPLE>(std::move(f), std::move(argDescriptions))) { }
 
-       template <typename T, typename = typename std::enable_if<std::is_constructible<std::function<EvaluationValue_(Args)>, T>::value>::type>
+       template <typename T, typename = typename std::enable_if<std::is_constructible<std::function<EvaluationValue(Args)>, T>::value>::type>
        EvaluationValueFunction(T && f) : function(std::move(f)) { }
 
        explicit operator bool () const
@@ -516,7 +516,7 @@ public:
                return bool(function);
        }
 
-       EvaluationValue_ operator()(const Args &args) const
+       EvaluationValue operator()(const Args &args) const
        {
                return function(args);
        }
@@ -538,7 +538,7 @@ private:
        {
                constexpr auto expectedArgCount = std::tuple_size<ARGS_TUPLE>::value;
                ASSERT(expectedArgCount >= argDescriptions.size());
-               std::vector<EvaluationValue_> defaultArguments;
+               std::vector<EvaluationValue> defaultArguments;
 
                for (auto it = argDescriptions.rbegin(); it != argDescriptions.rend() && it->hasDefaultValue(); ++it) {
                        defaultArguments.push_back(std::move(it->stealDefaultValue()));
@@ -556,7 +556,7 @@ private:
                        ++argIndex;
                }
                return [f = std::move(f), defaultArguments = std::move(defaultArguments), firstDefaultArgIndex, keywordIndexes = std::move(keywordIndexes)]
-               (const Args & sourceArgs) -> EvaluationValue_ {
+               (const Args & sourceArgs) -> EvaluationValue {
                        ARGS_TUPLE args;
                        if (!sourceArgs.hasKeywords())
                        {
index 60027e1..1b6c37c 100644 (file)
@@ -4,7 +4,7 @@
 
 namespace std
 {
-       size_t hash<EvaluationValue_>::operator()(const EvaluationValue_ &v) const
+       size_t hash<EvaluationValue>::operator()(const EvaluationValue &v) const
        {
                return v.hash();
        }
@@ -115,7 +115,7 @@ bool EvaluationValueBase::oper_contains(const EvaluationValuePtr &value)
        throw EvaluationFailure{} << "unsupported operation, " << typeName() << " is not a container";
 }
 
-EvaluationValuePtr EvaluationValueBase::oper_call(const std::vector<EvaluationValue_> &, const std::unordered_map<std::string, EvaluationValue_> &)
+EvaluationValuePtr EvaluationValueBase::oper_call(const std::vector<EvaluationValue> &, const std::unordered_map<std::string, EvaluationValue> &)
 {
        throw EvaluationFailure{} << "unsupported operation, " << typeName() << " is not a callable";
 }
index a13bc02..d90f2c3 100644 (file)
@@ -65,7 +65,7 @@ public:
        virtual size_t oper_hash();
        virtual bool oper_contains(const EvaluationValuePtr &value);
        virtual bool oper_is_true() = 0;
-       virtual EvaluationValuePtr oper_call(const std::vector<EvaluationValue_> &args, const std::unordered_map<std::string, EvaluationValue_> &keyArgs);
+       virtual EvaluationValuePtr oper_call(const std::vector<EvaluationValue> &args, const std::unordered_map<std::string, EvaluationValue> &keyArgs);
        virtual EvaluationValuePtr oper_attr_get(const std::string &name);
        virtual EvaluationValuePtr oper_attr_set(const std::string &name, const EvaluationValuePtr &);
        virtual EvaluationValuePtr oper_negate();
index 8d28552..452b999 100644 (file)
@@ -43,7 +43,7 @@ public:
        {
                return true;
        }
-       EvaluationValuePtr oper_call(const std::vector<EvaluationValue_> &args, const std::unordered_map<std::string, EvaluationValue_> &keyArgs) override
+       EvaluationValuePtr oper_call(const std::vector<EvaluationValue> &args, const std::unordered_map<std::string, EvaluationValue> &keyArgs) override
        {
                return value(EvaluationValueFunction::Args{ args, keyArgs }).getInternalValue();
        }
index cbb67e2..bc07a4c 100644 (file)
@@ -78,7 +78,7 @@ public:
        EvaluationValuePtr oper_index_get(const EvaluationValuePtr &from, const EvaluationValuePtr &to) override
        {
                auto indexes = getDoubleIndexes(from, to, value.size());
-               std::vector<EvaluationValue_> tmp;
+               std::vector<EvaluationValue> tmp;
                tmp.reserve(indexes.second - indexes.first);
                for (auto i = indexes.first; i < indexes.second; ++i)
                        tmp.push_back(value[i]);
@@ -96,7 +96,7 @@ public:
                        return EvaluationValueBase::oper_index_set(from, to, val);
 
                auto indexes = getDoubleIndexes(from, to, value.size());
-               std::vector<EvaluationValue_> tmp;
+               std::vector<EvaluationValue> tmp;
                tmp.reserve(value.size() - (indexes.second - indexes.first) + val->asVector().size());
                for (size_t i = 0; i < indexes.first; ++i)
                        tmp.push_back(value[i]);
index dbd1010..00b3d64 100644 (file)
@@ -30,7 +30,7 @@ public:
        {
                return other->isBoolean() && value == other->asWait();
        }
-       EvaluationValuePtr oper_call(const std::vector<EvaluationValue_> &args, const std::unordered_map<std::string, EvaluationValue_> &keyArgs) override
+       EvaluationValuePtr oper_call(const std::vector<EvaluationValue> &args, const std::unordered_map<std::string, EvaluationValue> &keyArgs) override
        {
                EvaluationValueFunction::validateArgumentCount(args.size(), 0, 0);
                if (!keyArgs.empty()) throw EvaluationFailure{} << "wait object doesn't accept keyword arguments, when called";
index 53dd0b2..49bd4a0 100644 (file)
@@ -105,7 +105,7 @@ template <typename F> static auto evaluateHelper(std::string debugId, TokenLocat
        }
 }
 
-EvaluationValue_ ExpressionEvaluator::evaluate() const
+EvaluationValue ExpressionEvaluator::evaluate() const
 {
        return evaluateHelper(std::to_string(getDebugId()), location(), [&]() {
                return evaluateImpl();
@@ -122,7 +122,7 @@ void StatementEvaluator::evaluate() const
 IdentifierEvaluator::IdentifierEvaluator(TokenLocation tokenLocation, std::string identifier) :
        ExpressionEvaluator(std::move(tokenLocation)), identifier(std::move(identifier)) { }
 
-EvaluationValue_ IdentifierEvaluator::evaluateImpl() const
+EvaluationValue IdentifierEvaluator::evaluateImpl() const
 {
        return EvaluationContext::getCurrentEvaluationContext().getVariable(location(), identifier);
 }
@@ -135,7 +135,7 @@ void IdentifierEvaluator::printSelfInfo(std::ostringstream &os, unsigned int dep
 AttributeEvaluator::AttributeEvaluator(TokenLocation tokenLocation, ExprPtr self, std::string identifier) :
        ExpressionEvaluator(std::move(tokenLocation)), self(std::move(self)), identifier(std::move(identifier)) { }
 
-EvaluationValue_ AttributeEvaluator::evaluateImpl() const
+EvaluationValue AttributeEvaluator::evaluateImpl() const
 {
        return self->evaluate().attr_get(identifier);
 }
@@ -151,7 +151,7 @@ void AttributeEvaluator::printSelfInfo(std::ostringstream &os, unsigned int dept
 AttributeSetterEvaluator::AttributeSetterEvaluator(TokenLocation tokenLocation, ExprPtr self, std::string identifier, ExprPtr value) :
        ExpressionEvaluator(std::move(tokenLocation)), self(std::move(self)), value(std::move(value)), identifier(std::move(identifier)) { }
 
-EvaluationValue_ AttributeSetterEvaluator::evaluateImpl() const
+EvaluationValue AttributeSetterEvaluator::evaluateImpl() const
 {
        auto val = value->evaluate();
        return self->evaluate().attr_set(identifier, std::move(val));
@@ -170,7 +170,7 @@ void AttributeSetterEvaluator::printSelfInfo(std::ostringstream &os, unsigned in
 SetterEvaluator::SetterEvaluator(TokenLocation tokenLocation, std::string identifier, ExprPtr value) :
        ExpressionEvaluator(std::move(tokenLocation)), value(std::move(value)), identifier(std::move(identifier)) { }
 
-EvaluationValue_ SetterEvaluator::evaluateImpl() const
+EvaluationValue SetterEvaluator::evaluateImpl() const
 {
        auto v = value->evaluate();
        EvaluationContext::getCurrentEvaluationContext().setVariable(identifier, v);
@@ -188,7 +188,7 @@ void SetterEvaluator::printSelfInfo(std::ostringstream &os, unsigned int depth)
 PointEvaluator::PointEvaluator(TokenLocation tokenLocation, ExprPtr x, ExprPtr y) :
        ExpressionEvaluator(std::move(tokenLocation)), x(std::move(x)), y(std::move(y)) { }
 
-EvaluationValue_ PointEvaluator::evaluateImpl() const
+EvaluationValue PointEvaluator::evaluateImpl() const
 {
        auto xInt = x->evaluate().convertToInteger();
        auto yInt = y->evaluate().convertToInteger();
@@ -208,7 +208,7 @@ void PointEvaluator::printSelfInfo(std::ostringstream &os, unsigned int depth) c
 IntegerEvaluator::IntegerEvaluator(TokenLocation tokenLocation, int64_t value) :
        ExpressionEvaluator(std::move(tokenLocation)), value(value) { }
 
-EvaluationValue_ IntegerEvaluator::evaluateImpl() const
+EvaluationValue IntegerEvaluator::evaluateImpl() const
 {
        return value;
 }
@@ -222,7 +222,7 @@ void IntegerEvaluator::printSelfInfo(std::ostringstream &os, unsigned int depth)
 DoubleEvaluator::DoubleEvaluator(TokenLocation tokenLocation, double value) :
        ExpressionEvaluator(std::move(tokenLocation)), value(value) { }
 
-EvaluationValue_ DoubleEvaluator::evaluateImpl() const
+EvaluationValue DoubleEvaluator::evaluateImpl() const
 {
        return value;
 }
@@ -236,7 +236,7 @@ void DoubleEvaluator::printSelfInfo(std::ostringstream &os, unsigned int depth)
 StringEvaluator::StringEvaluator(TokenLocation tokenLocation, std::string value) :
        ExpressionEvaluator(std::move(tokenLocation)), value(std::move(value)) { }
 
-EvaluationValue_ StringEvaluator::evaluateImpl() const
+EvaluationValue StringEvaluator::evaluateImpl() const
 {
        return value;
 }
@@ -250,9 +250,9 @@ void StringEvaluator::printSelfInfo(std::ostringstream &os, unsigned int depth)
 ArraySetDictEvaluator::ArraySetDictEvaluator(TokenLocation tokenLocation, ExprPtrs values, Kind kind) :
        ExpressionEvaluator(std::move(tokenLocation)), values(std::move(values)), kind(kind) { }
 
-EvaluationValue_ ArraySetDictEvaluator::evaluateImpl() const
+EvaluationValue ArraySetDictEvaluator::evaluateImpl() const
 {
-       std::vector<EvaluationValue_> vals;
+       std::vector<EvaluationValue> vals;
        for (auto &v : values)
                vals.push_back(v->evaluate());
 
@@ -308,9 +308,9 @@ void ArraySetDictEvaluator::printSelfInfo(std::ostringstream &os, unsigned int d
 OperatorEvaluator::OperatorEvaluator(TokenLocation tokenLocation, ExprPtrs args, Kind kind) :
        ExpressionEvaluator(std::move(tokenLocation)), args(std::move(args)), kind(kind) { }
 
-EvaluationValue_ OperatorEvaluator::evaluateImpl() const
+EvaluationValue OperatorEvaluator::evaluateImpl() const
 {
-       std::vector<EvaluationValue_> vals;
+       std::vector<EvaluationValue> vals;
        for (auto &a : args)
                vals.push_back(a->evaluate());
 
@@ -368,9 +368,9 @@ void OperatorEvaluator::printSelfInfo(std::ostringstream &os, unsigned int depth
 CompOperatorEvaluator::CompOperatorEvaluator(TokenLocation tokenLocation, ExprPtrs args, std::vector<Kind> kinds, std::vector<TokenLocation> locations) :
        ExpressionEvaluator(std::move(tokenLocation)), args(std::move(args)), kinds(kinds), locations(std::move(locations)) { }
 
-EvaluationValue_ CompOperatorEvaluator::evaluateImpl() const
+EvaluationValue CompOperatorEvaluator::evaluateImpl() const
 {
-       auto cmp = [](const EvaluationValue_ & l, const EvaluationValue_ & r, const TokenLocation & loc, Kind kind) {
+       auto cmp = [](const EvaluationValue & l, const EvaluationValue & r, const TokenLocation & loc, Kind kind) {
                switch (kind) {
                case Kind::EQ:
                        return l == r;
@@ -441,7 +441,7 @@ void CompOperatorEvaluator::printSelfInfo(std::ostringstream &os, unsigned int d
 BooleanEvaluator::BooleanEvaluator(TokenLocation tokenLocation, bool value) :
        ExpressionEvaluator(std::move(tokenLocation)), value(std::move(value)) { }
 
-EvaluationValue_ BooleanEvaluator::evaluateImpl() const
+EvaluationValue BooleanEvaluator::evaluateImpl() const
 {
        return value;
 }
@@ -455,10 +455,10 @@ void BooleanEvaluator::printSelfInfo(std::ostringstream &os, unsigned int depth)
 CallEvaluator::CallEvaluator(TokenLocation tokenLocation, ExprPtr function, ExprPtrs args, ExprMapPtrs keywordArgs) :
        ExpressionEvaluator(tokenLocation), function(std::move(function)), args(std::move(args)), keywordArgs(std::move(keywordArgs)) { }
 
-EvaluationValue_ CallEvaluator::evaluateImpl() const
+EvaluationValue CallEvaluator::evaluateImpl() const
 {
-       std::vector<EvaluationValue_> values;
-       std::unordered_map<std::string, EvaluationValue_> keywordValues;
+       std::vector<EvaluationValue> values;
+       std::unordered_map<std::string, EvaluationValue> keywordValues;
        values.reserve(args.size());
        for (auto &arg : args) {
                values.push_back(arg->evaluate());
@@ -520,7 +520,7 @@ WaitEvaluator::WaitEvaluator(TokenLocation tokenLocation, StatPtr exec, ExprPtrs
 
 void WaitEvaluator::evaluateImpl() const
 {
-       std::vector<EvaluationValue_> waitsValues;
+       std::vector<EvaluationValue> waitsValues;
        waitsValues.reserve(waits.size());
        for (auto &w : waits) {
                auto r = w->evaluate();
index b64559f..20e19e9 100644 (file)
@@ -24,7 +24,7 @@
 #include <unordered_map>
 #include <sstream>
 
-class EvaluationValue_;
+class EvaluationValue;
 
 /**
  * @brief Class for printing debug information, when evaluation batch
@@ -112,7 +112,7 @@ public:
         * Calling this function will evaluate given expression (by calling evaluateImpl).
         * It will also deal with debug printing (if any).
         */
-       EvaluationValue_ evaluate() const;
+       EvaluationValue evaluate() const;
 protected:
        /**
         * @brief Virtual evaluation function.
@@ -120,7 +120,7 @@ protected:
         * Calling this function will evaluate given expression, including it's all children,
         * and return produced value. Might raise an EvaluationFailure exception.
         */
-       virtual EvaluationValue_ evaluateImpl() const = 0;
+       virtual EvaluationValue evaluateImpl() const = 0;
 };
 
 /**
@@ -168,7 +168,7 @@ class IdentifierEvaluator : public ExpressionEvaluator
 {
        std::string identifier;
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        IdentifierEvaluator(TokenLocation location_, std::string identifier);
 
@@ -187,7 +187,7 @@ class AttributeEvaluator : public ExpressionEvaluator
        ExprPtr self;
        std::string identifier;
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        AttributeEvaluator(TokenLocation location_, ExprPtr self, std::string identifier);
 
@@ -206,7 +206,7 @@ class AttributeSetterEvaluator : public ExpressionEvaluator
        ExprPtr self, value;
        std::string identifier;
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        AttributeSetterEvaluator(TokenLocation location_, ExprPtr self, std::string identifier, ExprPtr value);
 
@@ -224,7 +224,7 @@ class SetterEvaluator : public ExpressionEvaluator
        ExprPtr value;
        std::string identifier;
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        SetterEvaluator(TokenLocation location_, std::string identifier, ExprPtr value);
 
@@ -241,7 +241,7 @@ class PointEvaluator : public ExpressionEvaluator
 {
        ExprPtr x, y;
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        PointEvaluator(TokenLocation location_, ExprPtr x, ExprPtr y);
 
@@ -255,7 +255,7 @@ class IntegerEvaluator : public ExpressionEvaluator
 {
        int64_t value;
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        IntegerEvaluator(TokenLocation location_, int64_t value);
 
@@ -269,7 +269,7 @@ class DoubleEvaluator : public ExpressionEvaluator
 {
        double value;
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        DoubleEvaluator(TokenLocation location_, double value);
 
@@ -283,7 +283,7 @@ class BooleanEvaluator : public ExpressionEvaluator
 {
        bool value;
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        BooleanEvaluator(TokenLocation location_, bool value);
 
@@ -297,7 +297,7 @@ class StringEvaluator : public ExpressionEvaluator
 {
        std::string value;
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        StringEvaluator(TokenLocation location_, std::string value);
 
@@ -314,7 +314,7 @@ public:
 class ArraySetDictEvaluator : public ExpressionEvaluator
 {
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        enum class Kind {
                SET, VECTOR, DICT
@@ -340,7 +340,7 @@ class CallEvaluator : public ExpressionEvaluator
        ExprPtrs args;
        ExprMapPtrs keywordArgs;
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        CallEvaluator(TokenLocation location_, ExprPtr function, ExprPtrs args, ExprMapPtrs keywordArgs);
 
@@ -357,7 +357,7 @@ public:
 class OperatorEvaluator : public ExpressionEvaluator
 {
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        enum class Kind {
                IN, GET, SET, MINUS, NOT
@@ -382,7 +382,7 @@ private:
 class CompOperatorEvaluator : public ExpressionEvaluator
 {
 protected:
-       EvaluationValue_ evaluateImpl() const override;
+       EvaluationValue evaluateImpl() const override;
 public:
        enum class Kind {
                EQ, NE, LE, LT, GE, GT
index fd0bf6c..08d2bed 100644 (file)
@@ -21,7 +21,7 @@
 #include "batch/Evaluator.hpp"
 #include <sstream>
 
-using VarsType = std::unordered_map<std::string, EvaluationValue_>;
+using VarsType = std::unordered_map<std::string, EvaluationValue>;
 using ActsType = std::unordered_map<std::string, EvaluationValueFunction>;
 
 struct TestExecutor : ExecutorInterface {
@@ -31,7 +31,7 @@ struct TestExecutor : ExecutorInterface {
                variables(std::move(variables)), activities(std::move(activities)),
                pointToUI(std::move(pointToUI)), stringToUI(std::move(stringToUI)) { }
 
-       EvaluationValue_ getVariableByName(const std::string &name) override
+       EvaluationValue getVariableByName(const std::string &name) override
        {
                auto it = variables.find(name);
                if (it == variables.end()) throw EvaluationFailure{} << "no variable " << name;
@@ -121,10 +121,10 @@ TEST(TestExec, simpleParser)
 
        std::string result2;
        VarsType vars;
-       vars["foo"] = [&](int v1, std::string v2, std::string v3, bool v4) -> EvaluationValue_ {
+       vars["foo"] = [&](int v1, std::string v2, std::string v3, bool v4) -> EvaluationValue {
                return std::to_string(v1) + "," + v2 + "," + v3 + "," + (v4 ? "true" : "false");
        };
-       vars["bar"] = [&](std::string value) -> EvaluationValue_ {
+       vars["bar"] = [&](std::string value) -> EvaluationValue {
                result2 = value;
                return {};
        };
@@ -155,12 +155,12 @@ protected:
 
        ScriptTest()
        {
-               vars["assert"] = [this](bool val) -> EvaluationValue_ {
+               vars["assert"] = [this](bool val) -> EvaluationValue {
                        if (!val) throw EvaluationFailure{} << "assertion failed";
                        ++assertCount;
                        return {};
                };
-               vars["print"] = [this](EvaluationValue_ val) -> EvaluationValue_ {
+               vars["print"] = [this](EvaluationValue val) -> EvaluationValue {
                        output << ">>> " << val << "\n";
                        return {};
                };
@@ -368,7 +368,7 @@ TEST_F(ScriptTest, defaultArguments)
        std::tuple<int, int, int, int> val, expected;
 
        vars["func"] = EvaluationValueFunction{
-               [&](int a1, int a2, int a3, int a4) -> EvaluationValue_ {
+               [&](int a1, int a2, int a3, int a4) -> EvaluationValue {
                        std::get<0>(val) = a1;
                        std::get<1>(val) = a2;
                        std::get<2>(val) = a3;
@@ -419,7 +419,7 @@ TEST_F(ScriptTest, keywordArguments)
        std::tuple<int, int, int, int> val, expected;
 
        vars["func"] = EvaluationValueFunction{
-               [&](int a1, int a2, int a3, int a4) -> EvaluationValue_ {
+               [&](int a1, int a2, int a3, int a4) -> EvaluationValue {
                        std::get<0>(val) = a1;
                        std::get<1>(val) = a2;
                        std::get<2>(val) = a3;