Union::Selector Class
class Union::SelectorA 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
Related Non-Members
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.
Constant | Value | Description |
---|---|---|
Union::Selector::SelectorType::Empty | 0 | An empty selector, which does nothing. |
Union::Selector::SelectorType::Type | 1 | A selector matching on the type property. Checks if the specified string is equal to that of the property. |
Union::Selector::SelectorType::Id | 2 | A selector matching on the id property. Checks if the specified string is equal to that of the property. |
Union::Selector::SelectorType::State | 3 | A selector matching on the state property. Checks if the specified state is set in the property. |
Union::Selector::SelectorType::ColorSet | 4 | |
Union::Selector::SelectorType::Hint | 5 | |
Union::Selector::SelectorType::Attribute | 6 | A selector matching on an attribute in the attributes property. Checks if the value of the attribute matches the specified value. |
Union::Selector::SelectorType::AnyOf | 7 | A selector that will match if any of the specified selectors match. |
Union::Selector::SelectorType::AllOf | 8 | A selector that will match only if all of the specified selectors match. |
QDebug operator<<(QDebug debug, const Union::Selector &selector)
QDebug support for Selector.