Class condition

Class Documentation

class condition

The interface class for conditions. This uses the bridge pattern, which means the implementation is in the member m_impl.

Public Functions

inline condition()

Construct a new, empty condition object.

inline explicit condition(condition_impl *impl)

Construct a new condition object with implementation impl.

Parameters

impl – The implementation to use

condition(const condition&) = delete
inline condition(condition &&rhs) noexcept

Construct a new condition object moving the data from rhs.

condition &operator=(const condition&) = delete
inline condition &operator=(condition &&rhs) noexcept

Assignment operator moving the data from rhs.

inline ~condition()
void prepare(const category &c)

Prepare the condition to be used on category c. This will take care of setting the correct indices for fields e.g.

Parameters

c – The category this query should act upon

inline bool operator()(row_handle r) const

This operator returns true if the row referenced by r is a match for this condition.

Parameters

r – The reference to a row.

Returns

true If there is a match

Returns

false If there is no match

inline explicit operator bool()

Return true if the condition is not empty.

inline bool empty() const

Return true if the condition is empty, has no condition.

inline std::optional<row_handle> single() const

If the prepare step found out there is only one hit this single hit can be returned by this method.

Returns

std::optional<row_handle> The result will contain a row reference if there is a single hit, it will be empty otherwise

inline void swap(condition &rhs)

Swap two conditions.

Friends

friend condition operator||(condition &&a, condition &&b)

Return a condition which is the logical OR or condition and

friend condition operator&&(condition &&a, condition &&b)

Return a condition which is the logical AND or condition and

inline friend std::ostream &operator<<(std::ostream &os, const condition &cond)

Operator to use to write out a condition to os, for debugging purposes.

Parameters
  • os – The std::ostream to write to

  • cond – The condition to write

Returns

std::ostream& The same as os