ClanLib  2.3.7
RegExp/regexp.h
Go to the documentation of this file.
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2011 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
31 
32 #pragma once
33 
34 #include "../Core/System/sharedptr.h"
35 #include "api_regexp.h"
36 #include "regexp_match.h"
37 
38 class CL_RegExp_Impl;
39 
44 {
47 
48 public:
49 
55  CL_RegExp(const char *expression, int compile_flags = 0, bool study = false);
56 
62  CL_RegExp(const CL_StringRef8 &expression, int compile_flags = 0, bool study = false);
63 
64  ~CL_RegExp();
65 
69 
70 public:
72  {
73  compile_anchored = 1,
74  compile_auto_callout = 2,
75  compile_caseless = 4,
76  compile_dollar_endonly = 8,
77  compile_dot_all = 16,
78  compile_extended = 32,
79  compile_extra = 64,
80  compile_multi_line = 128,
81  compile_no_auto_capture = 256,
82  compile_ungreedy = 512,
83  compile_utf8 = 1024,
84  compile_no_utf8_check = 2048
85  };
86 
88  {
89  search_anchored = 1,
90  search_not_bol = 2,
91  search_not_eol = 4,
92  search_not_empty = 8,
93  search_no_utf8_check = 16,
94  search_partial = 32
95  };
96 
102  int get_string_number(const char *name) const;
103 
109  int get_string_number(const CL_StringRef8 &name) const;
110 
114 
115 public:
117  CL_RegExpMatch search(
118  const char *subject,
119  int length,
120  int start_offset = 0,
121  int search_flags = 0) const;
122 
123  CL_RegExpMatch search(
124  const CL_StringRef8 &subject,
125  int start_offset = 0,
126  int search_flags = 0) const;
127 
128  void search(
129  const char *subject,
130  int length,
131  int start_offset,
132  int search_flags,
133  CL_RegExpMatch &result) const;
134 
135  void search(
136  const CL_StringRef8 &subject,
137  int start_offset,
138  int search_flags,
139  CL_RegExpMatch &result) const;
140 
144 
145 private:
146  CL_SharedPtr<CL_RegExp_Impl> impl;
148 };
149