Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
p6wregex.h
Go to the documentation of this file.
1 
10 #ifndef P6WREGEX_H__
11 #define P6WREGEX_H__ 1
12 
13 #include "p6err.h"
14 
15 namespace P6R {
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
34 typedef enum {
40 } P6WREGEXMODE;
41 
82 const P6WREGEXMODIFIER P6MOD_NULL = 0x00000000;
83 const P6WREGEXMODIFIER P6MOD_INSENSITIVE = 0x00000001;
84 const P6WREGEXMODIFIER P6MOD_MULTILINE = 0x00000002;
85 const P6WREGEXMODIFIER P6MOD_NEWLINE = 0x00000004;
86 const P6WREGEXMODIFIER P6MOD_FASTGREEDY = 0x00000008;
87 const P6WREGEXMODIFIER P6MOD_GLOBAL = 0x00000010;
88 const P6WREGEXMODIFIER P6MOD_FULLLOOKBEHIND = 0x00000020;
89 const P6WREGEXMODIFIER P6MOD_SKIPWHITESPACE = 0x00000040;
90 
103 const P6WREGEXTRACELEVEL P6WREGEX_TRACE_OFF = 0x00000000;
104 const P6WREGEXTRACELEVEL P6WREGEX_TRACE_BASIC = 0x00000001;
105 const P6WREGEXTRACELEVEL P6WREGEX_TRACE_DEBUG = 0x00000002;
106 
114 const P6WREGEXFLAGS P6WREGEX_NOFLAGS = 0x00000000;
115 
120 typedef const P6WCHAR* (*P6WREGEXREPLACECB)( const P6WCHAR* pMatchedText, P6VOID *pCtx );
121 
122 
130 {
144  P6COMMETHOD next( const P6WCHAR** pResult ) = 0;
145 
154  P6COMMETHOD reset() = 0;
155 };
156 #define IF_p6IWRegexMatch {0x25845EAC,0xC253,0x4409,{0x85,0x09,0xD3,0xD7,0xBC,0x9B,0x9D,0xE0}}
157 
158 
169 interface p6IWRegex : public p6ICom
170 {
182  P6COMMETHOD initialize( P6WREGEXFLAGS flags, P6WREGEXMODE mode ) = 0;
183 
198  P6COMMETHOD setLocale( const P6CHAR* pLocale ) = 0;
199 
211  P6COMMETHOD setTrace( P6WREGEXTRACELEVEL level ) = 0;
212 
230  P6COMMETHOD compile( const P6WCHAR* pRegex,
231  P6WREGEXMODIFIER modifiers
232  ) = 0;
233 
257  P6COMMETHOD match( const P6WCHAR* pMatch,
258  P6WREGEXMODIFIER modifiers
259  ) = 0;
260 
301  P6COMMETHOD search( const P6WCHAR* pSearch,
302  P6WREGEXMODIFIER modifiers,
303  P6UINT32* pOffset,
304  P6UINT32* pLength
305  ) = 0;
306 
336  P6COMMETHOD replace( const P6WCHAR* pSearch,
337  P6WREGEXMODIFIER modifiers,
338  const P6WCHAR* pReplace,
339  P6WCHAR* pResult,
340  P6UINT32 cBuffer,
341  P6UINT32* pWritten
342  ) = 0;
343 
370  P6WREGEXMODIFIER modifiers,
371  const P6WCHAR* pReplace,
372  P6UINT32* pSize
373  ) = 0;
374 
407  P6COMMETHOD replaceWithCallback( const P6WCHAR* pSearch,
408  P6WREGEXMODIFIER modifiers,
409  P6WREGEXREPLACECB pfn,
410  P6VOID* pCtx,
411  p6IWRegexMatch** pResult
412  ) = 0;
413 
433  P6COMMETHOD getCaptureText( P6UINT32 index, P6UINT32* pOffset, P6UINT32* pLength ) = 0;
434 
455  P6COMMETHOD getNamedCaptureText( const P6WCHAR* pName, P6UINT32* pOffset, P6UINT32* pLength ) = 0;
456 
476  P6COMMETHOD setBackTrackLimits( P6UINT32 maxBackStack, P6UINT32 maxBackTracks ) = 0;
477 };
478 
479 // {3E3CF731-11EA-47c7-A95A-E15107286211}
480 #define IF_p6IWRegex {0x3e3cf731,0x11ea,0x47c7,{0xa9,0x5a,0xe1,0x51,0x7,0x28,0x62,0x11}}
481 
482 // {8CEBAED1-228D-4729-AF59-140480D897F7}
483 #define COMP_p6WRegex {0x8cebaed1,0x228d,0x4729,{0xaf,0x59,0x14,0x4,0x80,0xd8,0x97,0xf7}}
484 
485 #ifdef __cplusplus
486 }
487 #endif
488 
489 } // namespace
490 
491 
492 #endif
493 
494 
495 
496 
497 
virtual P6R::P6ERR replace(const P6WCHAR *pSearch, P6WREGEXMODIFIER modifiers, const P6WCHAR *pReplace, P6WCHAR *pResult, P6UINT32 cBuffer, P6UINT32 *pWritten)=0
Replace the first matching subexpressions with the pSearch string with the pReplace string...
virtual P6R::P6ERR getNamedCaptureText(const P6WCHAR *pName, P6UINT32 *pOffset, P6UINT32 *pLength)=0
Return the text by the name used in a Named Capture (i.e., "(?<name> )").
const P6WREGEXMODIFIER P6MOD_NEWLINE
Definition: p6wregex.h:85
const P6WREGEXTRACELEVEL P6WREGEX_TRACE_OFF
Definition: p6wregex.h:103
P6WREGEXMODE
This type defines the supported compatitbility modes with other regular expression engines...
Definition: p6wregex.h:34
unsigned int P6UINT32
Definition: p6types.h:40
Standard error codes.
virtual P6R::P6ERR getCaptureText(P6UINT32 index, P6UINT32 *pOffset, P6UINT32 *pLength)=0
Return the text by the 1st, 2nd, 3rd, etc set of capturing parentheses.
virtual P6R::P6ERR replaceWithCallback(const P6WCHAR *pSearch, P6WREGEXMODIFIER modifiers, P6WREGEXREPLACECB pfn, P6VOID *pCtx, p6IWRegexMatch **pResult)=0
Replace the first matching subexpressions with the pSearch string with a replacement string provided ...
virtual P6R::P6ERR reset()=0
This method is used to re-start the enumerator at the beginning.
virtual P6R::P6ERR search(const P6WCHAR *pSearch, P6WREGEXMODIFIER modifiers, P6UINT32 *pOffset, P6UINT32 *pLength)=0
Does the compiled regular expression match a substring in the pSearch input string.
Return zero or more strings resulting from a regex operation.
Definition: p6wregex.h:129
const P6WREGEXMODIFIER P6MOD_FULLLOOKBEHIND
Definition: p6wregex.h:88
virtual P6R::P6ERR replaceInPlace(P6WCHAR *pSearch, P6WREGEXMODIFIER modifiers, const P6WCHAR *pReplace, P6UINT32 *pSize)=0
Replace the first matching subexpressions with the pSearch string with the pReplace string...
virtual P6R::P6ERR compile(const P6WCHAR *pRegex, P6WREGEXMODIFIER modifiers)=0
Compile (and verify) a regular expression into an internal format for evaluation. ...
virtual P6R::P6ERR setTrace(P6WREGEXTRACELEVEL level)=0
Toggle tracing of the internal working of the regex engine on/off.
wchar_t P6WCHAR
Wide character type see p6i18n.h.
Definition: p6types.h:76
The base interface all [p6]COM components must derive from and implement.
Definition: p6comdef.h:96
const P6WCHAR *(* P6WREGEXREPLACECB)(const P6WCHAR *pMatchedText, P6VOID *pCtx)
Used for the replaceWithCallBack() function.
Definition: p6wregex.h:120
virtual P6R::P6ERR next(const P6WCHAR **pResult)=0
This method is used to iterate zero or more strings generated from a regex function.
This interface provides access the to the wide string (patform wchar_t) regular expression engine and...
Definition: p6wregex.h:169
const P6WREGEXMODIFIER P6MOD_FASTGREEDY
Definition: p6wregex.h:86
const P6WREGEXMODIFIER P6MOD_INSENSITIVE
Definition: p6wregex.h:83
P6UINT32 P6WREGEXTRACELEVEL
P6WREGEXTRACELEVEL.
Definition: p6wregex.h:102
P6UINT32 P6WREGEXMODIFIER
P6WREGEXMODIFIER: Regex Modifier.
Definition: p6wregex.h:81
const P6WREGEXMODIFIER P6MOD_MULTILINE
Definition: p6wregex.h:84
const P6WREGEXMODIFIER P6MOD_GLOBAL
Definition: p6wregex.h:87
#define P6COMMETHOD
Definition: p6types.h:872
const P6WREGEXTRACELEVEL P6WREGEX_TRACE_BASIC
Definition: p6wregex.h:104
virtual P6R::P6ERR setLocale(const P6CHAR *pLocale)=0
This method allows the caller to set the locale that will be used during matching and searching of wi...
const P6WREGEXMODIFIER P6MOD_SKIPWHITESPACE
Definition: p6wregex.h:89
P6UINT32 P6WREGEXFLAGS
P6WREGEXFLAGS.
Definition: p6wregex.h:113
virtual P6R::P6ERR match(const P6WCHAR *pMatch, P6WREGEXMODIFIER modifiers)=0
Does the compiled regular expression recognize the entire pMatch input string ? This function will tr...
const P6WREGEXMODIFIER P6MOD_NULL
Definition: p6wregex.h:82
void P6VOID
Definition: p6types.h:75
const P6WREGEXTRACELEVEL P6WREGEX_TRACE_DEBUG
Definition: p6wregex.h:105
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...
char P6CHAR
Narrow character type.
Definition: p6types.h:71
const P6WREGEXFLAGS P6WREGEX_NOFLAGS
Definition: p6wregex.h:114
virtual P6R::P6ERR initialize(P6WREGEXFLAGS flags, P6WREGEXMODE mode)=0
Sets up the object to run properly.