All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
hext::ChildCountMatch Class Referencefinal

Matches HTML elements that have a certain amount of children of type element (excluding text nodes, document nodes and others). More...

Inheritance diagram for hext::ChildCountMatch:
Inheritance graph
[legend]
Collaboration diagram for hext::ChildCountMatch:
Collaboration graph
[legend]

Public Member Functions

 ChildCountMatch (unsigned int child_count) noexcept
 Construct a ChildCountMatch that matches HTML elements with a child_count amount of children. More...
 
bool matches (const GumboNode *node) const noexceptoverride
 Return true if node has child_count amount of children. More...
 
- Public Member Functions inherited from hext::Cloneable< ChildCountMatch, Match >
virtual std::unique_ptr< Matchclone () const
 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
 
Matchoperator= (const Match &)=default
 
Matchoperator= (Match &&) noexcept=default
 
virtual ~Match () noexcept=default
 

Detailed Description

Matches HTML elements that have a certain amount of children of type element (excluding text nodes, document nodes and others).

Example:
GumboNode * none = ...; // <div>Text nodes are ignored</div>
GumboNode * two = ...; // <ul><li>first</li><li>last</li></ul>
ChildCountMatch m_none(/* child count */ 0);
ChildCountMatch m_two (/* child count */ 2);
assert( m_none.matches(none));
assert(!m_none.matches(two));
assert( m_two.matches(two));
assert(!m_two.matches(none));

Definition at line 47 of file ChildCountMatch.h.

Constructor & Destructor Documentation

hext::ChildCountMatch::ChildCountMatch ( unsigned int  child_count)
explicitnoexcept

Construct a ChildCountMatch that matches HTML elements with a child_count amount of children.

Member Function Documentation

bool hext::ChildCountMatch::matches ( const GumboNode *  node) const
overridevirtualnoexcept

Return true if node has child_count amount of children.

Parameters
nodeA pointer to a GumboNode of type GUMBO_NODE_ELEMENT.

Implements hext::Match.


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