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

Matches HTML nodes for which every given Match returns false. More...

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

Public Member Functions

 NegateMatch (std::vector< std::unique_ptr< Match >> v_matches={}) noexcept
 Constructs a NegateMatch that matches nodes for which every contained Match returns false. More...
 
 NegateMatch (std::unique_ptr< Match > match)
 Constructs a NegateMatch and appends a Match. More...
 
 ~NegateMatch () noexcept=default
 
 NegateMatch (NegateMatch &&other) noexcept=default
 
 NegateMatch (const NegateMatch &other)
 
NegateMatchoperator= (NegateMatch &&other) noexcept=default
 
NegateMatchoperator= (const NegateMatch &other)
 
void append_match (std::unique_ptr< Match > match)
 Appends a Match. More...
 
bool matches (const GumboNode *node) const override
 Returns true if every contained Match returns false for node. More...
 
- Public Member Functions inherited from hext::Cloneable< NegateMatch, 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 nodes for which every given Match returns false.

Example:
GumboNode * attr_none = ...; // <hr/>
GumboNode * attr_one = ...; // <h1 class="main-heading"></h1>
GumboNode * attr_two = ...; // <div id="cart" class="my-cart"></div>
NegateMatch not_one (std::make_unique<AttributeCountMatch>(1));
NegateMatch not_none(std::make_unique<AttributeCountMatch>(0));
assert(!not_none.matches(attr_none));
assert( not_none.matches(attr_one));
assert( not_none.matches(attr_two));
assert( not_one.matches(attr_none));
assert(!not_one.matches(attr_one));
assert( not_one.matches(attr_two));

Definition at line 52 of file NegateMatch.h.

Constructor & Destructor Documentation

hext::NegateMatch::NegateMatch ( std::vector< std::unique_ptr< Match >>  v_matches = {})
explicitnoexcept

Constructs a NegateMatch that matches nodes for which every contained Match returns false.

Parameters
v_matchesAn optional vector containing Matches.
hext::NegateMatch::NegateMatch ( std::unique_ptr< Match match)
explicit

Constructs a NegateMatch and appends a Match.

Parameters
matchThe Match to append.
hext::NegateMatch::~NegateMatch ( )
defaultnoexcept
hext::NegateMatch::NegateMatch ( NegateMatch &&  other)
defaultnoexcept
hext::NegateMatch::NegateMatch ( const NegateMatch other)

Member Function Documentation

void hext::NegateMatch::append_match ( std::unique_ptr< Match match)

Appends a Match.

Parameters
matchThe Match to append.
bool hext::NegateMatch::matches ( const GumboNode *  node) const
overridevirtual

Returns true if every contained Match returns false for node.

Parameters
nodeA pointer to a GumboNode.

Implements hext::Match.

NegateMatch& hext::NegateMatch::operator= ( NegateMatch &&  other)
defaultnoexcept
NegateMatch& hext::NegateMatch::operator= ( const NegateMatch other)

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