All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
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=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
 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));

Definition at line 57 of file FunctionValueMatch.h.

Constructor & Destructor Documentation

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.
hext::FunctionValueMatch::~FunctionValueMatch ( )
defaultnoexcept
hext::FunctionValueMatch::FunctionValueMatch ( FunctionValueMatch &&  other)
default
hext::FunctionValueMatch::FunctionValueMatch ( const FunctionValueMatch other)

Member Function Documentation

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.

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

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