Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
Utilities to support working with predicate queries.
Definition in file query-util.hpp.
Functions | |
string | appendTerms (string const &pred1, string const &pred2) |
template<typename TY > | |
const string | buildTypeID () |
uint | countPred (const string &) |
count the top-level predicates in the query string. More... | |
string | extractID (Symbol sym, const string &termString) |
(preliminary) helper: instead of really parsing and evaluating the terms, just do a regular expression match to extract the literal argument behind the given predicate symbol. More... | |
bool | hasTerm (Symbol sym, string const &queryString) |
void | normaliseID (string &id) |
ensure standard format for a given id string. More... | |
string | removeTerm (Symbol sym, string &queryString) |
(preliminary) helper: cut a term with the given symbol. More... | |
Namespaces | |
lib | |
Implementation namespace for support and library code. | |
void normaliseID | ( | string & | id | ) |
ensure standard format for a given id string.
Trim, sanitise and ensure the first letter is lower case.
Definition at line 52 of file query-util.cpp.
References lib::query::normaliseID().
Referenced by QueryUtils_test::check_normaliseID(), and lib::query::normaliseID().
uint countPred | ( | const string & | q | ) |
count the top-level predicates in the query string.
usable for ordering queries, as more predicates usually mean more conditions, i.e. more constriction
Definition at line 137 of file query-util.cpp.
References lib::query::countPred().
Referenced by QueryUtils_test::check_countPred(), and lib::query::countPred().
string extractID | ( | Symbol | sym, |
const string & | termString | ||
) |
(preliminary) helper: instead of really parsing and evaluating the terms, just do a regular expression match to extract the literal argument behind the given predicate symbol.
e.g calling extractID ("stream", "id(abc), stream(mpeg)")
yields "mpeg"
Definition at line 92 of file query-util.cpp.
References lib::query::extractID().
Referenced by QueryUtils_test::check_extractID(), and lib::query::extractID().
string removeTerm | ( | Symbol | sym, |
string & | queryString | ||
) |
(preliminary) helper: cut a term with the given symbol.
The term is matched, removed from the original string and returned
Definition at line 109 of file query-util.cpp.
References lib::query::removeTerm().
Referenced by QueryUtils_test::check_removeTerm(), and lib::query::removeTerm().
string appendTerms | ( | string const & | pred1, |
string const & | pred2 | ||
) |
Definition at line 152 of file query-util.cpp.
References lib::query::appendTerms().
Referenced by lib::query::appendTerms().