CppCMS
perl_regex.h
1 //
2 // Copyright (C) 2009-2012 Artyom Beilis (Tonkikh)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 #ifndef BOOSTER_PERL_REGEX_H
9 #define BOOSTER_PERL_REGEX_H
10 
11 #include <booster/config.h>
12 #include <booster/copy_ptr.h>
13 #include <string>
14 #include <vector>
15 #include <booster/backtrace.h>
16 
17 namespace booster {
22  public:
23  regex_error(std::string const &s) : booster::runtime_error(s)
24  {
25  }
26  };
27 
35  class BOOSTER_API regex {
36  public:
37  typedef char value_type;
38 
39  explicit regex();
44  regex(regex const &);
49  regex const &operator=(regex const &);
50 
51  ~regex();
52 
59  regex(std::string const &pattern,int flags = normal);
60 
61 
68  void assign(std::string const &pattern,int flags = normal);
72  int flags() const;
76  std::string str() const;
80  unsigned mark_count() const;
81 
87 
88  bool match(char const *begin,char const *end,int flags = 0) const;
97  bool match(char const *begin,char const *end,std::vector<std::pair<int,int> > &marks,int flags = 0) const;
98 
104 
105  bool search(char const *begin,char const *end,int flags = 0) const;
114  bool search(char const *begin,char const *end,std::vector<std::pair<int,int> > &marks,int flags = 0) const;
115 
119  bool empty() const;
120 
121  static const int perl = 0;
122  static const int normal = 0;
123  static const int icase = 0x100;
124  static const int utf8 = 0x200;
125 
126  private:
127  struct data;
128  copy_ptr<data> d;
129  };
130 } // booster
131 
132 
133 #endif
This is a simple wrapper of PCRE library.
Definition: perl_regex.h:35
Exception that is thrown in case of creation of invalid regex.
Definition: perl_regex.h:21
Same as std::runtime_error but records stack trace.
Definition: backtrace.h:158
Booster library namespace. The library that implements Boost Like API in ABI backward compatible way...
Definition: application.h:23