passenger 4.0.27 → 4.0.28

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (156) hide show
  1. data.tar.gz.asc +7 -7
  2. data/.gitignore +1 -0
  3. data/NEWS +22 -0
  4. data/build/preprocessor.rb +10 -0
  5. data/build/rpm.rb +74 -65
  6. data/debian.template/rules.template +8 -0
  7. data/dev/copy_boost_headers.rb +11 -2
  8. data/doc/Users guide Apache.idmap.txt +161 -145
  9. data/doc/Users guide Apache.txt +12 -1
  10. data/doc/Users guide Nginx.idmap.txt +142 -126
  11. data/doc/Users guide Nginx.txt +14 -1
  12. data/doc/Users guide Standalone.txt +1 -0
  13. data/doc/users_guide_snippets/environment_variables.txt +1 -1
  14. data/doc/users_guide_snippets/installation.txt +2 -0
  15. data/doc/users_guide_snippets/tips.txt +118 -0
  16. data/ext/apache2/Configuration.cpp +0 -6
  17. data/ext/apache2/Configuration.hpp +0 -5
  18. data/ext/apache2/ConfigurationCommands.cpp +7 -0
  19. data/ext/apache2/ConfigurationFields.hpp +2 -0
  20. data/ext/apache2/ConfigurationSetters.cpp +24 -0
  21. data/ext/apache2/CreateDirConfig.cpp +1 -0
  22. data/ext/apache2/Hooks.cpp +0 -1
  23. data/ext/apache2/MergeDirConfig.cpp +7 -0
  24. data/ext/apache2/SetHeaders.cpp +5 -1
  25. data/ext/boost/cregex.hpp +39 -0
  26. data/ext/boost/libs/regex/src/c_regex_traits.cpp +193 -0
  27. data/ext/boost/libs/regex/src/cpp_regex_traits.cpp +117 -0
  28. data/ext/boost/libs/regex/src/cregex.cpp +660 -0
  29. data/ext/boost/libs/regex/src/instances.cpp +32 -0
  30. data/ext/boost/libs/regex/src/internals.hpp +35 -0
  31. data/ext/boost/libs/regex/src/posix_api.cpp +296 -0
  32. data/ext/boost/libs/regex/src/regex.cpp +227 -0
  33. data/ext/boost/libs/regex/src/regex_debug.cpp +59 -0
  34. data/ext/boost/libs/regex/src/regex_raw_buffer.cpp +72 -0
  35. data/ext/boost/libs/regex/src/regex_traits_defaults.cpp +692 -0
  36. data/ext/boost/libs/regex/src/static_mutex.cpp +179 -0
  37. data/ext/boost/libs/regex/src/wc_regex_traits.cpp +301 -0
  38. data/ext/boost/libs/regex/src/wide_posix_api.cpp +315 -0
  39. data/ext/boost/libs/regex/src/winstances.cpp +35 -0
  40. data/ext/boost/regex.h +100 -0
  41. data/ext/boost/regex.hpp +37 -0
  42. data/ext/boost/regex/concepts.hpp +1128 -0
  43. data/ext/boost/regex/config.hpp +435 -0
  44. data/ext/boost/regex/config/borland.hpp +72 -0
  45. data/ext/boost/regex/config/cwchar.hpp +207 -0
  46. data/ext/boost/regex/mfc.hpp +190 -0
  47. data/ext/boost/regex/pattern_except.hpp +100 -0
  48. data/ext/boost/regex/pending/object_cache.hpp +165 -0
  49. data/ext/boost/regex/pending/static_mutex.hpp +179 -0
  50. data/ext/boost/regex/pending/unicode_iterator.hpp +776 -0
  51. data/ext/boost/regex/regex_traits.hpp +35 -0
  52. data/ext/boost/regex/user.hpp +93 -0
  53. data/ext/boost/regex/v4/basic_regex.hpp +782 -0
  54. data/ext/boost/regex/v4/basic_regex_creator.hpp +1571 -0
  55. data/ext/boost/regex/v4/basic_regex_parser.hpp +2874 -0
  56. data/ext/boost/regex/v4/c_regex_traits.hpp +211 -0
  57. data/ext/boost/regex/v4/char_regex_traits.hpp +81 -0
  58. data/ext/boost/regex/v4/cpp_regex_traits.hpp +1099 -0
  59. data/ext/boost/regex/v4/cregex.hpp +330 -0
  60. data/ext/boost/regex/v4/error_type.hpp +59 -0
  61. data/ext/boost/regex/v4/fileiter.hpp +455 -0
  62. data/ext/boost/regex/v4/instances.hpp +222 -0
  63. data/ext/boost/regex/v4/iterator_category.hpp +91 -0
  64. data/ext/boost/regex/v4/iterator_traits.hpp +135 -0
  65. data/ext/boost/regex/v4/match_flags.hpp +138 -0
  66. data/ext/boost/regex/v4/match_results.hpp +702 -0
  67. data/ext/boost/regex/v4/mem_block_cache.hpp +99 -0
  68. data/ext/boost/regex/v4/perl_matcher.hpp +587 -0
  69. data/ext/boost/regex/v4/perl_matcher_common.hpp +996 -0
  70. data/ext/boost/regex/v4/perl_matcher_non_recursive.hpp +1642 -0
  71. data/ext/boost/regex/v4/perl_matcher_recursive.hpp +991 -0
  72. data/ext/boost/regex/v4/primary_transform.hpp +146 -0
  73. data/ext/boost/regex/v4/protected_call.hpp +81 -0
  74. data/ext/boost/regex/v4/regbase.hpp +180 -0
  75. data/ext/boost/regex/v4/regex.hpp +202 -0
  76. data/ext/boost/regex/v4/regex_format.hpp +1156 -0
  77. data/ext/boost/regex/v4/regex_fwd.hpp +73 -0
  78. data/ext/boost/regex/v4/regex_grep.hpp +155 -0
  79. data/ext/boost/regex/v4/regex_iterator.hpp +201 -0
  80. data/ext/boost/regex/v4/regex_match.hpp +382 -0
  81. data/ext/boost/regex/v4/regex_merge.hpp +93 -0
  82. data/ext/boost/regex/v4/regex_raw_buffer.hpp +210 -0
  83. data/ext/boost/regex/v4/regex_replace.hpp +99 -0
  84. data/ext/boost/regex/v4/regex_search.hpp +217 -0
  85. data/ext/boost/regex/v4/regex_split.hpp +172 -0
  86. data/ext/boost/regex/v4/regex_token_iterator.hpp +342 -0
  87. data/ext/boost/regex/v4/regex_traits.hpp +189 -0
  88. data/ext/boost/regex/v4/regex_traits_defaults.hpp +371 -0
  89. data/ext/boost/regex/v4/regex_workaround.hpp +232 -0
  90. data/ext/boost/regex/v4/states.hpp +301 -0
  91. data/ext/boost/regex/v4/sub_match.hpp +512 -0
  92. data/ext/boost/regex/v4/syntax_type.hpp +105 -0
  93. data/ext/boost/regex/v4/u32regex_iterator.hpp +193 -0
  94. data/ext/boost/regex/v4/u32regex_token_iterator.hpp +377 -0
  95. data/ext/boost/regex/v4/w32_regex_traits.hpp +741 -0
  96. data/ext/boost/regex_fwd.hpp +33 -0
  97. data/ext/common/AgentsStarter.h +0 -11
  98. data/ext/common/ApplicationPool2/Common.h +1 -7
  99. data/ext/common/ApplicationPool2/DirectSpawner.h +3 -3
  100. data/ext/common/ApplicationPool2/Group.h +166 -69
  101. data/ext/common/ApplicationPool2/Implementation.cpp +55 -10
  102. data/ext/common/ApplicationPool2/Options.h +45 -10
  103. data/ext/common/ApplicationPool2/PipeWatcher.h +1 -2
  104. data/ext/common/ApplicationPool2/Pool.h +29 -7
  105. data/ext/common/ApplicationPool2/Process.h +22 -3
  106. data/ext/common/ApplicationPool2/Session.h +1 -0
  107. data/ext/common/ApplicationPool2/SmartSpawner.h +5 -10
  108. data/ext/common/ApplicationPool2/Spawner.h +10 -15
  109. data/ext/common/ApplicationPool2/SuperGroup.h +10 -9
  110. data/ext/common/Constants.h +1 -3
  111. data/ext/common/Hooks.h +193 -0
  112. data/ext/common/Logging.cpp +67 -2
  113. data/ext/common/Logging.h +23 -1
  114. data/ext/common/Utils.cpp +0 -21
  115. data/ext/common/Utils.h +0 -42
  116. data/ext/common/Utils/CachedFileStat.hpp +1 -1
  117. data/ext/common/Utils/StrIntUtils.h +61 -14
  118. data/ext/common/Utils/StringMap.h +4 -0
  119. data/ext/common/agents/HelperAgent/AgentOptions.h +4 -4
  120. data/ext/common/agents/HelperAgent/Main.cpp +2 -3
  121. data/ext/common/agents/HelperAgent/RequestHandler.h +65 -2
  122. data/ext/common/agents/LoggingAgent/FilterSupport.h +3 -1
  123. data/ext/common/agents/Watchdog/Main.cpp +8 -72
  124. data/ext/nginx/CacheLocationConfig.c +29 -1
  125. data/ext/nginx/Configuration.c +0 -12
  126. data/ext/nginx/Configuration.h +0 -1
  127. data/ext/nginx/ConfigurationCommands.c +10 -0
  128. data/ext/nginx/ConfigurationFields.h +2 -0
  129. data/ext/nginx/CreateLocationConfig.c +4 -0
  130. data/ext/nginx/MergeLocationConfig.c +6 -0
  131. data/ext/oxt/system_calls.cpp +7 -1
  132. data/ext/oxt/system_calls.hpp +7 -7
  133. data/helper-scripts/node-loader.js +6 -2
  134. data/helper-scripts/rack-loader.rb +5 -2
  135. data/helper-scripts/rack-preloader.rb +5 -2
  136. data/lib/phusion_passenger.rb +1 -1
  137. data/lib/phusion_passenger/apache2/config_options.rb +8 -0
  138. data/lib/phusion_passenger/constants.rb +0 -1
  139. data/lib/phusion_passenger/nginx/config_options.rb +9 -2
  140. data/lib/phusion_passenger/platform_info/apache.rb +2 -1
  141. data/lib/phusion_passenger/platform_info/compiler.rb +15 -1
  142. data/lib/phusion_passenger/platform_info/cxx_portability.rb +2 -0
  143. data/node_lib/phusion_passenger/httplib_emulation.js +85 -17
  144. data/node_lib/phusion_passenger/request_handler.js +10 -2
  145. data/rpm/Vagrantfile +32 -0
  146. data/rpm/get_distro_id.py +4 -0
  147. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +2 -2
  148. data/test/cxx/ApplicationPool2/PoolTest.cpp +60 -9
  149. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +2 -6
  150. data/test/cxx/CachedFileStatTest.cpp +5 -5
  151. data/test/cxx/RequestHandlerTest.cpp +3 -6
  152. data/test/cxx/UtilsTest.cpp +30 -0
  153. data/test/node/httplib_emulation_spec.js +491 -0
  154. data/test/node/spec_helper.js +25 -0
  155. metadata +78 -2
  156. metadata.gz.asc +7 -7
@@ -0,0 +1,93 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 1998-2002
4
+ * John Maddock
5
+ *
6
+ * Use, modification and distribution are subject to the
7
+ * Boost Software License, Version 1.0. (See accompanying file
8
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
+ *
10
+ */
11
+
12
+ /*
13
+ * LOCATION: see http://www.boost.org for most recent version.
14
+ * FILE regex_format.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Provides formatting output routines for search and replace
17
+ * operations. Note this is an internal header file included
18
+ * by regex.hpp, do not include on its own.
19
+ */
20
+
21
+ #ifndef BOOST_REGEX_V4_REGEX_MERGE_HPP
22
+ #define BOOST_REGEX_V4_REGEX_MERGE_HPP
23
+
24
+
25
+ namespace boost{
26
+
27
+ #ifdef BOOST_MSVC
28
+ #pragma warning(push)
29
+ #pragma warning(disable: 4103)
30
+ #endif
31
+ #ifdef BOOST_HAS_ABI_HEADERS
32
+ # include BOOST_ABI_PREFIX
33
+ #endif
34
+ #ifdef BOOST_MSVC
35
+ #pragma warning(pop)
36
+ #endif
37
+
38
+ template <class OutputIterator, class Iterator, class traits, class charT>
39
+ inline OutputIterator regex_merge(OutputIterator out,
40
+ Iterator first,
41
+ Iterator last,
42
+ const basic_regex<charT, traits>& e,
43
+ const charT* fmt,
44
+ match_flag_type flags = match_default)
45
+ {
46
+ return regex_replace(out, first, last, e, fmt, flags);
47
+ }
48
+
49
+ template <class OutputIterator, class Iterator, class traits, class charT>
50
+ inline OutputIterator regex_merge(OutputIterator out,
51
+ Iterator first,
52
+ Iterator last,
53
+ const basic_regex<charT, traits>& e,
54
+ const std::basic_string<charT>& fmt,
55
+ match_flag_type flags = match_default)
56
+ {
57
+ return regex_merge(out, first, last, e, fmt.c_str(), flags);
58
+ }
59
+
60
+ template <class traits, class charT>
61
+ inline std::basic_string<charT> regex_merge(const std::basic_string<charT>& s,
62
+ const basic_regex<charT, traits>& e,
63
+ const charT* fmt,
64
+ match_flag_type flags = match_default)
65
+ {
66
+ return regex_replace(s, e, fmt, flags);
67
+ }
68
+
69
+ template <class traits, class charT>
70
+ inline std::basic_string<charT> regex_merge(const std::basic_string<charT>& s,
71
+ const basic_regex<charT, traits>& e,
72
+ const std::basic_string<charT>& fmt,
73
+ match_flag_type flags = match_default)
74
+ {
75
+ return regex_replace(s, e, fmt, flags);
76
+ }
77
+
78
+ #ifdef BOOST_MSVC
79
+ #pragma warning(push)
80
+ #pragma warning(disable: 4103)
81
+ #endif
82
+ #ifdef BOOST_HAS_ABI_HEADERS
83
+ # include BOOST_ABI_SUFFIX
84
+ #endif
85
+ #ifdef BOOST_MSVC
86
+ #pragma warning(pop)
87
+ #endif
88
+
89
+ } // namespace boost
90
+
91
+ #endif // BOOST_REGEX_V4_REGEX_MERGE_HPP
92
+
93
+
@@ -0,0 +1,210 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 1998-2002
4
+ * John Maddock
5
+ *
6
+ * Use, modification and distribution are subject to the
7
+ * Boost Software License, Version 1.0. (See accompanying file
8
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
+ *
10
+ */
11
+
12
+ /*
13
+ * LOCATION: see http://www.boost.org for most recent version.
14
+ * FILE regex_raw_buffer.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Raw character buffer for regex code.
17
+ * Note this is an internal header file included
18
+ * by regex.hpp, do not include on its own.
19
+ */
20
+
21
+ #ifndef BOOST_REGEX_RAW_BUFFER_HPP
22
+ #define BOOST_REGEX_RAW_BUFFER_HPP
23
+
24
+ #ifndef BOOST_REGEX_CONFIG_HPP
25
+ #include <boost/regex/config.hpp>
26
+ #endif
27
+
28
+ #include <algorithm>
29
+ #include <cstddef>
30
+
31
+ namespace boost{
32
+ namespace re_detail{
33
+
34
+ #ifdef BOOST_MSVC
35
+ #pragma warning(push)
36
+ #pragma warning(disable: 4103)
37
+ #endif
38
+ #ifdef BOOST_HAS_ABI_HEADERS
39
+ # include BOOST_ABI_PREFIX
40
+ #endif
41
+ #ifdef BOOST_MSVC
42
+ #pragma warning(pop)
43
+ #endif
44
+
45
+ struct empty_padding{};
46
+
47
+ union padding
48
+ {
49
+ void* p;
50
+ unsigned int i;
51
+ };
52
+
53
+ template <int N>
54
+ struct padding3
55
+ {
56
+ enum{
57
+ padding_size = 8,
58
+ padding_mask = 7
59
+ };
60
+ };
61
+
62
+ template<>
63
+ struct padding3<2>
64
+ {
65
+ enum{
66
+ padding_size = 2,
67
+ padding_mask = 1
68
+ };
69
+ };
70
+
71
+ template<>
72
+ struct padding3<4>
73
+ {
74
+ enum{
75
+ padding_size = 4,
76
+ padding_mask = 3
77
+ };
78
+ };
79
+
80
+ template<>
81
+ struct padding3<8>
82
+ {
83
+ enum{
84
+ padding_size = 8,
85
+ padding_mask = 7
86
+ };
87
+ };
88
+
89
+ template<>
90
+ struct padding3<16>
91
+ {
92
+ enum{
93
+ padding_size = 16,
94
+ padding_mask = 15
95
+ };
96
+ };
97
+
98
+ enum{
99
+ padding_size = padding3<sizeof(padding)>::padding_size,
100
+ padding_mask = padding3<sizeof(padding)>::padding_mask
101
+ };
102
+
103
+ //
104
+ // class raw_storage
105
+ // basically this is a simplified vector<unsigned char>
106
+ // this is used by basic_regex for expression storage
107
+ //
108
+
109
+ class BOOST_REGEX_DECL raw_storage
110
+ {
111
+ public:
112
+ typedef std::size_t size_type;
113
+ typedef unsigned char* pointer;
114
+ private:
115
+ pointer last, start, end;
116
+ public:
117
+
118
+ raw_storage();
119
+ raw_storage(size_type n);
120
+
121
+ ~raw_storage()
122
+ {
123
+ ::operator delete(start);
124
+ }
125
+
126
+ void BOOST_REGEX_CALL resize(size_type n);
127
+
128
+ void* BOOST_REGEX_CALL extend(size_type n)
129
+ {
130
+ if(size_type(last - end) < n)
131
+ resize(n + (end - start));
132
+ register pointer result = end;
133
+ end += n;
134
+ return result;
135
+ }
136
+
137
+ void* BOOST_REGEX_CALL insert(size_type pos, size_type n);
138
+
139
+ size_type BOOST_REGEX_CALL size()
140
+ {
141
+ return end - start;
142
+ }
143
+
144
+ size_type BOOST_REGEX_CALL capacity()
145
+ {
146
+ return last - start;
147
+ }
148
+
149
+ void* BOOST_REGEX_CALL data()const
150
+ {
151
+ return start;
152
+ }
153
+
154
+ size_type BOOST_REGEX_CALL index(void* ptr)
155
+ {
156
+ return static_cast<pointer>(ptr) - static_cast<pointer>(data());
157
+ }
158
+
159
+ void BOOST_REGEX_CALL clear()
160
+ {
161
+ end = start;
162
+ }
163
+
164
+ void BOOST_REGEX_CALL align()
165
+ {
166
+ // move end up to a boundary:
167
+ end = start + (((end - start) + padding_mask) & ~padding_mask);
168
+ }
169
+ void swap(raw_storage& that)
170
+ {
171
+ std::swap(start, that.start);
172
+ std::swap(end, that.end);
173
+ std::swap(last, that.last);
174
+ }
175
+ };
176
+
177
+ inline raw_storage::raw_storage()
178
+ {
179
+ last = start = end = 0;
180
+ }
181
+
182
+ inline raw_storage::raw_storage(size_type n)
183
+ {
184
+ start = end = static_cast<pointer>(::operator new(n));
185
+ BOOST_REGEX_NOEH_ASSERT(start)
186
+ last = start + n;
187
+ }
188
+
189
+
190
+ #ifdef BOOST_MSVC
191
+ #pragma warning(push)
192
+ #pragma warning(disable: 4103)
193
+ #endif
194
+ #ifdef BOOST_HAS_ABI_HEADERS
195
+ # include BOOST_ABI_SUFFIX
196
+ #endif
197
+ #ifdef BOOST_MSVC
198
+ #pragma warning(pop)
199
+ #endif
200
+
201
+ } // namespace re_detail
202
+ } // namespace boost
203
+
204
+ #endif
205
+
206
+
207
+
208
+
209
+
210
+
@@ -0,0 +1,99 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 1998-2009
4
+ * John Maddock
5
+ *
6
+ * Use, modification and distribution are subject to the
7
+ * Boost Software License, Version 1.0. (See accompanying file
8
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
+ *
10
+ */
11
+
12
+ /*
13
+ * LOCATION: see http://www.boost.org for most recent version.
14
+ * FILE regex_format.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Provides formatting output routines for search and replace
17
+ * operations. Note this is an internal header file included
18
+ * by regex.hpp, do not include on its own.
19
+ */
20
+
21
+ #ifndef BOOST_REGEX_V4_REGEX_REPLACE_HPP
22
+ #define BOOST_REGEX_V4_REGEX_REPLACE_HPP
23
+
24
+
25
+ namespace boost{
26
+
27
+ #ifdef BOOST_MSVC
28
+ #pragma warning(push)
29
+ #pragma warning(disable: 4103)
30
+ #endif
31
+ #ifdef BOOST_HAS_ABI_HEADERS
32
+ # include BOOST_ABI_PREFIX
33
+ #endif
34
+ #ifdef BOOST_MSVC
35
+ #pragma warning(pop)
36
+ #endif
37
+
38
+ template <class OutputIterator, class BidirectionalIterator, class traits, class charT, class Formatter>
39
+ OutputIterator regex_replace(OutputIterator out,
40
+ BidirectionalIterator first,
41
+ BidirectionalIterator last,
42
+ const basic_regex<charT, traits>& e,
43
+ Formatter fmt,
44
+ match_flag_type flags = match_default)
45
+ {
46
+ regex_iterator<BidirectionalIterator, charT, traits> i(first, last, e, flags);
47
+ regex_iterator<BidirectionalIterator, charT, traits> j;
48
+ if(i == j)
49
+ {
50
+ if(!(flags & regex_constants::format_no_copy))
51
+ out = re_detail::copy(first, last, out);
52
+ }
53
+ else
54
+ {
55
+ BidirectionalIterator last_m(first);
56
+ while(i != j)
57
+ {
58
+ if(!(flags & regex_constants::format_no_copy))
59
+ out = re_detail::copy(i->prefix().first, i->prefix().second, out);
60
+ out = i->format(out, fmt, flags, e);
61
+ last_m = (*i)[0].second;
62
+ if(flags & regex_constants::format_first_only)
63
+ break;
64
+ ++i;
65
+ }
66
+ if(!(flags & regex_constants::format_no_copy))
67
+ out = re_detail::copy(last_m, last, out);
68
+ }
69
+ return out;
70
+ }
71
+
72
+ template <class traits, class charT, class Formatter>
73
+ std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
74
+ const basic_regex<charT, traits>& e,
75
+ Formatter fmt,
76
+ match_flag_type flags = match_default)
77
+ {
78
+ std::basic_string<charT> result;
79
+ re_detail::string_out_iterator<std::basic_string<charT> > i(result);
80
+ regex_replace(i, s.begin(), s.end(), e, fmt, flags);
81
+ return result;
82
+ }
83
+
84
+ #ifdef BOOST_MSVC
85
+ #pragma warning(push)
86
+ #pragma warning(disable: 4103)
87
+ #endif
88
+ #ifdef BOOST_HAS_ABI_HEADERS
89
+ # include BOOST_ABI_SUFFIX
90
+ #endif
91
+ #ifdef BOOST_MSVC
92
+ #pragma warning(pop)
93
+ #endif
94
+
95
+ } // namespace boost
96
+
97
+ #endif // BOOST_REGEX_V4_REGEX_REPLACE_HPP
98
+
99
+
@@ -0,0 +1,217 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 1998-2002
4
+ * John Maddock
5
+ *
6
+ * Use, modification and distribution are subject to the
7
+ * Boost Software License, Version 1.0. (See accompanying file
8
+ * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
+ *
10
+ */
11
+
12
+ /*
13
+ * LOCATION: see http://www.boost.org for most recent version.
14
+ * FILE regex_search.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Provides regex_search implementation.
17
+ */
18
+
19
+ #ifndef BOOST_REGEX_V4_REGEX_SEARCH_HPP
20
+ #define BOOST_REGEX_V4_REGEX_SEARCH_HPP
21
+
22
+
23
+ namespace boost{
24
+
25
+ #ifdef BOOST_MSVC
26
+ #pragma warning(push)
27
+ #pragma warning(disable: 4103)
28
+ #endif
29
+ #ifdef BOOST_HAS_ABI_HEADERS
30
+ # include BOOST_ABI_PREFIX
31
+ #endif
32
+ #ifdef BOOST_MSVC
33
+ #pragma warning(pop)
34
+ #endif
35
+
36
+ template <class BidiIterator, class Allocator, class charT, class traits>
37
+ bool regex_search(BidiIterator first, BidiIterator last,
38
+ match_results<BidiIterator, Allocator>& m,
39
+ const basic_regex<charT, traits>& e,
40
+ match_flag_type flags = match_default)
41
+ {
42
+ return regex_search(first, last, m, e, flags, first);
43
+ }
44
+
45
+ template <class BidiIterator, class Allocator, class charT, class traits>
46
+ bool regex_search(BidiIterator first, BidiIterator last,
47
+ match_results<BidiIterator, Allocator>& m,
48
+ const basic_regex<charT, traits>& e,
49
+ match_flag_type flags,
50
+ BidiIterator base)
51
+ {
52
+ if(e.flags() & regex_constants::failbit)
53
+ return false;
54
+
55
+ re_detail::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, base);
56
+ return matcher.find();
57
+ }
58
+
59
+ //
60
+ // regex_search convenience interfaces:
61
+ #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
62
+ //
63
+ // this isn't really a partial specialisation, but template function
64
+ // overloading - if the compiler doesn't support partial specialisation
65
+ // then it really won't support this either:
66
+ template <class charT, class Allocator, class traits>
67
+ inline bool regex_search(const charT* str,
68
+ match_results<const charT*, Allocator>& m,
69
+ const basic_regex<charT, traits>& e,
70
+ match_flag_type flags = match_default)
71
+ {
72
+ return regex_search(str, str + traits::length(str), m, e, flags);
73
+ }
74
+
75
+ template <class ST, class SA, class Allocator, class charT, class traits>
76
+ inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
77
+ match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
78
+ const basic_regex<charT, traits>& e,
79
+ match_flag_type flags = match_default)
80
+ {
81
+ return regex_search(s.begin(), s.end(), m, e, flags);
82
+ }
83
+ #else // partial overloads:
84
+ inline bool regex_search(const char* str,
85
+ cmatch& m,
86
+ const regex& e,
87
+ match_flag_type flags = match_default)
88
+ {
89
+ return regex_search(str, str + regex::traits_type::length(str), m, e, flags);
90
+ }
91
+ inline bool regex_search(const char* first, const char* last,
92
+ const regex& e,
93
+ match_flag_type flags = match_default)
94
+ {
95
+ cmatch m;
96
+ return regex_search(first, last, m, e, flags | regex_constants::match_any);
97
+ }
98
+
99
+ #ifndef BOOST_NO_WREGEX
100
+ inline bool regex_search(const wchar_t* str,
101
+ wcmatch& m,
102
+ const wregex& e,
103
+ match_flag_type flags = match_default)
104
+ {
105
+ return regex_search(str, str + wregex::traits_type::length(str), m, e, flags);
106
+ }
107
+ inline bool regex_search(const wchar_t* first, const wchar_t* last,
108
+ const wregex& e,
109
+ match_flag_type flags = match_default)
110
+ {
111
+ wcmatch m;
112
+ return regex_search(first, last, m, e, flags | regex_constants::match_any);
113
+ }
114
+ #endif
115
+ inline bool regex_search(const std::string& s,
116
+ smatch& m,
117
+ const regex& e,
118
+ match_flag_type flags = match_default)
119
+ {
120
+ return regex_search(s.begin(), s.end(), m, e, flags);
121
+ }
122
+ #if !defined(BOOST_NO_WREGEX)
123
+ inline bool regex_search(const std::basic_string<wchar_t>& s,
124
+ wsmatch& m,
125
+ const wregex& e,
126
+ match_flag_type flags = match_default)
127
+ {
128
+ return regex_search(s.begin(), s.end(), m, e, flags);
129
+ }
130
+ #endif
131
+
132
+ #endif
133
+
134
+ template <class BidiIterator, class charT, class traits>
135
+ bool regex_search(BidiIterator first, BidiIterator last,
136
+ const basic_regex<charT, traits>& e,
137
+ match_flag_type flags = match_default)
138
+ {
139
+ if(e.flags() & regex_constants::failbit)
140
+ return false;
141
+
142
+ match_results<BidiIterator> m;
143
+ typedef typename match_results<BidiIterator>::allocator_type match_alloc_type;
144
+ re_detail::perl_matcher<BidiIterator, match_alloc_type, traits> matcher(first, last, m, e, flags | regex_constants::match_any, first);
145
+ return matcher.find();
146
+ }
147
+
148
+ #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
149
+
150
+ template <class charT, class traits>
151
+ inline bool regex_search(const charT* str,
152
+ const basic_regex<charT, traits>& e,
153
+ match_flag_type flags = match_default)
154
+ {
155
+ return regex_search(str, str + traits::length(str), e, flags);
156
+ }
157
+
158
+ template <class ST, class SA, class charT, class traits>
159
+ inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
160
+ const basic_regex<charT, traits>& e,
161
+ match_flag_type flags = match_default)
162
+ {
163
+ return regex_search(s.begin(), s.end(), e, flags);
164
+ }
165
+ #else // non-template function overloads
166
+ inline bool regex_search(const char* str,
167
+ const regex& e,
168
+ match_flag_type flags = match_default)
169
+ {
170
+ cmatch m;
171
+ return regex_search(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
172
+ }
173
+ #ifndef BOOST_NO_WREGEX
174
+ inline bool regex_search(const wchar_t* str,
175
+ const wregex& e,
176
+ match_flag_type flags = match_default)
177
+ {
178
+ wcmatch m;
179
+ return regex_search(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
180
+ }
181
+ #endif
182
+ inline bool regex_search(const std::string& s,
183
+ const regex& e,
184
+ match_flag_type flags = match_default)
185
+ {
186
+ smatch m;
187
+ return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
188
+ }
189
+ #if !defined(BOOST_NO_WREGEX)
190
+ inline bool regex_search(const std::basic_string<wchar_t>& s,
191
+ const wregex& e,
192
+ match_flag_type flags = match_default)
193
+ {
194
+ wsmatch m;
195
+ return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
196
+ }
197
+
198
+ #endif // BOOST_NO_WREGEX
199
+
200
+ #endif // partial overload
201
+
202
+ #ifdef BOOST_MSVC
203
+ #pragma warning(push)
204
+ #pragma warning(disable: 4103)
205
+ #endif
206
+ #ifdef BOOST_HAS_ABI_HEADERS
207
+ # include BOOST_ABI_SUFFIX
208
+ #endif
209
+ #ifdef BOOST_MSVC
210
+ #pragma warning(pop)
211
+ #endif
212
+
213
+ } // namespace boost
214
+
215
+ #endif // BOOST_REGEX_V4_REGEX_SEARCH_HPP
216
+
217
+