Donner
C++20 SVG rendering library
Loading...
Searching...
No Matches
donner::css::TypeSelector Struct Reference

Selector which matches the element type, e.g. More...

#include "donner/css/selectors/TypeSelector.h"

Collaboration diagram for donner::css::TypeSelector:
[legend]

Public Member Functions

 TypeSelector (XMLQualifiedName &&matcher)
 Create a TypeSelector with the given namespace and name.
 
 TypeSelector (const XMLQualifiedNameRef &matcher)
 Create a TypeSelector with the given namespace and name.
 
 ~TypeSelector () noexcept=default
 Destructor.
 
 TypeSelector (TypeSelector &&)=default
 Move constructor.
 
TypeSelectoroperator= (TypeSelector &&)=default
 Move assignment operator.
 
 TypeSelector (const TypeSelector &)=default
 Copy constructor.
 
TypeSelectoroperator= (const TypeSelector &)=default
 Copy assignment operator.
 
bool isUniversal () const
 Returns true if this is a universal selector.
 
bool isValid () const
 Returns true if this is a valid selector.
 
template<ElementLike T>
bool matches (const T &element) const
 Returns true if the provided element matches this selector.
 

Public Attributes

XMLQualifiedName matcher
 Selector matcher itself, which may contain wildcards.
 

Friends

std::ostream & operator<< (std::ostream &os, const TypeSelector &obj)
 Ostream output operator for TypeSelector, outputs a debug string e.g. TypeSelector(div).
 

Detailed Description

Selector which matches the element type, e.g.

div or circle. The selector may also include a namespace, or be a universal selector.

In the CSS source, this is represented by either a standalone type, or namespace and type separated by a pipe (|). Either the namespace or the type may be a wildcard (*).

  • type
  • *
  • ns|type
  • ns|*
  • *|type

TypeSelector represents the parsed representation, if no namespace is provided it will be an empty string.

Constructor & Destructor Documentation

◆ TypeSelector() [1/2]

donner::css::TypeSelector::TypeSelector ( XMLQualifiedName && matcher)
inline

Create a TypeSelector with the given namespace and name.

Parameters
matcherSelector matcher, which may be a wildcard. If the namespace is "*", it will match every namespaces. If the name is "*", it will match every attribute in its namespace.

◆ TypeSelector() [2/2]

donner::css::TypeSelector::TypeSelector ( const XMLQualifiedNameRef & matcher)
inline

Create a TypeSelector with the given namespace and name.

Parameters
matcherSelector matcher, which may be a wildcard. If the namespace is "*", it will match every namespaces. If the name is "*", it will match every attribute in its namespace.

Member Function Documentation

◆ matches()

template<ElementLike T>
bool donner::css::TypeSelector::matches ( const T & element) const
inline

Returns true if the provided element matches this selector.

Parameters
elementThe element to check.

Member Data Documentation

◆ matcher

XMLQualifiedName donner::css::TypeSelector::matcher

Selector matcher itself, which may contain wildcards.

In this context, the members have the following meanings:


The documentation for this struct was generated from the following file: