regexp.h
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 #ifndef _KJS_REGEXP_H_
00023 #define _KJS_REGEXP_H_
00024 
00025 #include <sys/types.h>
00026 
00027 #include "config.h"
00028 
00029 #ifdef HAVE_PCREPOSIX
00030 #include <pcre.h>
00031 #else  // POSIX regex - not so good...
00032 extern "C" { 
00033 #include <regex.h>
00034 }
00035 #endif //HAVE_PCREPOSIX
00036 
00037 #include "ustring.h"
00038 
00039 namespace KJS {
00040 
00041   class RegExp {
00042   public:
00043     enum { None = 0, Global = 1, IgnoreCase = 2, Multiline = 4 };
00044     RegExp(const UString &p, int f = None);
00045     ~RegExp();
00046     int flags() const { return flgs; }
00047     UString match(const UString &s, int i, int *pos = 0, int **ovector = 0);
00048     
00049     
00050     
00051     uint subPatterns() const { return nrSubPatterns; }
00052   private:
00053     const UString &pattern;
00054     int flgs;
00055     bool m_notEmpty;
00056 
00057 #ifndef HAVE_PCREPOSIX
00058     regex_t preg;
00059 #else
00060     pcre *pcregex;
00061 #endif
00062     uint nrSubPatterns;
00063 
00064     RegExp();
00065   };
00066 
00067 } 
00068 
00069 #endif
 
This file is part of the documentation for kjs Library Version 3.2.0.