diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-13 12:20:27 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-07-13 12:20:27 +0200 |
commit | 70613e9be046c9cddd2486505a44d3a0324d6d95 (patch) | |
tree | 48068dc88aca74f3587ea61cc47f8a4676107564 /build/variable | |
parent | bef7c36a3479b9b83eaf4be9ef090b21d6468f12 (diff) |
Implement subproject import
Diffstat (limited to 'build/variable')
-rw-r--r-- | build/variable | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/build/variable b/build/variable index 2bb3393..835fde1 100644 --- a/build/variable +++ b/build/variable @@ -84,6 +84,19 @@ namespace build const list_value* lv (dynamic_cast<const list_value*> (&v)); return lv != nullptr && static_cast<const names&> (*this) == *lv; } + + // Pair (i.e., key-value) search. Note that this funtion assumes + // the list contains only pairs and keys are simple names. Returns + // NULL if not found. + // + const name* + find_pair (const std::string& key) const + { + for (auto i (begin ()); i != end (); i += 2) + if (i->value == key) + return &*++i; + return nullptr; + } }; typedef std::unique_ptr<list_value> list_value_ptr; |