Commit 771029fe authored by twanvl's avatar twanvl

implemented reading of maps

parent 3a201da9
......@@ -77,7 +77,7 @@ class Reader {
/// Reads a shared_ptr from the input stream
template <typename T> void handle(shared_ptr<T>& pointer);
/// Reads a map from the input stream
template <typename K, typename V> void handle(map<K,V>& m);
template <typename V> void handle(map<String,V>& m);
/// Reads an IndexMap from the input stream, reads only keys that already exist in the map
template <typename K, typename V> void handle(IndexMap<K,V>& m);
/// Reads a Defaultable from the input stream
......@@ -176,9 +176,18 @@ void Reader::handle(shared_ptr<T>& pointer) {
handle(*pointer);
}
template <typename K, typename V>
void Reader::handle(map<K,V>& m) {
// TODO
template <typename V>
void Reader::handle(map<String, V>& m) {
while (true) {
// same as enterBlock
if (just_opened) moveNext(); // on the key of the parent block, first move inside it
if (indent != expected_indent) return; // not enough indentation
just_opened = true;
expected_indent += 1;
// now read the value
handle(m[key]);
exitBlock();
}
}
template <typename K, typename V>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment