From 9f8c4e02a7aac9cc276d95912c207f0fa012e1ac Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 15 Oct 2014 07:42:29 -0400 Subject: [PATCH] CLI - Implemented ::getFilter to extract all the non-PSEUDO, FILTER items. --- src/CLI.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/CLI.cpp b/src/CLI.cpp index 308f497da..59bbee1a1 100644 --- a/src/CLI.cpp +++ b/src/CLI.cpp @@ -287,6 +287,7 @@ void CLI::add (const std::string& arg) } //////////////////////////////////////////////////////////////////////////////// +// Extract all the FILTER-tagged items. const std::string CLI::getFilter () { // Remove all the syntactic sugar. @@ -295,28 +296,28 @@ const std::string CLI::getFilter () // TODO all the other types: att, attmod, pattern, id, uuid ... std::string filter = ""; - -// TODO Convert to _args. -/* - if (_filter.size ()) + if (_args.size ()) { - filter = "("; - - std::vector ::const_iterator i; - for (i = _filter.begin (); i != _filter.end (); ++i) + std::vector ::const_iterator a; + for (a = _args.begin (); a != _args.end (); ++a) { - if (i != _filter.begin ()) - filter += ' '; + if (a->hasTag ("FILTER") && + ! a->hasTag ("PSEUDO")) + { + if (filter != "") + filter += ' '; - filter += i->attribute ("raw"); + std::string term = a->attribute ("canonical"); + if (term == "") + term = a->attribute ("raw"); + + filter += term; + } } - - filter += ')'; } -*/ dump ("CLI::getFilter"); - return filter; + return "(" + filter + ")"; } ////////////////////////////////////////////////////////////////////////////////