libhext: C++ Library Documentation  1.0.12-3ea013c
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 override=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 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 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));
NegateMatch(std::vector< std::unique_ptr< Match >> v_matches={}) noexcept
Constructs a NegateMatch that matches nodes for which every contained Match returns false.

Definition at line 53 of file NegateMatch.h.

Constructor & Destructor Documentation

◆ NegateMatch() [1/4]

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.

◆ NegateMatch() [2/4]

hext::NegateMatch::NegateMatch ( std::unique_ptr< Match match)
explicit

Constructs a NegateMatch and appends a Match.

Parameters
matchThe Match to append.

◆ ~NegateMatch()

hext::NegateMatch::~NegateMatch ( )
overridedefaultnoexcept

◆ NegateMatch() [3/4]

hext::NegateMatch::NegateMatch ( NegateMatch &&  other)
defaultnoexcept

◆ NegateMatch() [4/4]

hext::NegateMatch::NegateMatch ( const NegateMatch other)

Member Function Documentation

◆ append_match()

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

Appends a Match.

Parameters
matchThe Match to append.

◆ matches()

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.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

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