Union::Selector Class

class Union::Selector

A class to handle matching some data to an element. More...

Header: #include <Selector>
CMake: find_package(Union REQUIRED)
target_link_libraries(mytarget PRIVATE Union::Union)

Public Functions

bool isValid() const
bool matches(std::shared_ptr<Union::Element> element) const
QString toString() const
int weight() const

Static Public Members

Union::Selector create()
Union::Selector create(DataType &&data)
enum class SelectorType { Empty, Type, Id, State, ColorSet, …, AllOf }
QDebug operator<<(QDebug debug, const Union::Selector &selector)

Detailed Description

Member Function Documentation

[static] Union::Selector Selector::create()

Create an empty, invalid selector.

[static] template <Union::SelectorType type, typename DataType> Union::Selector Selector::create(DataType &&data)

This function overloads Union::Selector::create().

Create a new selector of a specific type.

See SelectorType for the available types.

data The data to match on.

bool Selector::isValid() const

Returns whether this selector is valid.

An invalid selector will never match anything.

bool Selector::matches(std::shared_ptr<Union::Element> element) const

Returns whether this selector matches an element.

element The element to match against.

QString Selector::toString() const

Return a string representation of this selector.

int Selector::weight() const

Returns the weight of this selector.

Related Non-Members

enum class SelectorType

The type of selector.

ConstantValueDescription
Union::Selector::SelectorType::Empty0An empty selector, which does nothing.
Union::Selector::SelectorType::Type1A selector matching on the type property. Checks if the specified string is equal to that of the property.
Union::Selector::SelectorType::Id2A selector matching on the id property. Checks if the specified string is equal to that of the property.
Union::Selector::SelectorType::State3A selector matching on the state property. Checks if the specified state is set in the property.
Union::Selector::SelectorType::ColorSet4 
Union::Selector::SelectorType::Hint5 
Union::Selector::SelectorType::Attribute6A selector matching on an attribute in the attributes property. Checks if the value of the attribute matches the specified value.
Union::Selector::SelectorType::AnyOf7A selector that will match if any of the specified selectors match.
Union::Selector::SelectorType::AllOf8A selector that will match only if all of the specified selectors match.

QDebug operator<<(QDebug debug, const Union::Selector &selector)

QDebug support for Selector.