Logo ROOT  
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 #include "Rtypes.h"
25 
26 #include "Match.h"
27 
28 class TString;
29 
30 
31 class TRegexp {
32 
33 public:
34  enum EStatVal { kOK = 0, kIllegal, kNomem, kToolong };
35 
36 private:
37  Pattern_t *fPattern; // Compiled pattern
38  EStatVal fStat; // Status
39  static const unsigned fgMaxpat; // Max length of compiled pattern
40 
41  void CopyPattern(const TRegexp& re);
42  void GenPattern(const char *re);
43  const char *MakeWildcard(const char *re);
44 
45 public:
46  TRegexp(const char *re, Bool_t wildcard = kFALSE);
47  TRegexp(const TString& re);
48  TRegexp(const TRegexp& re);
49  virtual ~TRegexp();
50 
51  TRegexp& operator=(const TRegexp& re);
52  TRegexp& operator=(const TString& re); // Recompiles pattern
53  TRegexp& operator=(const char *re); // Recompiles pattern
54  Ssiz_t Index(const TString& str, Ssiz_t *len, Ssiz_t start=0) const;
55  EStatVal Status(); // Return & clear status
56 
57  ClassDef(TRegexp,0) // Regular expression class
58 };
59 
60 #endif
TRegexp::Index
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:209
TRegexp::~TRegexp
virtual ~TRegexp()
Destructor.
Definition: TRegexp.cxx:78
TRegexp::fPattern
Pattern_t * fPattern
Definition: TRegexp.h:37
TRegexp::TRegexp
TRegexp(const char *re, Bool_t wildcard=kFALSE)
Create a regular expression from the input string.
Definition: TRegexp.cxx:51
TRegexp::fStat
EStatVal fStat
Definition: TRegexp.h:38
TRegexp::CopyPattern
void CopyPattern(const TRegexp &re)
Copy the regular expression pattern.
Definition: TRegexp.cxx:128
Pattern_t
unsigned short Pattern_t
Definition: Match.h:26
TRegexp::fgMaxpat
static const unsigned fgMaxpat
Definition: TRegexp.h:39
TRegexp::kToolong
@ kToolong
Definition: TRegexp.h:34
TRegexp::Status
EStatVal Status()
Check status of regexp.
Definition: TRegexp.cxx:231
TString
Basic string class.
Definition: TString.h:136
TRegexp::kNomem
@ kNomem
Definition: TRegexp.h:34
bool
TRegexp::GenPattern
void GenPattern(const char *re)
Generate the regular expression pattern.
Definition: TRegexp.cxx:118
TRegexp::kOK
@ kOK
Definition: TRegexp.h:34
TRegexp::kIllegal
@ kIllegal
Definition: TRegexp.h:34
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TRegexp::EStatVal
EStatVal
Definition: TRegexp.h:34
TRegexp
Regular expression class.
Definition: TRegexp.h:31
TRegexp::MakeWildcard
const char * MakeWildcard(const char *re)
This routine transforms a wildcarding regular expression into a general regular expression used for p...
Definition: TRegexp.cxx:145
Match.h
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
Rtypes.h
TRegexp::operator=
TRegexp & operator=(const TRegexp &re)
Assignment operator.
Definition: TRegexp.cxx:86
int