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,
38 void Match(const
char* doc, MatchCallback callback,
void* user_obj)
NLIB_NOEXCEPT {
39 this->Match(doc,
nlib_strlen(doc), callback, user_obj);
42 this->Match(doc, callback,
nullptr);
44 void Match(
const char* data,
size_t n, MatchCallback callback,
void* user_obj)
NLIB_NOEXCEPT;
46 this->Match(data, n, callback,
nullptr);
53 class WordFilterPrivate;
54 WordFilterPrivate* prv_;
67 #ifdef __cpp_rvalue_references 74 bool AddExcludeWords(
const char* str,
size_t len)
NLIB_NOEXCEPT;
80 struct WordFilterBuilderPrivate;
81 WordFilterBuilderPrivate* prv_;
87 NLIB_DEFINE_STD_SWAP(::nlib_ns::succinct::WordFilter)
88 NLIB_DEFINE_STD_SWAP(::nlib_ns::succinct::WordFilterBuilder)
89 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 90 #undef NLIB_VIS_PUBLIC 91 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 94 #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...
std::unique_ptr< WordFilter > Build2() noexcept
Creates a WordFilter object.
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 with default parameters (default constructor). Requires initialization with I...
void Match(const char *data, size_t n, MatchCallback callback) noexcept
A parameter omitted version of the above function which passes nullptr as a parameter.
#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.
void Match(const char *doc, MatchCallback callback) noexcept
A parameter omitted version of the above function which passes nullptr as a parameter.
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 with default parameters (default constructor). Requires initialization with I...
~WordFilterBuilder() noexcept
Destructor.