16 #ifndef INCLUDE_NN_NLIB_SUCCINCT_WORDFILTER_H_ 17 #define INCLUDE_NN_NLIB_SUCCINCT_WORDFILTER_H_ 19 #include "nn/nlib/Swap.h" 22 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 23 #undef NLIB_VIS_PUBLIC 24 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 32 typedef bool (*MatchCallback)(
const char* first,
const char* last, uint32_t nodeid,
42 void Match(
const char* doc, MatchCallback callback,
void* user_obj) NLIB_NOEXCEPT {
43 this->Match(doc,
nlib_strlen(doc), callback, user_obj);
45 void Match(
const char* doc, MatchCallback callback) NLIB_NOEXCEPT {
46 this->Match(doc, callback,
nullptr);
48 void Match(
const char* data,
size_t n, MatchCallback callback,
void* user_obj)
NLIB_NOEXCEPT;
49 void Match(
const char* data,
size_t n, MatchCallback callback) NLIB_NOEXCEPT {
50 this->Match(data, n, callback,
nullptr);
57 class WordFilterPrivate;
58 WordFilterPrivate* prv_;
81 bool AddExcludeWords(
const char* str,
size_t len)
NLIB_NOEXCEPT;
87 struct WordFilterBuilderPrivate;
88 WordFilterBuilderPrivate* prv_;
94 NLIB_DEFINE_STD_SWAP(::nlib_ns::succinct::WordFilter)
95 NLIB_DEFINE_STD_SWAP(::nlib_ns::succinct::WordFilterBuilder)
96 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 97 #undef NLIB_VIS_PUBLIC 98 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 101 #endif // INCLUDE_NN_NLIB_SUCCINCT_WORDFILTER_H_ #define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
void swap(WordFilter &rhs) noexcept
Swaps the contents of an object.
void Match(const char *doc, MatchCallback callback, void *user_obj) noexcept
Inspects the string to detect the registered string.
Class that checks whether text contains the predefined set of words.
~WordFilter() noexcept
Destructor.
Defines the class for searching text strings using the Aho-Corasick string-matching algorithm...
constexpr WordFilter() noexcept
Instantiates the object.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
bool AddExcludeWords(const char *str) noexcept
Adds a string from an array containing a set of excluded terms. The strings must be delimited by newl...
#define NLIB_CEXPR
Defines constexpr if it is available for use. If not, holds an empty string.
Class to create a WordFilter object that corresponds to a term and excluded terms.
The class for writing binary to streams (to OutputStream).
bool AddWords(const char *str) noexcept
Adds a string from an array containing a set of target strings. The strings must be delimited by newl...
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
The class for reading binary from streams (from InputStream).
constexpr WordFilterBuilder() noexcept
Instantiates the object.
~WordFilterBuilder() noexcept
Destructor.