![]() |
Mapper
0.9.0
API documentation
|
Utility to match objects based on tag values. More...
#include <object_query.h>
Classes | |
struct | LogicalOperands |
struct | StringOperands |
Public Types | |
enum | Operator { OperatorAnd = 1, OperatorOr = 2, OperatorIs = 16, OperatorIsNot = 17, OperatorContains = 18, OperatorSearch = 19, OperatorObjectText = 20, OperatorSymbol = 32, OperatorInvalid = 0 } |
Public Member Functions | |
ObjectQuery () noexcept | |
ObjectQuery (const ObjectQuery &query) | |
ObjectQuery (ObjectQuery &&proto) noexcept | |
ObjectQuery & | operator= (const ObjectQuery &proto) noexcept |
ObjectQuery & | operator= (ObjectQuery &&proto) noexcept |
~ObjectQuery () | |
operator bool () const noexcept | |
Returns true if the query is valid. More... | |
ObjectQuery (const QString &key, Operator op, const QString &value) | |
Constructs a query for a key and value. More... | |
ObjectQuery (Operator op, const QString &value) | |
Constructs a query for a value. More... | |
ObjectQuery (const ObjectQuery &first, Operator op, const ObjectQuery &second) | |
Constructs a query which connects two sub-queries. More... | |
ObjectQuery (ObjectQuery &&first, Operator op, ObjectQuery &&second) noexcept | |
Constructs a query which connects two sub-queries. More... | |
ObjectQuery (const Symbol *symbol) noexcept | |
Constructs a query for a particular symbol. More... | |
Operator | getOperator () const noexcept |
Returns the underlying operator. More... | |
bool | operator() (const Object *object) const |
Evaluates this query on the given object and returns whether it matches. More... | |
const LogicalOperands * | logicalOperands () const |
Returns the operands of logical query operations. More... | |
const StringOperands * | tagOperands () const |
Returns the operands of logical query operations. More... | |
const Symbol * | symbolOperand () const |
Returns the operand of symbol operations. More... | |
QString | toString () const |
Pretty print the query. More... | |
Static Public Member Functions | |
static QString | labelFor (Operator op) |
Returns a short label for the operator which can be used in the user interface. More... | |
Friends | |
bool | operator== (const ObjectQuery &lhs, const ObjectQuery &rhs) |
Utility to match objects based on tag values.
This class can be used with value semantics. It can be move-constructed and move-assigned in O(1). Normal copy-construction and assignment may involve expensive copying of the expression tree.
OperatorAnd and OperatorOr evaluate the left argument first. When constructing complex queries, left sub-query chains should be kept short in order to benefit from short circuiting the evaluation of these logical operators after evaluation of the left argument.
|
noexcept |
|
explicit |
|
noexcept |
OpenOrienteering::ObjectQuery::~ObjectQuery | ( | ) |
OpenOrienteering::ObjectQuery::ObjectQuery | ( | const QString & | key, |
ObjectQuery::Operator | op, | ||
const QString & | value | ||
) |
Constructs a query for a key and value.
OpenOrienteering::ObjectQuery::ObjectQuery | ( | ObjectQuery::Operator | op, |
const QString & | value | ||
) |
Constructs a query for a value.
Valid for OperatorSearch.
OpenOrienteering::ObjectQuery::ObjectQuery | ( | const ObjectQuery & | first, |
ObjectQuery::Operator | op, | ||
const ObjectQuery & | second | ||
) |
Constructs a query which connects two sub-queries.
The sub-queries are copied.
|
noexcept |
Constructs a query which connects two sub-queries.
|
noexcept |
Constructs a query for a particular symbol.
|
inlinenoexcept |
Returns the underlying operator.
|
static |
Returns a short label for the operator which can be used in the user interface.
const ObjectQuery::LogicalOperands * OpenOrienteering::ObjectQuery::logicalOperands | ( | ) | const |
Returns the operands of logical query operations.
|
inlinenoexcept |
Returns true if the query is valid.
Evaluates this query on the given object and returns whether it matches.
|
noexcept |
|
noexcept |
const Symbol * OpenOrienteering::ObjectQuery::symbolOperand | ( | ) | const |
Returns the operand of symbol operations.
const ObjectQuery::StringOperands * OpenOrienteering::ObjectQuery::tagOperands | ( | ) | const |
Returns the operands of logical query operations.
QString OpenOrienteering::ObjectQuery::toString | ( | ) | const |
Pretty print the query.
The output is meant to be formal language, for possible parsing.
|
friend |
LogicalOperands OpenOrienteering::ObjectQuery::subqueries |
SymbolOperand OpenOrienteering::ObjectQuery::symbol |
StringOperands OpenOrienteering::ObjectQuery::tags |