Class StringSearcher

Class Documentation

class StringSearcher

a pattern prepared for the search of its occurrences in any text

Public Functions

inline StringSearcher(void)

the empty pattern

explicit StringSearcher(std::string_view P)

P prepared: its probes and the shifts of its q-grams, O( m )

std::size_t find(std::string_view T, std::size_t from = 0) const

the first occurrence of P at or after from in T, npos if none

Post:

npos, or an occurrence at or after from

std::vector<std::size_t> findAll(std::string_view T) const

all the occurrences of P in T, in increasing order

Post:

the occurrences of naiveMatching( T , P ) (an audit)

std::size_t count(std::string_view T) const

the number of occurrences of P in T

template<std::contiguous_iterator I>
inline std::pair<I, I> operator()(I first, I last) const

the range of the first occurrence of P in [ first , last ), or ( last , last ): the searcher of std::search()

inline std::string_view pattern(void) const

Public Static Attributes

static constexpr std::size_t npos = std::string_view::npos
static constexpr std::size_t kSkip = 64

the patterns of kSkip bytes or more are searched by the shifts of the q-grams