libhext: C++ Library Documentation  1.0.12-3ea013c
Public Member Functions | List of all members
hext::FunctionValueMatch Class Referencefinal

Matches if the result of applying a given CaptureFunction to an HTML node passes a ValueTest. More...

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

Public Member Functions

 FunctionValueMatch (CaptureFunction func, std::unique_ptr< ValueTest > value_test)
 Constructs a FunctionValueMatch that matches HTML nodes for which a given CaptureFunction returns a result that passes a ValueTest. More...
 
 ~FunctionValueMatch () noexcept override=default
 
 FunctionValueMatch (FunctionValueMatch &&other)=default
 
 FunctionValueMatch (const FunctionValueMatch &other)
 
FunctionValueMatchoperator= (FunctionValueMatch &&other)=default
 
FunctionValueMatchoperator= (const FunctionValueMatch &other)
 
bool matches (const GumboNode *node) const override
 Returns true if the result of calling the given CaptureFunction with node as its first argument passes the given ValueTest. More...
 
- Public Member Functions inherited from hext::Cloneable< FunctionValueMatch, 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 if the result of applying a given CaptureFunction to an HTML node passes a ValueTest.

Example:
GumboNode * foo = ...; // <div>This is a foo!</div>
GumboNode * bar = ...; // <div>This is a bar!</div>
InnerHtmlBuiltin, // CaptureFunction
std::unique_ptr<ContainsTest>("foo") // ValueTest
);
InnerHtmlBuiltin, // CaptureFunction
std::unique_ptr<ContainsTest>("bar") // ValueTest
);
assert(m_foo.matches(foo));
assert(m_bar.matches(bar));
assert(!m_foo.matches(bar));
assert(!m_bar.matches(foo));
FunctionValueMatch(CaptureFunction func, std::unique_ptr< ValueTest > value_test)
Constructs a FunctionValueMatch that matches HTML nodes for which a given CaptureFunction returns a r...
HEXT_PUBLIC const CaptureFunction InnerHtmlBuiltin
A CaptureFunction that returns the inner HTML of an HTML element.

Definition at line 58 of file FunctionValueMatch.h.

Constructor & Destructor Documentation

◆ FunctionValueMatch() [1/3]

hext::FunctionValueMatch::FunctionValueMatch ( CaptureFunction  func,
std::unique_ptr< ValueTest value_test 
)

Constructs a FunctionValueMatch that matches HTML nodes for which a given CaptureFunction returns a result that passes a ValueTest.

Parameters
funcThe CaptureFunction that will be applied to an HTML node.
value_testThe ValueTest that the result of the given CaptureFunction must pass.

◆ ~FunctionValueMatch()

hext::FunctionValueMatch::~FunctionValueMatch ( )
overridedefaultnoexcept

◆ FunctionValueMatch() [2/3]

hext::FunctionValueMatch::FunctionValueMatch ( FunctionValueMatch &&  other)
default

◆ FunctionValueMatch() [3/3]

hext::FunctionValueMatch::FunctionValueMatch ( const FunctionValueMatch other)

Member Function Documentation

◆ matches()

bool hext::FunctionValueMatch::matches ( const GumboNode *  node) const
overridevirtual

Returns true if the result of calling the given CaptureFunction with node as its first argument passes the given ValueTest.

Parameters
nodeA pointer to a GumboNode.

Implements hext::Match.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

FunctionValueMatch& hext::FunctionValueMatch::operator= ( FunctionValueMatch &&  other)
default

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