00001 // @(#)root/base:$Id: TRegexp.h 20877 2007-11-19 11:17:07Z rdm $ 00002 // Author: Fons Rademakers 04/08/95 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TRegexp 00013 #define ROOT_TRegexp 00014 00015 00016 ////////////////////////////////////////////////////////////////////////// 00017 // // 00018 // TRegexp // 00019 // // 00020 // Declarations for regular expression class. // 00021 // // 00022 ////////////////////////////////////////////////////////////////////////// 00023 00024 #ifndef ROOT_Rtypes 00025 #include "Rtypes.h" 00026 #endif 00027 00028 #ifndef ROOT_Match 00029 #include "Match.h" 00030 #endif 00031 00032 class TString; 00033 00034 00035 class TRegexp { 00036 00037 public: 00038 enum EStatVal { kOK = 0, kIllegal, kNomem, kToolong }; 00039 00040 private: 00041 Pattern_t *fPattern; // Compiled pattern 00042 EStatVal fStat; // Status 00043 static const unsigned fgMaxpat; // Max length of compiled pattern 00044 00045 void CopyPattern(const TRegexp& re); 00046 void GenPattern(const char *re); 00047 const char *MakeWildcard(const char *re); 00048 00049 public: 00050 TRegexp(const char *re, Bool_t wildcard = kFALSE); 00051 TRegexp(const TString& re); 00052 TRegexp(const TRegexp& re); 00053 virtual ~TRegexp(); 00054 00055 TRegexp& operator=(const TRegexp& re); 00056 TRegexp& operator=(const TString& re); // Recompiles pattern 00057 TRegexp& operator=(const char *re); // Recompiles pattern 00058 Ssiz_t Index(const TString& str, Ssiz_t *len, Ssiz_t start=0) const; 00059 EStatVal Status(); // Return & clear status 00060 00061 ClassDef(TRegexp,0) // Regular expression class 00062 }; 00063 00064 #endif