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 | isCombinator() const |
bool | isValid() const |
bool | matches(Union::Element *element) const |
QString | toString() const |
Union::SelectorType | type() const |
int | weight() const |
Static Public Members
Union::Selector | create() |
Union::Selector | create(DataType &&data) |
Union::Selector | create(Union::SelectorType _t = type) |
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)
Create a new selector of a specific type.
See SelectorType for the available types.
data The data to match on.
This function overloads Union::Selector::create().
[static]
template <Union::SelectorType type> Union::Selector Selector::create(Union::SelectorType _t = type)
Create a new selector of a specific type, that doesn't need any data.
This function overloads Union::Selector::create().
bool Selector::isCombinator() const
Return whether this selector is a combinator.
bool Selector::isValid() const
Returns whether this selector is valid.
An invalid selector will never match anything.
bool Selector::matches(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.
Union::SelectorType Selector::type() const
Returns the type of 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 | ? | A selector matching on an attribute in the attributes property. Checks if the value of the attribute matches the specified value. |
Union::Selector::SelectorType::AnyElement | 9 | A selector that matches anything. Note that this has a low weight and most other selectors will override it. |
Union::Selector::SelectorType::AnyOf | ? | A selector that will match if any of the specified selectors match. |
Union::Selector::SelectorType::AllOf | ? | 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.