NCBI C++ ToolKit
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
CBoyerMooreMatcher Class Reference

Search Toolkit Book for CBoyerMooreMatcher

This implemetation uses the Boyer-Moore alg. More...

#include <util/strsearch.hpp>

Public Types

enum  EWordMatch { eSubstrMatch = 0 , ePrefixMatch = (1 << 0) , eSuffixMatch = (1 << 1) , eWholeWordMatch = (ePrefixMatch | eSuffixMatch) }
 

Public Member Functions

 CBoyerMooreMatcher (const string &pattern, NStr::ECase case_sensitive=NStr::eNocase, unsigned int whole_word=eSubstrMatch)
 Initialize a matcher with the pattern to be matched. More...
 
 CBoyerMooreMatcher (const string &pattern, const string &word_delimeters, NStr::ECase case_sensitive=NStr::eNocase, bool invert_delimiters=false)
 Initialize a matcher with the pattern to be matched. More...
 
void SetWordDelimiters (const string &word_delimeters, bool invert_delimiters=false)
 Set word delimiting characters. More...
 
void AddDelimiters (const string &word_delimeters)
 Add new word delimiters. More...
 
void AddDelimiters (char ch)
 Add new word delimiter charracter. More...
 
void InitCommonDelimiters ()
 Init delimiters most common for the English language, (whitespaces, punctuations, etc) More...
 
void SetWordMatching (unsigned int whole_word=eWholeWordMatch)
 Set word matching mode. More...
 
size_t Search (const string &text, size_t pos=0) const
 Search for the pattern over text starting at position pos. More...
 
SIZE_TYPE Search (const char *text, SIZE_TYPE pos, SIZE_TYPE text_len) const
 Search for the pattern over text starting at position pos. More...
 

Private Member Functions

bool IsWholeWord (const char *text, SIZE_TYPE pos, SIZE_TYPE text_len) const
 Check if the pattern at position pos in the text lies on a whole word boundry. More...
 
void x_InitPattern (void)
 

Private Attributes

string m_Pattern
 
SIZE_TYPE m_PatLen
 
NStr::ECase m_CaseSensitive
 
unsigned int m_WholeWord
 
vector< size_t > m_LastOccurrence
 
vector< unsigned char > m_WordDelimiters
 

Static Private Attributes

static const int sm_AlphabetSize = 256
 

Detailed Description

This implemetation uses the Boyer-Moore alg.

in order to search a single pattern over varying texts.

Definition at line 70 of file strsearch.hpp.


The documentation for this class was generated from the following files:
Modified on Sun Jul 14 04:58:25 2024 by modify_doxy.py rev. 669887