Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

RE.h

Go to the documentation of this file.
00001 // RE.h: regex class definition
00002 // Haejoong Lee, Xiaoyi Ma, Steven Bird
00003 // Copyright (C) 2001 Linguistic Data Consortium, U Penn.
00004 // Web: http://www.ldc.upenn.edu/; Email: ldc@ldc.upenn.edu
00005 // For license information, see the file `LICENSE' included
00006 // with the distribution.
00007 
00008 
00009 #ifndef _RE_H_
00010 #define _RE_H_
00011 
00012 #include <string>
00013 #include <sys/types.h>
00014 #include "regex.h"
00015 #include "agfioError.h"
00016 
00018 class DllExport RE
00019 {
00020 private:
00021   regex_t *preg;
00022   size_t nmatch;
00023   regmatch_t *pmatch;
00024   string s;
00025   int span[2];
00026   bool matched;
00027 
00028 public:
00030   class CompError : public agfioError
00031   {
00032   public:
00033     CompError(const string& s): agfioError("RE:" + s) {}
00034   };
00035 
00037 
00041   class MatchError : public agfioError
00042   {
00043   public:
00044     MatchError(const string& s): agfioError("RE:" + s) {}
00045   };
00046 
00053   class GetError : public agfioError
00054   {
00055   public:
00056     GetError(const string& s): agfioError("RE:" + s) {}
00057   };
00058 
00060 
00064   RE(const string &pattern);
00065   ~RE();
00066 
00072   bool match(const string &s);
00073 
00084   string
00085   get_matched(const int i);
00086 
00098   const int*
00099   get_span(const int i);
00100   
00102   int
00103   get_nsub();
00104 };
00105 
00106 #endif

Generated at Wed Jul 3 14:54:03 2002 for Annotation Graph API by doxygen1.2.7 written by Dimitri van Heesch, © 1997-2001