|
libhext: C++ Library Documentation 1.0.14-6065bc7
|
Matches HTML nodes that are the only child of their parent HTML element. More...
#include <OnlyChildMatch.h>


Public Types | |
| enum | Option { AnyType = 1 << 1 , OfType = 1 << 2 } |
| OnlyChildMatch's options. More... | |
Public Member Functions | |
| OnlyChildMatch (Option options=Option::AnyType) noexcept | |
| Constructs an OnlyChildMatch. | |
| bool | matches (const GumboNode *node) const noexcept override |
| Returns true if node is the only child of its parent. | |
Public Member Functions inherited from hext::Cloneable< OnlyChildMatch, Match > | |
| virtual std::unique_ptr< Match > | clone () const override |
| Clones objects of template type Derived and returns an owning pointer to the newly allocated Base. | |
Public Member Functions inherited from hext::Match | |
| Match () noexcept=default | |
| Match (const Match &)=default | |
| Match (Match &&) noexcept=default | |
| Match & | operator= (const Match &)=default |
| Match & | operator= (Match &&) noexcept=default |
| virtual | ~Match () noexcept=default |
Matches HTML nodes that are the only child of their parent HTML element.
The intent is to mimic the CSS pseudo-classes only-child and only-child-of-type.
See https://developer.mozilla.org/en-US/docs/Web/CSS/:only-child
Definition at line 37 of file OnlyChildMatch.h.
OnlyChildMatch's options.
| Enumerator | |
|---|---|
| AnyType | Count siblings of any type (:only-child). |
| OfType | Only count siblings of the same type (:only-child-of-type). |
Definition at line 41 of file OnlyChildMatch.h.
|
explicitnoexcept |
Constructs an OnlyChildMatch.
| options | See OnlyChildMatch::Option. Default: Count any element (:only-child). |
|
overridevirtualnoexcept |
Returns true if node is the only child of its parent.
Implements hext::Match.