diff options
-rw-r--r-- | build/b.cxx | 2 | ||||
-rw-r--r-- | build/config/operation.cxx | 8 | ||||
-rw-r--r-- | build/cxx/rule.cxx | 2 | ||||
-rw-r--r-- | build/dump.cxx | 4 | ||||
-rw-r--r-- | build/parser.cxx | 22 | ||||
-rw-r--r-- | build/variable | 14 | ||||
-rw-r--r-- | build/variable.cxx | 12 |
7 files changed, 31 insertions, 33 deletions
diff --git a/build/b.cxx b/build/b.cxx index 49abe5c..49fb027 100644 --- a/build/b.cxx +++ b/build/b.cxx @@ -573,7 +573,7 @@ main (int argc, char* argv[]) // if (auto v = rs.ro_variables ()["subprojects"]) { - for (const name& n: v.as<const list_value&> ().data) + for (const name& n: v.as<const list_value&> ()) { // Should be a list of directories. // diff --git a/build/config/operation.cxx b/build/config/operation.cxx index e62d313..85d0d07 100644 --- a/build/config/operation.cxx +++ b/build/config/operation.cxx @@ -123,8 +123,8 @@ namespace build // const list_value& lv (dynamic_cast<const list_value&> (*pval)); - ofs << var.name << " = " << lv.data << endl; - //text << var.name << " = " << lv.data; + ofs << var.name << " = " << lv << endl; + //text << var.name << " = " << lv; } else { @@ -180,7 +180,7 @@ namespace build // if (auto v = root.ro_variables ()["subprojects"]) { - for (const name& n: v.as<const list_value&> ().data) + for (const name& n: v.as<const list_value&> ()) { path out_nroot (out_root / n.dir); scope& nroot (scopes.find (out_nroot)); @@ -274,7 +274,7 @@ namespace build // if (auto v = root.ro_variables ()["subprojects"]) { - for (const name& n: v.as<const list_value&> ().data) + for (const name& n: v.as<const list_value&> ()) { // Create and bootstrap subproject's root scope. // diff --git a/build/cxx/rule.cxx b/build/cxx/rule.cxx index daa76e0..b4cfb1c 100644 --- a/build/cxx/rule.cxx +++ b/build/cxx/rule.cxx @@ -31,7 +31,7 @@ namespace build { if (auto val = s[var]) { - for (const name& n: val.as<const list_value&> ().data) + for (const name& n: val.as<const list_value&> ()) { if (!n.type.empty () || !n.dir.empty ()) fail << "expected option instead of " << n << diff --git a/build/dump.cxx b/build/dump.cxx index 5ba7269..6c1cdcf 100644 --- a/build/dump.cxx +++ b/build/dump.cxx @@ -62,12 +62,12 @@ namespace build << ind << var.name << " = "; if (val == nullptr) - cerr << "[undefined]"; + cerr << "[null]"; else { //@@ TODO: assuming it is a list. // - cerr << dynamic_cast<list_value&> (*val).data; + cerr << dynamic_cast<list_value&> (*val); } vb = true; diff --git a/build/parser.cxx b/build/parser.cxx index 24a1e98..4d5cbbe 100644 --- a/build/parser.cxx +++ b/build/parser.cxx @@ -447,7 +447,7 @@ namespace build if (!v) return; - for (const name& n: v.as<const list_value&> ().data) + for (const name& n: v.as<const list_value&> ()) { // Should be a list of directories. // @@ -706,7 +706,7 @@ namespace build { //@@ TODO: assuming it is a list. // - dynamic_cast<list_value&> (*val).data = move (vns); + dynamic_cast<list_value&> (*val) = move (vns); } } else @@ -719,14 +719,14 @@ namespace build if (val.scope != scope_) // Append to value from parent scope? { - list_value_ptr nval (new list_value (lv->data)); + list_value_ptr nval (new list_value (*lv)); lv = nval.get (); // Append to. scope_->variables.emplace (var, move (nval)); } - lv->data.insert (lv->data.end (), - make_move_iterator (vns.begin ()), - make_move_iterator (vns.end ())); + lv->insert (lv->end (), + make_move_iterator (vns.begin ()), + make_move_iterator (vns.end ())); } else // Initialization. { @@ -944,7 +944,7 @@ namespace build // const list_value& lv (val.as<list_value&> ()); - if (lv.data.empty ()) + if (lv.empty ()) continue; // Should we accumulate? If the buffer is not empty, then @@ -960,11 +960,11 @@ namespace build // This should be a simple value or a simple directory. The // token still points to the name (or closing paren). // - if (lv.data.size () > 1) + if (lv.size () > 1) fail (t) << "concatenating expansion of " << var.name << " contains multiple values"; - const name& n (lv.data[0]); + const name& n (lv[0]); if (!n.type.empty ()) fail (t) << "concatenating expansion of " << var.name @@ -986,7 +986,7 @@ namespace build // Copy the names from the variable into the resulting name list // while doing sensible things with the types and directories. // - for (const name& n: lv.data) + for (const name& n: lv) { const path* dp1 (dp); const string* tp1 (tp); @@ -1036,7 +1036,7 @@ namespace build n.value); } - count = lv.data.size (); + count = lv.size (); } continue; diff --git a/build/variable b/build/variable index 67ec33c..1365d54 100644 --- a/build/variable +++ b/build/variable @@ -64,26 +64,24 @@ namespace build ~value () = default; }; - struct list_value: value + struct list_value: value, names { - names data; - public: - list_value (names d): data (std::move (d)) {} - list_value (std::string d) {data.emplace_back (std::move (d));} + list_value (names d): names (std::move (d)) {} + list_value (std::string d) {emplace_back (std::move (d));} // Note: stored in name as a directory. // - list_value (path d) {data.emplace_back (std::move (d));} + list_value (path d) {emplace_back (std::move (d));} virtual value_ptr - clone () const {return value_ptr (new list_value (data));} + clone () const {return value_ptr (new list_value (*this));} virtual bool compare (const value& v) const { const list_value* lv (dynamic_cast<const list_value*> (&v)); - return lv != nullptr && data == lv->data; + return lv != nullptr && static_cast<const names&> (*this) == *lv; } }; typedef std::unique_ptr<list_value> list_value_ptr; diff --git a/build/variable.cxx b/build/variable.cxx index 56d5a08..7067d9b 100644 --- a/build/variable.cxx +++ b/build/variable.cxx @@ -28,12 +28,12 @@ namespace build as<const string&> () const { const list_value& lv (as<list_value&> ()); - assert (lv.data.size () < 2); + assert (lv.size () < 2); - if (lv.data.empty ()) + if (lv.empty ()) return empty_string; - const name& n (lv.data.front ()); + const name& n (lv.front ()); assert (n.type.empty () && n.dir.empty ()); return n.value; @@ -46,12 +46,12 @@ namespace build as<const path&> () const { const list_value& lv (as<list_value&> ()); - assert (lv.data.size () < 2); + assert (lv.size () < 2); - if (lv.data.empty ()) + if (lv.empty ()) return empty_path; - const name& n (lv.data.front ()); + const name& n (lv.front ()); assert (n.type.empty () && n.value.empty ()); return n.dir; |