KISS principle: we only need size_t objects in the store, so only support this type, at the moment.

JSON-93
Roker 5 years ago
parent eedc5ef7f7
commit c84816bddf

@ -1,11 +1,11 @@
#include "context.hh"
void Context::store(int position, json_spirit::Object& obj)
void Context::store(int position, size_t value)
{
obj_store.emplace( position, std::ref(obj) );
obj_store.emplace( position, value );
}
json_spirit::Object& Context::retrieve(int position)
size_t Context::retrieve(int position)
{
return obj_store.at(position);
}

@ -15,12 +15,13 @@ public:
// store and retrieve other parameters into the context.
// that allows semantic actions based on other function parameters
virtual void store(int position, json_spirit::Object& obj);
virtual json_spirit::Object& retrieve(int position);
// KISS: at the moment only "size_t" objects are supported.
virtual void store(int position, size_t value);
virtual size_t retrieve(int position);
virtual void clear();
private:
std::map<int, std::reference_wrapper<json_spirit::Object>> obj_store;
std::map<int, size_t> obj_store;
};
#endif // JSON_ADAPTER_CONTEXT_HH

Loading…
Cancel
Save