Matches if the result of applying a given MatchFunction to an HTML node returns true.
More...
Matches if the result of applying a given MatchFunction to an HTML node returns true.
- Example:
GumboNode * div = ...;
GumboNode * span = ...;
return node->type == GUMBO_NODE_ELEMENT &&
node->v.element.tag == GUMBO_TAG_DIV;
};
assert( m_is_div.matches(div));
assert(!m_is_div.matches(span));
FunctionMatch(MatchFunction func)
Constructs a FunctionMatch that matches HTML nodes for which a given MatchFunction returns true.
std::function< bool(const GumboNode *)> MatchFunction
A type of std::function that receives an HTML element and returns a bool.
Definition at line 50 of file FunctionMatch.h.
◆ FunctionMatch()
Constructs a FunctionMatch that matches HTML nodes for which a given MatchFunction returns true.
- Parameters
-
func | The MatchFunction that will be applied to an HTML node. |
◆ matches()
bool hext::FunctionMatch::matches |
( |
const GumboNode * |
node | ) |
const |
|
overridevirtual |
Returns true if the result of calling the given MatchFunction with node as its first argument returns true.
- Parameters
-
node | The node which is to be matched. |
Implements hext::Match.
The documentation for this class was generated from the following file: