libhext: C++ Library Documentation  1.0.9-c8ac8b6
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 noexcept override
 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 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
 
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 *&zwj;/ 0);
AttributeCountMatch m_two_attr(/* attribute count *&zwj;/ 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));
AttributeCountMatch(unsigned int attribute_count) noexcept
Constructs an AttributeCountMatch that matches HTML elements that have a certain amount of HTML attri...

Definition at line 47 of file AttributeCountMatch.h.

Constructor & Destructor Documentation

◆ AttributeCountMatch()

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

◆ matches()

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: