diff --git a/src/dom.cpp b/src/dom.cpp index a1056d89..681f8a36 100644 --- a/src/dom.cpp +++ b/src/dom.cpp @@ -99,17 +99,9 @@ bool domGet ( { // Generate a unique, ordered list of tags. std::set tags; - for (auto& line : database.allLines ()) - { - if (line[0] == 'i') - { - Interval interval; - interval.initialize (line); - - for (auto& tag : interval.tags ()) - tags.insert (tag); - } - } + for (auto& interval : getAllInclusions (database)) + for (auto& tag : interval.tags ()) + tags.insert (tag); // dom.tag.count if (pig.skipLiteral ("count")) @@ -118,6 +110,20 @@ bool domGet ( return true; } + // dom.tag. + int n; + if (pig.getDigits (n)) + { + if (n <= static_cast (tags.size ())) + { + std::vector all; + for (auto& tag : tags) + all.push_back (tag); + + value = format ("{1}", all[n - 1]); + return true; + } + } } }