#ifndef ROOT_TPRegexp
#define ROOT_TPRegexp
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef ROOT_TArrayI
#include "TArrayI.h"
#endif
struct PCREPriv_t;
class TPRegexp {
protected:
   enum {
      kPCRE_GLOBAL     = 0x80000000,
      kPCRE_OPTIMIZE   = 0x40000000,
      kPCRE_DEBUG_MSGS = 0x20000000,
      kPCRE_INTMASK    = 0x0FFF
   };
   TString     fPattern;
   PCREPriv_t *fPriv;
   UInt_t      fPCREOpts;
   void     Compile();
   void     Optimize();
   UInt_t   ParseMods(const TString &mods) const;
   Int_t    ReplaceSubs(const TString &s, TString &final,
                        const TString &replacePattern,
                        Int_t *ovec, Int_t nmatch) const;
   Int_t    MatchInternal(const TString& s, Int_t start,
                          Int_t nMaxMatch, TArrayI *pos=0);
   Int_t    SubstituteInternal(TString &s, const TString &replace,
                               Int_t start, Int_t nMaxMatch0,
                               Bool_t doDollarSubst);
public:
   TPRegexp();
   TPRegexp(const TString &pat);
   TPRegexp(const TPRegexp &p);
   virtual ~TPRegexp();
   Int_t      Match(const TString &s, const TString &mods="",
                    Int_t start=0, Int_t nMaxMatch=10, TArrayI *pos=0);
   TObjArray *MatchS(const TString &s, const TString &mods="",
                     Int_t start=0, Int_t nMaxMatch=10);
   Bool_t     MatchB(const TString &s, const TString &mods="",
                     Int_t start=0, Int_t nMaxMatch=10) {
                           return (Match(s,mods,start,nMaxMatch) > 0); }
   Int_t      Substitute(TString &s, const TString &replace,
                         const TString &mods="", Int_t start=0,
                         Int_t nMatchMax=10);
   TString GetPattern()   const { return fPattern; }
   TString GetModifiers() const;
   TPRegexp &operator=(const TPRegexp &p);
   ClassDef(TPRegexp,0)  
};
class TPMERegexp : protected TPRegexp {
private:
   TPMERegexp& operator=(const TPMERegexp&);  
protected:
   Int_t    fNMaxMatches;         
   Int_t    fNMatches;            
   TArrayI  fMarkers;             
   TString  fLastStringMatched;   
   void    *fAddressOfLastString; 
   Int_t    fLastGlobalPosition;  
public:
   TPMERegexp();
   TPMERegexp(const TString& s, const TString& opts = "", Int_t nMatchMax = 10);
   TPMERegexp(const TString& s, UInt_t opts, Int_t nMatchMax = 10);
   TPMERegexp(const TPMERegexp& r);
   virtual ~TPMERegexp() {}
   void    Reset(const TString& s, const TString& opts = "", Int_t nMatchMax = -1);
   void    Reset(const TString& s, UInt_t opts, Int_t nMatchMax = -1);
   Int_t   GetNMaxMatches()   const { return fNMaxMatches; }
   void    SetNMaxMatches(Int_t nm) { fNMaxMatches = nm; }
   Int_t   GetGlobalPosition() const { return fLastGlobalPosition; }
   void    AssignGlobalState(const TPMERegexp& re);
   void    ResetGlobalState();
   Int_t   Match(const TString& s, UInt_t start = 0);
   Int_t   Split(const TString& s, Int_t maxfields = 0);
   Int_t   Substitute(TString& s, const TString& r, Bool_t doDollarSubst=kTRUE);
   Int_t   NMatches() const { return fNMatches; }
   TString operator[](Int_t);
   virtual void Print(Option_t* option="");
   ClassDef(TPMERegexp, 0); 
};
class TStringToken : public TString {
protected:
   const TString fFullStr;
   TPRegexp      fSplitRe;
   Bool_t        fReturnVoid;
   Int_t         fPos;
public:
   TStringToken(const TString& fullStr, const TString& splitRe, Bool_t retVoid=kFALSE);
   virtual ~TStringToken() {}
   Bool_t NextToken();
   Bool_t AtEnd() const { return fPos >= fFullStr.Length(); }
   ClassDef(TStringToken,0) 
};
#endif
Last change: Tue Dec  9 09:01:12 2008
Last generated: 2008-12-09 09:01
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.