Add types for leaves
Change-Id: Ibea2945920e523d2f3439eed2c12a5d719d178f1
diff --git a/src/interpreter.cpp b/src/interpreter.cpp
index 934aac9..1a4e84a 100644
--- a/src/interpreter.cpp
+++ b/src/interpreter.cpp
@@ -9,9 +9,23 @@
#include <iostream>
#include "interpreter.hpp"
+struct leafDataToString : boost::static_visitor<std::string> {
+ std::string operator()(const enum_& data) const
+ {
+ return data.m_value;
+ }
+ template <typename T>
+ std::string operator()(const T& data) const
+ {
+ std::stringstream stream;
+ stream << data;
+ return stream.str();
+ }
+};
+
void Interpreter::operator()(const set_& set) const
{
- std::cout << "Setting " << pathToDataString(set.m_path) << " to " << set.m_data << std::endl;
+ std::cout << "Setting " << pathToDataString(set.m_path) << " to " << boost::apply_visitor(leafDataToString(), set.m_data) << std::endl;
}
void Interpreter::operator()(const cd_& cd) const