|
crawlserv++
[under development]
Application for crawling and analyzing textual content of websites.
|
Implements a RegEx query using the PCRE2 library. More...
#include <RegEx.hpp>
Classes | |
| class | Exception |
| Class for JSONPath exceptions. More... | |
Construction | |
| RegEx (const std::string &expression, bool single, bool multi) | |
| Constructor setting a RegEx string and whether the query will return single and/or multiple results. More... | |
Getters | |
| bool | getBool (const std::string &text) const |
| Gets a boolean result from performing the query on a parsed JSON document. More... | |
| void | getFirst (const std::string &text, std::string &resultTo) const |
| Gets the first match from performing the query on a parsed JSON document. More... | |
| void | getAll (const std::string &text, std::vector< std::string > &resultTo) const |
| Gets all matches from performing the query on a parsed JSON document. More... | |
| bool | valid () const noexcept |
| Gets whether the query is valid. More... | |
Implements a RegEx query using the PCRE2 library.
For more information about the PCRE2 library, see its website.
|
inline |
Constructor setting a RegEx string and whether the query will return single and/or multiple results.
| expression | Const reference to a string containing the RegEx query. Newlines at the end of the expression will be removed. |
| single | Set whether the query can return single results. |
| multi | Set whether the query can return multiple results. |
| RegEx::Exception | if the given expression is empty, no result type has been specified, or the compilation of the RegEx expression failed. |
References crawlservpp::Query::pcre2ErrorBufferLength, crawlservpp::Wrapper::PCRE::set(), and crawlservpp::Wrapper::PCRE::valid().
|
inline |
Gets all matches from performing the query on a parsed JSON document.
| text | Const reference to a string containing the text on which the query should be performed. |
| resultTo | Reference to a vector to which the results will be written. The vector will be cleared even if an error occurs during execution of the query. |
| RegEx::Exception | if no RegEx expression has been defined, an error occurs during execution of the query, or the output vector is unexpectedly too small to contain the result. |
References crawlservpp::Query::bitmaskTopBit, crawlservpp::Query::bitmaskTopTwoBits, crawlservpp::Wrapper::PCREMatch::get(), crawlservpp::Wrapper::PCRE::getc(), crawlservpp::Query::pcre2ErrorBufferLength, and crawlservpp::Wrapper::PCRE::valid().
Referenced by crawlservpp::Main::Server::tick().
|
inline |
Gets a boolean result from performing the query on a parsed JSON document.
| text | Const reference to a string containing the text on which the query should be performed. |
| RegEx::Exception | if no RegEx expression has been defined, an error occurs during execution of the query, or the output vector is unexpectedly too small to contain the result. |
References crawlservpp::Wrapper::PCREMatch::get(), crawlservpp::Wrapper::PCRE::getc(), crawlservpp::Query::pcre2ErrorBufferLength, and crawlservpp::Wrapper::PCRE::valid().
Referenced by crawlservpp::Main::Server::tick().
|
inline |
Gets the first match from performing the query on a parsed JSON document.
| text | Const reference to a string containing the text on which the query should be performed. |
| resultTo | Reference to a string to which the result will be written. The string will be cleared even if an error occurs during execution of the query. |
| RegEx::Exception | if no RegEx expression has been defined, an error occurs during execution of the query, or the output vector is unexpectedly too small to contain the result. |
References crawlservpp::Wrapper::PCREMatch::get(), crawlservpp::Wrapper::PCRE::getc(), crawlservpp::Query::pcre2ErrorBufferLength, and crawlservpp::Wrapper::PCRE::valid().
Referenced by crawlservpp::Main::Server::tick().
|
inlinenoexcept |
Gets whether the query is valid.
References crawlservpp::Wrapper::PCRE::valid().