![]() |
AzerothCore 3.3.5a
OpenSource WoW Emulator
|
Multi-pattern substring matcher. More...
#include "AhoCorasick.h"
Classes | |
| struct | Node |
Public Types | |
| using | StringType = std::basic_string< CharT > |
| using | StringViewType = std::basic_string_view< CharT > |
Public Member Functions | |
| AhoCorasick () | |
| void | Insert (StringViewType pattern) |
| void | Build () |
| bool | ContainsAny (StringViewType text) const |
| bool | Empty () const |
| void | Clear () |
Private Attributes | |
| std::vector< Node > | _nodes |
Multi-pattern substring matcher.
Insert all patterns, call Build() once, then query in O(text length) regardless of pattern count. Insertion after Build() is not supported (it would invalidate failure links — call Build() again if you must).
Matching is exact on the CharT alphabet — pre-lowercase patterns and inputs in the caller if you need case-insensitive matching.
Usage: Acore::AhoCorasick<wchar_t> a; a.Insert(L"foo"); a.Insert(L"bar"); a.Build(); bool hit = a.ContainsAny(L"the bar is open"); // -> true
| using Acore::AhoCorasick< CharT >::StringType = std::basic_string<CharT> |
| using Acore::AhoCorasick< CharT >::StringViewType = std::basic_string_view<CharT> |
|
inline |
References Acore::AhoCorasick< CharT >::_nodes.
|
inline |
References Acore::AhoCorasick< CharT >::_nodes.
|
inline |
References Acore::AhoCorasick< CharT >::_nodes.
|
inline |
References Acore::AhoCorasick< CharT >::_nodes.
|
inline |
References Acore::AhoCorasick< CharT >::_nodes.
|
inline |
References Acore::AhoCorasick< CharT >::_nodes.
|
private |