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 65