ROOT  6.06/09
Reference Guide
TRegexp.h
Go to the documentation of this file.
1 // @(#)root/base:$Id$
2 // Author: Fons Rademakers 04/08/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TRegexp
13 #define ROOT_TRegexp
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TRegexp //
19 // //
20 // Declarations for regular expression class. //
21 // //
22 //////////////////////////////////////////////////////////////////////////
23 
24 #ifndef ROOT_Rtypes
25 #include "Rtypes.h"
26 #endif
27 
28 #ifndef ROOT_Match
29 #include "Match.h"
30 #endif
31 
32 class TString;
33 
34 
35 class TRegexp {
36 
37 public:
38  enum EStatVal { kOK = 0, kIllegal, kNomem, kToolong };
39 
40 private:
41  Pattern_t *fPattern; // Compiled pattern
42  EStatVal fStat; // Status
43  static const unsigned fgMaxpat; // Max length of compiled pattern
44 
45  void CopyPattern(const TRegexp& re);
46  void GenPattern(const char *re);
47  const char *MakeWildcard(const char *re);
48 
49 public:
50  TRegexp(const char *re, Bool_t wildcard = kFALSE);
51  TRegexp(const TString& re);
52  TRegexp(const TRegexp& re);
53  virtual ~TRegexp();
54 
55  TRegexp& operator=(const TRegexp& re);
56  TRegexp& operator=(const TString& re); // Recompiles pattern
57  TRegexp& operator=(const char *re); // Recompiles pattern
58  Ssiz_t Index(const TString& str, Ssiz_t *len, Ssiz_t start=0) const;
59  EStatVal Status(); // Return & clear status
60 
61  ClassDef(TRegexp,0) // Regular expression class
62 };
63 
64 #endif
TRegexp(const char *re, Bool_t wildcard=kFALSE)
Pattern_t * fPattern
Definition: TRegexp.h:41
EStatVal
Definition: TRegexp.h:38
TRegexp & operator=(const TRegexp &re)
Assignment operator.
Definition: TRegexp.cxx:85
Ssiz_t Index(const TString &str, Ssiz_t *len, Ssiz_t start=0) const
Find the first occurrence of the regexp in string and return the position, or -1 if there is no match...
Definition: TRegexp.cxx:208
Regular expression class.
Definition: TRegexp.h:35
Basic string class.
Definition: TString.h:137
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
void GenPattern(const char *re)
Generate the regular expression pattern.
Definition: TRegexp.cxx:117
#define ClassDef(name, id)
Definition: Rtypes.h:254
unsigned short Pattern_t
Definition: Match.h:26
EStatVal fStat
Definition: TRegexp.h:42
const char * MakeWildcard(const char *re)
This routine transforms a wildcarding regular expression into a general regular expression used for p...
Definition: TRegexp.cxx:144
int Ssiz_t
Definition: RtypesCore.h:63
void CopyPattern(const TRegexp &re)
Copy the regular expression pattern.
Definition: TRegexp.cxx:127
virtual ~TRegexp()
Destructor.
Definition: TRegexp.cxx:77
EStatVal Status()
Check status of regexp.
Definition: TRegexp.cxx:230
static const unsigned fgMaxpat
Definition: TRegexp.h:43