Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
28class TString;
29
30
31class TRegexp {
32
33public:
35
36private:
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
45public:
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
unsigned short Pattern_t
Definition Match.h:26
const Bool_t kFALSE
Definition RtypesCore.h:92
#define ClassDef(name, id)
Definition Rtypes.h:325
Regular expression class.
Definition TRegexp.h:31
Pattern_t * fPattern
Definition TRegexp.h:37
EStatVal Status()
Check status of regexp.
Definition TRegexp.cxx:231
EStatVal fStat
Definition TRegexp.h:38
void CopyPattern(const TRegexp &re)
Copy the regular expression pattern.
Definition TRegexp.cxx:128
static const unsigned fgMaxpat
Definition TRegexp.h:39
virtual ~TRegexp()
Destructor.
Definition TRegexp.cxx:78
TRegexp & operator=(const TRegexp &re)
Assignment operator.
Definition TRegexp.cxx:86
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
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
@ kToolong
Definition TRegexp.h:34
@ kIllegal
Definition TRegexp.h:34
@ kNomem
Definition TRegexp.h:34
@ kOK
Definition TRegexp.h:34
void GenPattern(const char *re)
Generate the regular expression pattern.
Definition TRegexp.cxx:118
Basic string class.
Definition TString.h:136