16 #ifndef INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_ 17 #define INCLUDE_NN_NLIB_SUCCINCT_TRIE_H_ 25 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 26 #undef NLIB_VIS_PUBLIC 27 #define NLIB_VIS_PUBLIC NLIB_WINEXPORT 37 NLIB_MOVE_MEMBER_HELPER_1(
Trie, prv_);
39 TriePrivate* tmp = rhs.prv_;
40 rhs.prv_ = this->prv_;
44 typedef bool (*MatchCallback)(
const char* first,
const char* last, uint32_t nodeid,
46 void Match(
const char* cstr, MatchCallback callback,
void* user_obj = NULL) NLIB_NOEXCEPT {
47 this->Match(cstr,
nlib_strlen(cstr), callback, user_obj);
49 void Match(
const void* data,
size_t n, MatchCallback callback,
void* user_obj)
NLIB_NOEXCEPT;
50 void Match(
const void* data,
size_t n, MatchCallback callback) NLIB_NOEXCEPT {
51 Match(data, n, callback, NULL);
53 void MatchBackward(
const void* data,
size_t n, MatchCallback callback,
55 void MatchBackward(
const void* data,
size_t n, MatchCallback callback) NLIB_NOEXCEPT {
56 MatchBackward(data, n, callback, NULL);
58 errno_t GetCommonPrefixWords(
const void* prefix,
size_t n,
65 NLIB_VIS_HIDDEN int Match_(
const void* data,
const unsigned char* p, uint32_t pos,
66 MatchCallback callback,
void* user_obj,
bool isfwd)
NLIB_NOEXCEPT;
85 return AddWords(str, strlen(str));
89 struct TrieBuilderPrivate;
90 TrieBuilderPrivate* prv_;
97 #if defined(_MSC_VER) && defined(nx_succinct_EXPORTS) 98 #undef NLIB_VIS_PUBLIC 99 #define NLIB_VIS_PUBLIC NLIB_WINIMPORT 102 #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.