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 &operator=(regex &&);
52  regex(regex &&);
53 
54  ~regex();
55 
62  regex(std::string const &pattern,int flags = normal);
63 
64 
71  void assign(std::string const &pattern,int flags = normal);
75  int flags() const;
79  std::string str() const;
83  unsigned mark_count() const;
84 
90 
91  bool match(char const *begin,char const *end,int flags = 0) const;
100  bool match(char const *begin,char const *end,std::vector<std::pair<int,int> > &marks,int flags = 0) const;
101 
107 
108  bool search(char const *begin,char const *end,int flags = 0) const;
117  bool search(char const *begin,char const *end,std::vector<std::pair<int,int> > &marks,int flags = 0) const;
118 
119  static bool utf8_supported();
120 
124  bool empty() const;
125 
126 
127  static const int perl = 0;
128  static const int normal = 0;
129  static const int icase = 0x100;
130  static const int utf8 = 0x200;
131 
132  private:
133  struct data;
134  copy_ptr<data> d;
135  };
136 } // booster
137 
138 
139 #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