libhext: C++ Library Documentation
1.0.12-3ea013c
|
Matches HTML nodes having a certain position within their parent HTML element. More...
Public Types | |
enum | Option { First = 1 << 1 , Last = 1 << 2 , OfType = 1 << 3 } |
NthChildMatch's options. More... | |
Public Member Functions | |
NthChildMatch (int step, int shift, Option options=Option::First) noexcept | |
Constructs an NthChildMatch with the pattern <step * n + shift>. More... | |
NthChildMatch (std::pair< int, int > step_and_shift, Option options=Option::First) noexcept | |
Constructs an NthChildMatch with the pattern <step * n + shift>, where step and shift is given as a std::pair. More... | |
bool | matches (const GumboNode *node) const noexcept override |
Returns true if HTML node matches pattern <step * n + shift>. More... | |
Public Member Functions inherited from hext::Cloneable< NthChildMatch, 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. More... | |
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 having a certain position within their parent HTML element.
The intent is to mimic the following CSS pseudo-classes: nth-child, nth-of-type, nth-last-of-type, first-of-type, last-of-type, first-child, last-child, nth-last-child, nth-last-of-type
See https://developer.mozilla.org/en-US/docs/Web/CSS/%3Anth-child for a detailed explanation.
Definition at line 88 of file NthChildMatch.h.
NthChildMatch's options.
Enumerator | |
---|---|
First | Count preceding siblings (:nth-child). |
Last | Count following siblings (:nth-last-child). |
OfType | Only count siblings of the same type (:nth-of-type). |
Definition at line 92 of file NthChildMatch.h.
|
noexcept |
Constructs an NthChildMatch with the pattern <step * n + shift>.
step | The step of the pattern. |
shift | The shift of the pattern. |
options | See NthChildMatch::Option. Default: Count any preceding HTML element. |
|
explicitnoexcept |
Constructs an NthChildMatch with the pattern <step * n + shift>, where step and shift is given as a std::pair.
step_and_shift | The step and shift of the pattern. |
options | See NthChildMatch::Option. Default: Count any preceding HTML element. |
|
overridevirtualnoexcept |
Returns true if HTML node matches pattern <step * n + shift>.
node | A pointer to a GumboNode. |
Implements hext::Match.