NAME

DwBoyerMoore -- Class for executing Boyer-Moore string search algorithm

SYNOPSIS

class DW_EXPORT DwBoyerMoore {

public:

    DwBoyerMoore(const char* aCstr);
    DwBoyerMoore(const DwString& aStr);
    virtual ~DwBoyerMoore();
    void Assign(const char* aCstr);
    void Assign(const DwString& aStr);
    size_t FindIn(const DwString& aStr, size_t aPos);
};

DESCRIPTION

DwBoyerMoore implements the Boyer-Moore algorithm for searching for a string. The Boyer-Moore algorithm is fast, but requires a bit of start-up overhead compared to a brute force algorithm.

Public Member Functions

DwBoyerMoore(const char* aCstr)
DwBoyerMoore(const DwString& aStr)

Constructs a DwBoyerMoore object for searching for a particular string.

void Assign(const char* aCstr)
void Assign(const DwString& aStr)

Sets the string to search for.

size_t FindIn(const DwString& aStr, size_t aPos)

Searches for the search string in aStr starting at position aPos. If found, the function returns the first position in aStr where the search string was found. If not found, the function returns DwString::npos.