Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PRegularExpression Class Reference

#include <pstring.h>

Inheritance diagram for PRegularExpression:

PObject

List of all members.


Detailed Description

A class representing a regular expression that may be used for locating patterns in strings. The regular expression string is "compiled" into a form that is more efficient during the matching. This compiled form exists for the lifetime of the PRegularExpression instance.

Definition at line 2966 of file pstring.h.


Constructors & destructors

enum  { Extended = 1, IgnoreCase = 2, AnchorNewLine = 4 }
 Flags for compiler options. More...
enum  { NotBeginningOfLine = 1, NotEndofLine = 2 }
 Flags for execution options. More...
PRegularExpressionoperator= (const PRegularExpression &)
 PRegularExpression (const PRegularExpression &)
 PRegularExpression (const char *cpattern, int flags=IgnoreCase)
 PRegularExpression (const PString &pattern, int flags=IgnoreCase)
 PRegularExpression ()
 Create a new, empty, regular expression.
 ~PRegularExpression ()
 Release storage for the compiled regular expression.

Comparison functions

enum  Comparison { LessThan = -1, EqualTo = 0, GreaterThan = 1 }
virtual Comparison Compare (const PObject &obj) const
virtual Comparison CompareObjectMemoryDirect (const PObject &obj) const
bool operator!= (const PObject &obj) const
bool operator< (const PObject &obj) const
bool operator<= (const PObject &obj) const
bool operator== (const PObject &obj) const
bool operator> (const PObject &obj) const
bool operator>= (const PObject &obj) const

Status functions

enum  ErrorCodes {
  NoError = 0, NoMatch, BadPattern, CollateError,
  BadClassType, BadEscape, BadSubReg, UnmatchedBracket,
  UnmatchedParen, UnmatchedBrace, BadBR, RangeError,
  OutOfMemory, BadRepitition, PrematureEnd, TooBig,
  UnmatchedRParen, NotCompiled
}
 Error codes. More...
ErrorCodes GetErrorCode () const
PString GetErrorText () const

Run Time Type functions

virtual const char * GetClass (unsigned=0) const
virtual BOOL InternalIsDescendant (const char *clsName) const
BOOL IsClass (const char *cls) const
static const char * Class ()

I/O functions

virtual void PrintOn (ostream &strm) const
virtual void ReadFrom (istream &strm)
ostream & operator<< (ostream &strm, const PObject &obj)
istream & operator>> (istream &strm, PObject &obj)

Public Member Functions

Miscellaneous functions
virtual PObjectClone () const
virtual PINDEX HashFunction () const
Compile & Execute functions
BOOL Compile (const char *cpattern, int flags=IgnoreCase)
BOOL Compile (const PString &pattern, int flags=IgnoreCase)
BOOL Execute (const char *cstr, PIntArray &starts, PIntArray &ends, int flags=0) const
BOOL Execute (const char *cstr, PIntArray &starts, int flags=0) const
BOOL Execute (const PString &str, PIntArray &starts, PIntArray &ends, int flags=0) const
BOOL Execute (const PString &str, PIntArray &starts, int flags=0) const
BOOL Execute (const char *cstr, PINDEX &start, PINDEX &len, int flags=0) const
BOOL Execute (const char *cstr, PINDEX &start, int flags=0) const
BOOL Execute (const PString &str, PINDEX &start, PINDEX &len, int flags=0) const
BOOL Execute (const PString &str, PINDEX &start, int flags=0) const

Static Public Member Functions

Miscellaneous functions
static PString EscapeString (const PString &str)

Protected Attributes

void * expression
int flagsSaved
int lastError
PString patternSaved

Private Member Functions

 PCLASSINFO (PRegularExpression, PObject)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index