diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-02-21 11:20:55 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-02-21 11:20:55 -0800 |
commit | 0060093e9ed53a32570fab1c18da8074926520d1 (patch) | |
tree | 5f282a3c967864266a9941170411693c99b57417 /cpp/010vm | |
parent | d5595f0ce1a91b23f13fbb594fbcf0f65d3e8991 (diff) | |
download | mu-0060093e9ed53a32570fab1c18da8074926520d1.tar.gz |
806 - start parsing reagent metadata
Diffstat (limited to 'cpp/010vm')
-rw-r--r-- | cpp/010vm | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/cpp/010vm b/cpp/010vm index c5012c93..cf064581 100644 --- a/cpp/010vm +++ b/cpp/010vm @@ -141,7 +141,12 @@ void setup_recipes() { types.push_back(Type_number[t]); } //? cout << types.size() << '\n'; //? 1 - // todo: properties + // properties + while (!in.eof()) { + istringstream prop(slurp_until(in, '/')); + string name = slurp_until(prop, ':'); + properties.push_back(pair<string, property>(name, property())); + } } string reagent::to_string() { ostringstream out; @@ -150,7 +155,17 @@ void setup_recipes() { out << types[i]; if (i < types.size()-1) out << "-"; } - out << "}"; // todo: properties + if (!properties.empty()) { + out << ", property: "; + for (size_t i = 0; i < properties.size(); ++i) { + out << properties[i].first << ":"; + for (size_t j = 0; j < properties[i].second.values.size(); ++j) { + out << properties[i].second.values[j]; + if (j < properties[i].second.values.size()-1) out << ":"; + } + } + } + out << "}"; return out.str(); } @@ -159,6 +174,7 @@ string slurp_until(istream& in, char delim) { char c; while (in >> c) { if (c == delim) { + // drop the delim break; } out << c; |