ADTF  v2.14.3
cRegularExpression Class Reference

Regular expressions. More...

Public Types

enum  tAnchorType { AT_Unanchored, AT_Start, AT_Both }
 Anchor type.
 

Public Member Functions

 cRegularExpression ()
 Default constructor. More...
 
 cRegularExpression (const cRegularExpression &oRegExp)
 Copy constructor. More...
 
 cRegularExpression (const cString &strExpression)
 Constructor with preset expression. More...
 
 cRegularExpression (const tChar *strExpression, tBool bCaseSensitive=tTrue)
 Constructor with preset expression. More...
 
virtual ~cRegularExpression ()
 Destructor.
 
tResult Set (const cString &strExpression, tBool bCaseSensitive=tTrue)
 Sets the regular expression string. More...
 
tResult Set (const tChar *strExpression, tBool bCaseSensitive=tTrue)
 Sets the regular expression string. More...
 
cString GetPattern () const
 Returns the current pattern (expression). More...
 
cString GetError () const
 Returns a string representation of the last error (if any). More...
 
tBool Replace (const cStringPiece &rewrite, cString *str) const
 Replaces the first match of str with rewrite. More...
 
tInt GlobalReplace (const cStringPiece &rewrite, cString *str) const
 Replaces all matches of str with rewrite. More...
 
tBool Extract (const cStringPiece &rewrite, const cStringPiece &text, cString *out) const
 Extracts all replaced matches of text into out. More...
 
tInt GetNumberOfCapturingGroups () const
 Returns the number of capturing groups. More...
 
tBool DoMatch (const cStringPiece &text, tAnchorType anchor, tInt *consumed, const cRegularExpressionArg *args, tInt n) const
 Matches a string. More...
 
tBool FullMatch (const cStringPiece &text, const cRegularExpressionArg &ptr1=oNoArg, const cRegularExpressionArg &ptr2=oNoArg, const cRegularExpressionArg &ptr3=oNoArg, const cRegularExpressionArg &ptr4=oNoArg, const cRegularExpressionArg &ptr5=oNoArg, const cRegularExpressionArg &ptr6=oNoArg, const cRegularExpressionArg &ptr7=oNoArg, const cRegularExpressionArg &ptr8=oNoArg, const cRegularExpressionArg &ptr9=oNoArg, const cRegularExpressionArg &ptr10=oNoArg, const cRegularExpressionArg &ptr11=oNoArg, const cRegularExpressionArg &ptr12=oNoArg, const cRegularExpressionArg &ptr13=oNoArg, const cRegularExpressionArg &ptr14=oNoArg, const cRegularExpressionArg &ptr15=oNoArg, const cRegularExpressionArg &ptr16=oNoArg) const
 Checks if the whole string matches. More...
 
tBool PartialMatch (const cStringPiece &text, const cRegularExpressionArg &ptr1=oNoArg, const cRegularExpressionArg &ptr2=oNoArg, const cRegularExpressionArg &ptr3=oNoArg, const cRegularExpressionArg &ptr4=oNoArg, const cRegularExpressionArg &ptr5=oNoArg, const cRegularExpressionArg &ptr6=oNoArg, const cRegularExpressionArg &ptr7=oNoArg, const cRegularExpressionArg &ptr8=oNoArg, const cRegularExpressionArg &ptr9=oNoArg, const cRegularExpressionArg &ptr10=oNoArg, const cRegularExpressionArg &ptr11=oNoArg, const cRegularExpressionArg &ptr12=oNoArg, const cRegularExpressionArg &ptr13=oNoArg, const cRegularExpressionArg &ptr14=oNoArg, const cRegularExpressionArg &ptr15=oNoArg, const cRegularExpressionArg &ptr16=oNoArg) const
 Checks if any substring matches. More...
 
tBool Consume (cStringPiece &input, const cRegularExpressionArg &ptr1=oNoArg, const cRegularExpressionArg &ptr2=oNoArg, const cRegularExpressionArg &ptr3=oNoArg, const cRegularExpressionArg &ptr4=oNoArg, const cRegularExpressionArg &ptr5=oNoArg, const cRegularExpressionArg &ptr6=oNoArg, const cRegularExpressionArg &ptr7=oNoArg, const cRegularExpressionArg &ptr8=oNoArg, const cRegularExpressionArg &ptr9=oNoArg, const cRegularExpressionArg &ptr10=oNoArg, const cRegularExpressionArg &ptr11=oNoArg, const cRegularExpressionArg &ptr12=oNoArg, const cRegularExpressionArg &ptr13=oNoArg, const cRegularExpressionArg &ptr14=oNoArg, const cRegularExpressionArg &ptr15=oNoArg, const cRegularExpressionArg &ptr16=oNoArg) const
 Repeatedly match the front of a string. More...
 
tBool FindAndConsume (cStringPiece &input, const cRegularExpressionArg &ptr1=oNoArg, const cRegularExpressionArg &ptr2=oNoArg, const cRegularExpressionArg &ptr3=oNoArg, const cRegularExpressionArg &ptr4=oNoArg, const cRegularExpressionArg &ptr5=oNoArg, const cRegularExpressionArg &ptr6=oNoArg, const cRegularExpressionArg &ptr7=oNoArg, const cRegularExpressionArg &ptr8=oNoArg, const cRegularExpressionArg &ptr9=oNoArg, const cRegularExpressionArg &ptr10=oNoArg, const cRegularExpressionArg &ptr11=oNoArg, const cRegularExpressionArg &ptr12=oNoArg, const cRegularExpressionArg &ptr13=oNoArg, const cRegularExpressionArg &ptr14=oNoArg, const cRegularExpressionArg &ptr15=oNoArg, const cRegularExpressionArg &ptr16=oNoArg) const
 Repeatedly match a string. More...
 

Static Public Attributes

static cRegularExpressionArg oNoArg
 No argument.
 

Detailed Description

Regular expressions.

Definition at line 24 of file regularexpression.h.

Constructor & Destructor Documentation

Default constructor.

The matching is set to case sensitive.

cRegularExpression ( const cRegularExpression oRegExp)

Copy constructor.

Parameters
oRegExp[in] The object to copy.
cRegularExpression ( const cString strExpression)

Constructor with preset expression.

The matching is set to case sensitive.

Parameters
strExpression[in] The regular expression string.
cRegularExpression ( const tChar strExpression,
tBool  bCaseSensitive = tTrue 
)

Constructor with preset expression.

Parameters
strExpression[in] The regular expression string.
bCaseSensitive[in] Whether or not the match is case sensitive.

Member Function Documentation

tBool Consume ( cStringPiece input,
const cRegularExpressionArg ptr1 = oNoArg,
const cRegularExpressionArg ptr2 = oNoArg,
const cRegularExpressionArg ptr3 = oNoArg,
const cRegularExpressionArg ptr4 = oNoArg,
const cRegularExpressionArg ptr5 = oNoArg,
const cRegularExpressionArg ptr6 = oNoArg,
const cRegularExpressionArg ptr7 = oNoArg,
const cRegularExpressionArg ptr8 = oNoArg,
const cRegularExpressionArg ptr9 = oNoArg,
const cRegularExpressionArg ptr10 = oNoArg,
const cRegularExpressionArg ptr11 = oNoArg,
const cRegularExpressionArg ptr12 = oNoArg,
const cRegularExpressionArg ptr13 = oNoArg,
const cRegularExpressionArg ptr14 = oNoArg,
const cRegularExpressionArg ptr15 = oNoArg,
const cRegularExpressionArg ptr16 = oNoArg 
) const

Repeatedly match the front of a string.

Advance the position of the input past the matching part.

Parameters
input[inout] The input text. Will be advanced past the matching part.
ptr1[inout] The capturing argument 1.
ptr2[inout] The capturing argument 2.
ptr3[inout] The capturing argument 3.
ptr4[inout] The capturing argument 4.
ptr5[inout] The capturing argument 5.
ptr6[inout] The capturing argument 6.
ptr7[inout] The capturing argument 7.
ptr8[inout] The capturing argument 8.
ptr9[inout] The capturing argument 9.
ptr10[inout] The capturing argument 10.
ptr11[inout] The capturing argument 11.
ptr12[inout] The capturing argument 12.
ptr13[inout] The capturing argument 13.
ptr14[inout] The capturing argument 14.
ptr15[inout] The capturing argument 15.
ptr16[inout] The capturing argument 16.
Returns
tTrue if the string matches, otherwise tFalse.
tBool DoMatch ( const cStringPiece text,
tAnchorType  anchor,
tInt consumed,
const cRegularExpressionArg args,
tInt  n 
) const

Matches a string.

Parameters
text[in] The string to match.
anchor[in] See tAnchorType.
consumed[out] The length of the match.
args[out] Array of capturing args. One arg per capuring group
n[in] The size of args.
Returns
tTrue if the string matches, otherwise tFalse. Returns also tFalse if number of capturing arguments n is greater than 0 but args is NULL
tBool Extract ( const cStringPiece rewrite,
const cStringPiece text,
cString out 
) const

Extracts all replaced matches of text into out.

Parameters
rewrite[in] The string to match.
text[out] The output string.
out[out] If the pattern matches, rewrite is copied to this string
Returns
tTrue on success, otherwise tFalse.
tBool FindAndConsume ( cStringPiece input,
const cRegularExpressionArg ptr1 = oNoArg,
const cRegularExpressionArg ptr2 = oNoArg,
const cRegularExpressionArg ptr3 = oNoArg,
const cRegularExpressionArg ptr4 = oNoArg,
const cRegularExpressionArg ptr5 = oNoArg,
const cRegularExpressionArg ptr6 = oNoArg,
const cRegularExpressionArg ptr7 = oNoArg,
const cRegularExpressionArg ptr8 = oNoArg,
const cRegularExpressionArg ptr9 = oNoArg,
const cRegularExpressionArg ptr10 = oNoArg,
const cRegularExpressionArg ptr11 = oNoArg,
const cRegularExpressionArg ptr12 = oNoArg,
const cRegularExpressionArg ptr13 = oNoArg,
const cRegularExpressionArg ptr14 = oNoArg,
const cRegularExpressionArg ptr15 = oNoArg,
const cRegularExpressionArg ptr16 = oNoArg 
) const

Repeatedly match a string.

Advance the position of the input past the first matching part.

Parameters
input[inout] The input text. Will be advanced past the matching part.
ptr1[inout] The capturing argument 1.
ptr2[inout] The capturing argument 2.
ptr3[inout] The capturing argument 3.
ptr4[inout] The capturing argument 4.
ptr5[inout] The capturing argument 5.
ptr6[inout] The capturing argument 6.
ptr7[inout] The capturing argument 7.
ptr8[inout] The capturing argument 8.
ptr9[inout] The capturing argument 9.
ptr10[inout] The capturing argument 10.
ptr11[inout] The capturing argument 11.
ptr12[inout] The capturing argument 12.
ptr13[inout] The capturing argument 13.
ptr14[inout] The capturing argument 14.
ptr15[inout] The capturing argument 15.
ptr16[inout] The capturing argument 16.
Returns
tTrue if the string matches, otherwise tFalse.
Remarks
If the string could not be matched, arguments will not be cleared
tBool FullMatch ( const cStringPiece text,
const cRegularExpressionArg ptr1 = oNoArg,
const cRegularExpressionArg ptr2 = oNoArg,
const cRegularExpressionArg ptr3 = oNoArg,
const cRegularExpressionArg ptr4 = oNoArg,
const cRegularExpressionArg ptr5 = oNoArg,
const cRegularExpressionArg ptr6 = oNoArg,
const cRegularExpressionArg ptr7 = oNoArg,
const cRegularExpressionArg ptr8 = oNoArg,
const cRegularExpressionArg ptr9 = oNoArg,
const cRegularExpressionArg ptr10 = oNoArg,
const cRegularExpressionArg ptr11 = oNoArg,
const cRegularExpressionArg ptr12 = oNoArg,
const cRegularExpressionArg ptr13 = oNoArg,
const cRegularExpressionArg ptr14 = oNoArg,
const cRegularExpressionArg ptr15 = oNoArg,
const cRegularExpressionArg ptr16 = oNoArg 
) const

Checks if the whole string matches.

Parameters
text[in] The string to match.
ptr1[inout] The capturing argument 1.
ptr2[inout] The capturing argument 2.
ptr3[inout] The capturing argument 3.
ptr4[inout] The capturing argument 4.
ptr5[inout] The capturing argument 5.
ptr6[inout] The capturing argument 6.
ptr7[inout] The capturing argument 7.
ptr8[inout] The capturing argument 8.
ptr9[inout] The capturing argument 9.
ptr10[inout] The capturing argument 10.
ptr11[inout] The capturing argument 11.
ptr12[inout] The capturing argument 12.
ptr13[inout] The capturing argument 13.
ptr14[inout] The capturing argument 14.
ptr15[inout] The capturing argument 15.
ptr16[inout] The capturing argument 16.
Returns
tTrue if the string matches, otherwise tFalse.
cString GetError ( ) const

Returns a string representation of the last error (if any).

Returns
A string representation of the last error.
tInt GetNumberOfCapturingGroups ( ) const

Returns the number of capturing groups.

Example for 2 capturing groups: oRegExp.Set("(bl.bber)(b.l)");

Returns
The number of capturing groups. If the expression was not yet initialized with cRegularExpression::Set, -1 is returned
cString GetPattern ( ) const

Returns the current pattern (expression).

Returns
The current pattern.
tInt GlobalReplace ( const cStringPiece rewrite,
cString str 
) const

Replaces all matches of str with rewrite.

Parameters
rewrite[in] The replacement. Backslash-escaped digits (\1 to \9) can be used to insert text matching corre- sponding parenthesized group from the pattern.
str[in] The string to match. If this is NULL, returns tFalse.
Returns
The number of replacements.
tBool PartialMatch ( const cStringPiece text,
const cRegularExpressionArg ptr1 = oNoArg,
const cRegularExpressionArg ptr2 = oNoArg,
const cRegularExpressionArg ptr3 = oNoArg,
const cRegularExpressionArg ptr4 = oNoArg,
const cRegularExpressionArg ptr5 = oNoArg,
const cRegularExpressionArg ptr6 = oNoArg,
const cRegularExpressionArg ptr7 = oNoArg,
const cRegularExpressionArg ptr8 = oNoArg,
const cRegularExpressionArg ptr9 = oNoArg,
const cRegularExpressionArg ptr10 = oNoArg,
const cRegularExpressionArg ptr11 = oNoArg,
const cRegularExpressionArg ptr12 = oNoArg,
const cRegularExpressionArg ptr13 = oNoArg,
const cRegularExpressionArg ptr14 = oNoArg,
const cRegularExpressionArg ptr15 = oNoArg,
const cRegularExpressionArg ptr16 = oNoArg 
) const

Checks if any substring matches.

Parameters
text[in] The string to match.
ptr1[inout] The capturing argument 1.
ptr2[inout] The capturing argument 2.
ptr3[inout] The capturing argument 3.
ptr4[inout] The capturing argument 4.
ptr5[inout] The capturing argument 5.
ptr6[inout] The capturing argument 6.
ptr7[inout] The capturing argument 7.
ptr8[inout] The capturing argument 8.
ptr9[inout] The capturing argument 9.
ptr10[inout] The capturing argument 10.
ptr11[inout] The capturing argument 11.
ptr12[inout] The capturing argument 12.
ptr13[inout] The capturing argument 13.
ptr14[inout] The capturing argument 14.
ptr15[inout] The capturing argument 15.
ptr16[inout] The capturing argument 16.
Returns
tTrue if the string matches, otherwise tFalse.
tBool Replace ( const cStringPiece rewrite,
cString str 
) const

Replaces the first match of str with rewrite.

Parameters
rewrite[in] The replacement. Backslash-escaped digits (\1 to \9) can be used to insert text matching corre- sponding parenthesized group from the pattern.
str[in] The string to match.
Returns
tTrue on success, otherwise tFalse.
tResult Set ( const cString strExpression,
tBool  bCaseSensitive = tTrue 
)

Sets the regular expression string.

Parameters
strExpression[in] The regular expression string.
bCaseSensitive[in] Whether or not the match is case sensitive.
Returns
Standard result.
tResult Set ( const tChar strExpression,
tBool  bCaseSensitive = tTrue 
)

Sets the regular expression string.

Parameters
strExpression[in] The regular expression string.
bCaseSensitive[in] Whether or not the match is case sensitive.
Returns
Standard result.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Fri Mar 22 2019 by doxygen 1.8.10)