Extract filter so it can be injected

Signed-off-by: Thomas Lauf <thomas.lauf@tngtech.com>
This commit is contained in:
Thomas Lauf 2020-05-08 16:27:12 +02:00
parent 6e5236d472
commit 547bda5ef8
3 changed files with 4 additions and 3 deletions

View file

@ -40,10 +40,11 @@ int CmdGet (
std::vector <std::string> results;
std::vector <std::string> references = cli.getDomReferences ();
Interval filter;
for (auto& reference : references)
{
std::string value;
if (! domGet (database, rules, reference, value))
if (! domGet (database, filter, rules, reference, value))
throw format ("DOM reference '{1}' is not valid.", reference);
results.push_back (value);

View file

@ -35,6 +35,7 @@
////////////////////////////////////////////////////////////////////////////////
bool domGet (
Database& database,
Interval& filter,
const Rules& rules,
const std::string& reference,
std::string& value)
@ -104,7 +105,6 @@ bool domGet (
else if (pig.skipLiteral ("tracked."))
{
Interval filter;
auto tracked = getTracked (database, rules, filter);
int count = static_cast <int> (tracked.size ());

View file

@ -97,6 +97,6 @@ std::string joinQuotedIfNeeded(const std::string& glue, const std::set <std::str
std::string joinQuotedIfNeeded(const std::string& glue, const std::vector <std::string>& array);
// dom.cpp
bool domGet (Database&, const Rules&, const std::string&, std::string&);
bool domGet (Database&, Interval&, const Rules&, const std::string&, std::string&);
#endif