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

Matches HTML elements that have a certain amount of HTML attributes. More...

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

Public Member Functions

 AttributeCountMatch (unsigned int attribute_count) noexcept
 Constructs an AttributeCountMatch that matches HTML elements that have a certain amount of HTML attributes. More...
 
bool matches (const GumboNode *node) const noexceptoverride
 Returns true if node has exactly attribute_count amount of HTML attributes. More...
 
- Public Member Functions inherited from hext::Cloneable< AttributeCountMatch, 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 HTML attributes.

Example:
GumboNode * no_attrs = ...; // <hr/>
GumboNode * two_attrs = ...; // <img class="picture" src="mona-lisa.jpg"/>
AttributeCountMatch m_no_attr (/* attribute count */ 0);
AttributeCountMatch m_two_attr(/* attribute count */ 2);
assert(m_no_attr.matches(no_attrs));
assert(m_two_attr.matches(two_attrs));
assert(!m_two_attr.matches(no_attrs));
assert(!m_no_attr.matches(two_attrs));

Definition at line 46 of file AttributeCountMatch.h.

Constructor & Destructor Documentation

hext::AttributeCountMatch::AttributeCountMatch ( unsigned int  attribute_count)
explicitnoexcept

Constructs an AttributeCountMatch that matches HTML elements that have a certain amount of HTML attributes.

Parameters
attribute_countThe amount of HTML attributes a node must have in order to match.

Member Function Documentation

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

Returns true if node has exactly attribute_count amount of HTML attributes.

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: