Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p6regex.h
Go to the documentation of this file.
1 
10 #ifndef P6REGEX_H__
11 #define P6REGEX_H__ 1
12 
13 #include "p6err.h"
14 #include "p6comdef.h"
15 
16 
17 namespace P6R {
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
36 typedef enum {
42 } P6REGEXMODE;
43 
84 const P6REGEXMODIFIER P6MODIFIER_NULL = 0x00000000;
85 const P6REGEXMODIFIER P6MODIFIER_INSENSITIVE = 0x00000001;
86 const P6REGEXMODIFIER P6MODIFIER_MULTILINE = 0x00000002;
87 const P6REGEXMODIFIER P6MODIFIER_NEWLINE = 0x00000004;
88 const P6REGEXMODIFIER P6MODIFIER_FASTGREEDY = 0x00000008;
89 const P6REGEXMODIFIER P6MODIFIER_GLOBAL = 0x00000010;
90 const P6REGEXMODIFIER P6MODIFIER_FULLLOOKBEHIND = 0x00000020;
91 const P6REGEXMODIFIER P6MODIFIER_SKIPWHITESPACE = 0x00000040;
92 
105 const P6REGEXTRACELEVEL P6REGEX_TRACE_OFF = 0x00000000;
106 const P6REGEXTRACELEVEL P6REGEX_TRACE_BASIC = 0x00000001;
107 const P6REGEXTRACELEVEL P6REGEX_TRACE_DEBUG = 0x00000002;
108 
116 const P6REGEXFLAGS P6REGEX_NOFLAGS = 0x00000000;
117 
122 typedef const P6CHAR* (*P6REGEXREPLACECB)( const P6CHAR* pMatchedText, P6VOID *pCtx );
123 
124 
132 {
145  P6COMMETHOD next( const P6CHAR** pResult ) = 0;
146 
155  P6COMMETHOD reset() = 0;
156 };
157 #define IF_p6IRegexMatch {0xE7334DA2,0xAECB,0x46B5,{0xB3,0x73,0xBD,0xFC,0x2B,0x3B,0x96,0xC0}}
158 
159 
172 interface p6IRegex : public p6ICom
173 {
185  P6COMMETHOD initialize( P6REGEXFLAGS flags, P6REGEXMODE mode ) = 0;
186 
197  P6COMMETHOD setTrace( P6REGEXTRACELEVEL level ) = 0;
198 
217  P6COMMETHOD compile( const P6CHAR* pRegex, P6REGEXMODIFIER modifiers ) = 0;
218 
243  P6COMMETHOD match( const P6CHAR* pMatch, P6REGEXMODIFIER modifiers ) = 0;
244 
289  P6COMMETHOD search( const P6CHAR* pSearch,
290  P6REGEXMODIFIER modifiers,
291  P6UINT32* pOffset,
292  P6UINT32* pLength
293  ) = 0;
294 
324  P6COMMETHOD replace( const P6CHAR* pSearch,
325  P6REGEXMODIFIER modifiers,
326  const P6CHAR* pReplace,
327  P6CHAR* pResult,
328  P6UINT32 cBuffer,
329  P6UINT32* pWritten
330  ) = 0;
331 
355  P6COMMETHOD replaceInPlace( P6CHAR* pSearch,
356  P6REGEXMODIFIER modifiers,
357  const P6CHAR* pReplace,
358  P6UINT32* pSize
359  ) = 0;
360 
393  P6COMMETHOD replaceWithCallback( const P6CHAR* pSearch,
394  P6REGEXMODIFIER modifiers,
395  P6REGEXREPLACECB pfn,
396  P6VOID* pCtx,
397  p6IRegexMatch** pResult
398  ) = 0;
399 
419  P6COMMETHOD getCaptureText( P6UINT32 index, P6UINT32* pOffset, P6UINT32* pLength ) = 0;
420 
441  P6COMMETHOD getNamedCaptureText( const P6CHAR* pName, P6UINT32* pOffset, P6UINT32* pLength ) = 0;
442 
462  P6COMMETHOD setBackTrackLimits( P6UINT32 maxBackStack, P6UINT32 maxBackTracks ) = 0;
463 };
464 
465 // {14FC8F04-F531-4ab1-9A9E-F8002AC35EDB}
466 #define IF_p6IRegex {0x14fc8f04,0xf531,0x4ab1,{0x9a,0x9e,0xf8,0x0,0x2a,0xc3,0x5e,0xdb}}
467 
468 // {35FA0ABF-90FF-481d-91D6-74E1D1B1D6F8}
469 #define COMP_p6Regex {0x35fa0abf,0x90ff,0x481d,{0x91,0xd6,0x74,0xe1,0xd1,0xb1,0xd6,0xf8}}
470 
471 #ifdef __cplusplus
472 }
473 #endif
474 
475 } // namespace
476 
477 
478 #endif
479 
480 
481 
482 
483 
virtual P6R::P6ERR compile(const P6CHAR *pRegex, P6REGEXMODIFIER modifiers)=0
Compile (and verify) a regular expression into an internal format for evaluation. ...
virtual P6R::P6ERR match(const P6CHAR *pMatch, P6REGEXMODIFIER modifiers)=0
Does the compiled regular expression recognize the entire pMatch input string ? This function will tr...
const P6REGEXMODIFIER P6MODIFIER_GLOBAL
Definition: p6regex.h:89
unsigned int P6UINT32
Definition: p6types.h:40
virtual P6R::P6ERR replaceInPlace(P6CHAR *pSearch, P6REGEXMODIFIER modifiers, const P6CHAR *pReplace, P6UINT32 *pSize)=0
Replaces the first matching subexpressions in the pSearch string with the pReplace string...
const P6REGEXMODIFIER P6MODIFIER_FULLLOOKBEHIND
Definition: p6regex.h:90
Standard error codes.
Return zero or more strings resulting from a regex operation.
Definition: p6regex.h:131
virtual P6R::P6ERR getCaptureText(P6UINT32 index, P6UINT32 *pOffset, P6UINT32 *pLength)=0
Return the text by the 1st, 2nd, 3rd, etc set of capturing parentheses.
const P6REGEXTRACELEVEL P6REGEX_TRACE_OFF
Definition: p6regex.h:105
virtual P6R::P6ERR search(const P6CHAR *pSearch, P6REGEXMODIFIER modifiers, P6UINT32 *pOffset, P6UINT32 *pLength)=0
Does the compiled regular expression match a substring in the pSearch input string.
The base interface all [p6]COM components must derive from and implement.
Definition: p6comdef.h:96
const P6REGEXMODIFIER P6MODIFIER_INSENSITIVE
Definition: p6regex.h:85
P6COM base interface definitions.
P6REGEXMODE
This type defines the supported compatitbility modes with other regular expression engines...
Definition: p6regex.h:36
const P6REGEXTRACELEVEL P6REGEX_TRACE_DEBUG
Definition: p6regex.h:107
virtual P6R::P6ERR next(const P6CHAR **pResult)=0
This method is used to iterate zero or more strings generated from a regex function.
virtual P6R::P6ERR replace(const P6CHAR *pSearch, P6REGEXMODIFIER modifiers, const P6CHAR *pReplace, P6CHAR *pResult, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
Replaces the first matching subexpressions in the pSearch string with the pReplace string...
const P6CHAR *(* P6REGEXREPLACECB)(const P6CHAR *pMatchedText, P6VOID *pCtx)
Used for the replaceWithCallBack() function.
Definition: p6regex.h:122
const P6REGEXTRACELEVEL P6REGEX_TRACE_BASIC
Definition: p6regex.h:106
virtual P6R::P6ERR setBackTrackLimits(P6UINT32 maxBackStack, P6UINT32 maxBackTracks)=0
As default there are NO limits to the number of elements that can be saved on the backtrack stack...
const P6REGEXMODIFIER P6MODIFIER_NULL
Definition: p6regex.h:84
const P6REGEXMODIFIER P6MODIFIER_MULTILINE
Definition: p6regex.h:86
#define P6COMMETHOD
Definition: p6types.h:872
P6UINT32 P6REGEXTRACELEVEL
flags dedicated to the control of execution tracing
Definition: p6regex.h:104
virtual P6R::P6ERR setTrace(P6REGEXTRACELEVEL level)=0
Toggle tracing of the internal working of the regex engine on/off.
virtual P6R::P6ERR initialize(P6REGEXFLAGS flags, P6REGEXMODE mode)=0
Sets up the object to run properly.
virtual P6R::P6ERR replaceWithCallback(const P6CHAR *pSearch, P6REGEXMODIFIER modifiers, P6REGEXREPLACECB pfn, P6VOID *pCtx, p6IRegexMatch **pResult)=0
Replaces the first matching subexpressions in the pSearch string with a replacement string provided a...
P6UINT32 P6REGEXMODIFIER
This type defines how to modify (or adjust) the matching process.
Definition: p6regex.h:83
This interface provides access the to the narrow string regular expression engine and supports both P...
Definition: p6regex.h:172
void P6VOID
Definition: p6types.h:75
virtual P6R::P6ERR reset()=0
This method is used to re-start the enumerator at the beginning.
const P6REGEXFLAGS P6REGEX_NOFLAGS
Definition: p6regex.h:116
const P6REGEXMODIFIER P6MODIFIER_FASTGREEDY
Definition: p6regex.h:88
virtual P6R::P6ERR getNamedCaptureText(const P6CHAR *pName, P6UINT32 *pOffset, P6UINT32 *pLength)=0
Return the text by the name used in a Named Capture (i.e., "(?<name> )").
P6UINT32 P6REGEXFLAGS
P6REGEXFLAGS.
Definition: p6regex.h:115
const P6REGEXMODIFIER P6MODIFIER_NEWLINE
Definition: p6regex.h:87
char P6CHAR
Narrow character type.
Definition: p6types.h:71
const P6REGEXMODIFIER P6MODIFIER_SKIPWHITESPACE
Definition: p6regex.h:91