forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- new TPRegexp class by Eddy Offermann using the PCRE library for powerful regexp matching. TPRegexp is fully integrated in TString and can be used like TRegExp. For more see the TPRegexp clas description. - Extended TString::Atoi(), Atof(), IsDigit() and new IsFloat() by John Frankland. For more see the method description. git-svn-id: http://root.cern.ch/svn/root/trunk@13456 27541ba8-7e3a-0410-8455-c3a389f83636
- Loading branch information
1 parent
86f5f6d
commit 0205b69
Showing
10 changed files
with
758 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// @(#)root/base:$Name: $:$Id: TRegexp.h,v 1.1.1.1 2000/05/16 17:00:39 rdm Exp $ | ||
// Author: Eddy Offermann 24/06/05 | ||
|
||
/************************************************************************* | ||
* Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. * | ||
* All rights reserved. * | ||
* * | ||
* For the licensing terms see $ROOTSYS/LICENSE. * | ||
* For the list of contributors see $ROOTSYS/README/CREDITS. * | ||
*************************************************************************/ | ||
|
||
#ifndef ROOT_TPRegexp | ||
#define ROOT_TPRegexp | ||
|
||
////////////////////////////////////////////////////////////////////////// | ||
// // | ||
// TPRegexp // | ||
// // | ||
// C++ Wrapper for the "Perl Compatible Regular Expressions" library // | ||
// The PCRE lib can be found at: // | ||
// http://www.pcre.org/ // | ||
// // | ||
// Extensive documentation about Regular expressions in Perl can be // | ||
// found at : // | ||
// http://perldoc.perl.org/perlre.html // | ||
// // | ||
////////////////////////////////////////////////////////////////////////// | ||
|
||
#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 { | ||
|
||
private: | ||
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; | ||
|
||
public: | ||
TPRegexp(); | ||
TPRegexp(const TString &pat); | ||
TPRegexp(const TPRegexp &p); | ||
virtual ~TPRegexp(); | ||
|
||
Int_t Match(const TString &s, const TString &mods="", | ||
Int_t offset=0, Int_t nMatchMax=30, TArrayI *pos=0); | ||
TObjArray *MatchS(const TString &s, const TString &mods="", | ||
Int_t offset=0, Int_t nMaxMatch=30); | ||
Bool_t MatchB(const TString &s, const TString &mods="", | ||
Int_t offset=0, Int_t nMaxMatch=30) { | ||
return (Match(s,mods,offset,nMaxMatch) > 0); } | ||
Int_t Substitute(TString &s, const TString &replace, | ||
const TString &mods="", Int_t offset=0, | ||
Int_t nMatchMax=30); | ||
|
||
TPRegexp &operator=(const TPRegexp &p); | ||
|
||
ClassDef(TPRegexp,0) // Perl Compatible Regular Expression Class | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.