From 0060093e9ed53a32570fab1c18da8074926520d1 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 21 Feb 2015 11:20:55 -0800 Subject: 806 - start parsing reagent metadata --- cpp/010vm | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'cpp/010vm') 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(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; -- cgit 1.4.1-2-gfad0