p6regex.h

Go to the documentation of this file.
00001 
00010 #ifndef P6REGEX_H__
00011 #define P6REGEX_H__ 1
00012 
00013 #include "p6err.h"
00014 #include "p6comdef.h"
00015 
00016 
00017 namespace P6R { 
00018 
00019 #ifdef  __cplusplus
00020 extern "C" {
00021 #endif
00022 
00032 typedef enum {
00033   P6REGEX_PERL,      
00034   P6REGEX_EGREP,
00035   P6REGEX_MAX
00036 } P6REGEXMODE;
00037 
00077 typedef P6UINT32 P6REGEXMODIFIER;
00078 const P6REGEXMODIFIER P6MODIFIER_NULL           = 0x00000000;     
00079 const P6REGEXMODIFIER P6MODIFIER_INSENSITIVE    = 0x00000001;     
00080 const P6REGEXMODIFIER P6MODIFIER_MULTILINE      = 0x00000002;      
00081 const P6REGEXMODIFIER P6MODIFIER_NEWLINE        = 0x00000004;     
00082 const P6REGEXMODIFIER P6MODIFIER_FASTGREEDY     = 0x00000008;     
00083 const P6REGEXMODIFIER P6MODIFIER_GLOBAL         = 0x00000010;      
00084 const P6REGEXMODIFIER P6MODIFIER_FULLLOOKBEHIND = 0x00000020;     
00085 const P6REGEXMODIFIER P6MODIFIER_SKIPWHITESPACE = 0x00000040;     
00086 
00098 typedef P6UINT32 P6REGEXTRACELEVEL;                               
00099 const P6REGEXTRACELEVEL P6REGEX_TRACE_OFF     = 0x00000000;     
00100 const P6REGEXTRACELEVEL P6REGEX_TRACE_BASIC     = 0x00000001;    
00101 const P6REGEXTRACELEVEL P6REGEX_TRACE_DEBUG     = 0x00000002;     
00102 
00109 typedef P6UINT32 P6REGEXFLAGS;
00110 const P6REGEXFLAGS P6REGEX_NOFLAGS = 0x00000000;     
00111 
00116 typedef const P6CHAR* (*P6REGEXREPLACECB)( const P6CHAR* pMatchedText, P6VOID *pCtx );
00117 
00118 
00125 interface p6IRegexMatch : p6ICom
00126 {
00139    P6COMMETHOD  next( const P6CHAR** pResult ) = 0;
00140 
00149    P6COMMETHOD  reset() = 0;
00150 };
00151 #define IF_p6IRegexMatch {0xE7334DA2,0xAECB,0x46B5,{0xB3,0x73,0xBD,0xFC,0x2B,0x3B,0x96,0xC0}}
00152 
00153 
00160 interface p6IRegex : public p6ICom
00161 {
00173    P6COMMETHOD initialize( P6REGEXFLAGS flags, P6REGEXMODE mode ) = 0;
00174 
00185    P6COMMETHOD setTrace( P6REGEXTRACELEVEL level ) = 0;
00186 
00205    P6COMMETHOD compile( const P6CHAR*   pRegex,
00206                    P6REGEXMODIFIER modifiers
00207                   ) = 0;
00208 
00233     P6COMMETHOD match( const P6CHAR*   pMatch,
00234                   P6REGEXMODIFIER modifiers 
00235                 ) = 0;
00236 
00258     P6COMMETHOD search( const P6CHAR*   pSearch, 
00259                   P6REGEXMODIFIER modifiers, 
00260                   P6UINT32*       pOffset, 
00261                   P6UINT32*       pLength 
00262                  ) = 0;  
00263 
00293     P6COMMETHOD replace( const P6CHAR*   pSearch, 
00294                    P6REGEXMODIFIER modifiers, 
00295                    const P6CHAR*   pReplace,
00296                    P6CHAR*         pResult,
00297                          P6UINT32        cBuffer, 
00298                          P6UINT32*       pWritten
00299                   ) = 0;
00300 
00324     P6COMMETHOD replaceInPlace( P6CHAR*         pSearch, 
00325                           P6REGEXMODIFIER modifiers, 
00326                           const P6CHAR*   pReplace,
00327                           P6UINT32*       pSize 
00328                          ) = 0;
00329 
00362     P6COMMETHOD replaceWithCallback( const P6CHAR*    pSearch, 
00363                                      P6REGEXMODIFIER  modifiers,
00364                                      P6REGEXREPLACECB pfn, 
00365                                      P6VOID*          pCtx,
00366                                      p6IRegexMatch**  pResult
00367                                    ) = 0;
00368 
00388     P6COMMETHOD getCaptureText( P6UINT32  index, 
00389                         P6UINT32* pOffset, 
00390                         P6UINT32* pLength 
00391                        ) = 0;
00392 
00412     P6COMMETHOD setBackTrackLimits( P6UINT32 maxBackStack, P6UINT32 maxBackTracks ) = 0; 
00413 };
00414 
00415 // {14FC8F04-F531-4ab1-9A9E-F8002AC35EDB}
00416 #define IF_p6IRegex  {0x14fc8f04,0xf531,0x4ab1,{0x9a,0x9e,0xf8,0x0,0x2a,0xc3,0x5e,0xdb}}
00417 
00418 // {35FA0ABF-90FF-481d-91D6-74E1D1B1D6F8}
00419 #define COMP_p6Regex {0x35fa0abf,0x90ff,0x481d,{0x91,0xd6,0x74,0xe1,0xd1,0xb1,0xd6,0xf8}}
00420 
00421 #ifdef  __cplusplus
00422 }
00423 #endif
00424 
00425 } // namespace
00426 
00427 
00428 #endif
00429 
00430 
00431 
00432 
00433 
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Copyright © 2004 - 2010 P6R Inc. - All Rights Reserved.