class EE::String::BMH

Overview

Boyer–Moore–Horspool fast string search. More…

#include <string.hpp>

class BMH {
public:
    // typedefs

    typedef std::vector<size_t> OccTable;

    // methods

    static const OccTable createOccTable(const unsigned char* needle, size_t needleLength);
    static size_t search(const unsigned char* haystack, size_t haystackLength, const unsigned char* needle, const size_t needleLength, const OccTable& occ);
    static Int64 find(const std::string& haystack, const std::string& needle, const size_t& haystackOffset, const OccTable& occ);
    static Int64 find(const std::string& haystack, const std::string& needle, const size_t& haystackOffset = 0);
};

Detailed Documentation

Boyer–Moore–Horspool fast string search.

Methods

static size_t search(const unsigned char* haystack, size_t haystackLength, const unsigned char* needle, const size_t needleLength, const OccTable& occ)

Returns:

haystackLength if not found, otherwise the position

static Int64 find(const std::string& haystack, const std::string& needle, const size_t& haystackOffset, const OccTable& occ)

Returns:

-1 if not found otherwise the position

static Int64 find(const std::string& haystack, const std::string& needle, const size_t& haystackOffset = 0)

Returns:

-1 if not found otherwise the position