3 #ifndef INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_ 4 #define INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_ 12 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 13 #undef NLIB_VIS_PUBLIC 14 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 24 NLIB_MOVE_MEMBER_HELPER_1(
Trie, prv_);
26 TriePrivate* tmp = rhs.prv_;
27 rhs.prv_ = this->prv_;
31 typedef bool (*MatchCallback)(
const char* first,
const char* last, uint32_t nodeid,
33 void Match(
const char* cstr, MatchCallback callback,
void* user_obj = NULL) NLIB_NOEXCEPT {
34 this->Match(cstr,
nlib_strlen(cstr), callback, user_obj);
36 void Match(
const void* data,
size_t n, MatchCallback callback,
void* user_obj)
NLIB_NOEXCEPT;
37 void Match(
const void* data,
size_t n, MatchCallback callback) NLIB_NOEXCEPT {
38 Match(data, n, callback, NULL);
40 void MatchBackward(
const void* data,
size_t n, MatchCallback callback,
42 void MatchBackward(
const void* data,
size_t n, MatchCallback callback) NLIB_NOEXCEPT {
43 MatchBackward(data, n, callback, NULL);
45 errno_t GetCommonPrefixWords(
const void* prefix,
size_t n,
52 NLIB_VIS_HIDDEN int Match_(
const void* data,
const unsigned char* p, uint32_t pos,
53 MatchCallback callback,
void* user_obj,
bool isfwd)
NLIB_NOEXCEPT;
72 return AddWords(str, strlen(str));
76 struct TrieBuilderPrivate;
77 TrieBuilderPrivate* prv_;
84 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 85 #undef NLIB_VIS_PUBLIC 86 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 89 #endif // INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_ Class to create a Trie object.
Defines the basic classes that form the basis to Rank and Select operations.
Defines the class for constructing and accessing a LOUDS succinct tree.
void swap(Trie &rhs) noexcept
Swaps the contents of an object.
Trie() noexcept
Instantiates the object.
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
void Match(const char *cstr, MatchCallback callback, void *user_obj=NULL) noexcept
Inspects the string to detect the target string registered in Trie.
The class for realloc-based implementations of C string vectors.
Implements Trie using LOUDS.
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...
TrieBuilder() noexcept
Instantiates the object.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
The class for writing binary to streams (to OutputStream).
#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).
The class for realloc-based implementations of vectors with POD-type elements.