NAME
OTC_Pattern -
Abstract base class for patterns which will be matched against
strings.
SYNOPSIS
#include <OTC/text/pattern.hh>
class OTC_Pattern
{
public:
virtual ~OTC_Pattern();
OTC_Pattern(char const* thePattern);
inline char const* pattern() const;
virtual OTC_Boolean match(char const* theString) = 0;
virtual u_int start() const = 0;
virtual u_int length() const = 0;
OTC_Range range() const;
virtual OTC_Boolean isValid() const = 0;
};
CLASS TYPE
Abstract
DESCRIPTION
This class is used as the base class for various pattern matching
methods. This allows certain matching routines to be simply
expressed in terms of a pattern and not a specific type of
pattern.
INITIALISATION
OTC_Pattern(char const* thePattern);
thePattern is the pattern. This class
makes its own copy of thePattern.
QEURY
inline char const* pattern() const;
PATTERN OPERATIONS
virtual OTC_Boolean match(char const* theString) = 0;
Should be redefined in a derived class to
return OTCLIB_TRUE if the pattern matches
theString.
virtual u_int start() const = 0;
Should be redefined in a derived class to
return the index to the start of the
portion of the string matched.
virtual u_int length() const = 0;
Returns the length of the portion of the
string matched.
OTC_Range range() const;
Returns a range object representing the
portion of the string that matched.
virtual OTC_Boolean isValid() const = 0;
Should be redefined in a derived class to
return OTCLIB_TRUE if the pattern was
valid.
LIBRARY
OTC
AUTHOR(S)
Graham Dumpleton
COPYRIGHT
Copyright 1991 OTC LIMITED
Copyright 1994 DUMPLETON SOFTWARE CONSULTING PTY LIMITED