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

BOOL PRegularExpression::Compile ( const char *  cpattern,
int  flags = IgnoreCase 
)

Compiler pattern. The pattern is compiled into an internal format to speed subsequent execution of the pattern match algorithm.

Returns:
TRUE if successfully compiled.
Parameters:
cpattern  Pattern to compile
flags  Pattern match options

Definition at line 3183 of file contain.cxx.

References BadPattern, and NoError.

{
  patternSaved = pattern;
  flagsSaved   = flags;

  if (expression != NULL) {
    regfree(regexpression);
    delete regexpression;
    expression = NULL;
  }
  if (pattern == NULL || *pattern == '\0')
    lastError = BadPattern;
  else {
    expression = new regex_t;
    lastError = regcomp(regexpression, pattern, flags);
  }
  return lastError == NoError;
}


Generated by  Doxygen 1.6.0   Back to index