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,512 @@
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 sub_match.cpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Declares template class sub_match.
17
+ */
18
+
19
+ #ifndef BOOST_REGEX_V4_SUB_MATCH_HPP
20
+ #define BOOST_REGEX_V4_SUB_MATCH_HPP
21
+
22
+ #ifdef BOOST_MSVC
23
+ #pragma warning(push)
24
+ #pragma warning(disable: 4103)
25
+ #endif
26
+ #ifdef BOOST_HAS_ABI_HEADERS
27
+ # include BOOST_ABI_PREFIX
28
+ #endif
29
+ #ifdef BOOST_MSVC
30
+ #pragma warning(pop)
31
+ #endif
32
+
33
+ namespace boost{
34
+
35
+ template <class BidiIterator>
36
+ struct sub_match : public std::pair<BidiIterator, BidiIterator>
37
+ {
38
+ typedef typename re_detail::regex_iterator_traits<BidiIterator>::value_type value_type;
39
+ #if defined(BOOST_NO_STD_ITERATOR_TRAITS) || defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
40
+ typedef std::ptrdiff_t difference_type;
41
+ #else
42
+ typedef typename re_detail::regex_iterator_traits<BidiIterator>::difference_type difference_type;
43
+ #endif
44
+ typedef BidiIterator iterator_type;
45
+ typedef BidiIterator iterator;
46
+ typedef BidiIterator const_iterator;
47
+
48
+ bool matched;
49
+
50
+ sub_match() : std::pair<BidiIterator, BidiIterator>(), matched(false) {}
51
+ sub_match(BidiIterator i) : std::pair<BidiIterator, BidiIterator>(i, i), matched(false) {}
52
+ #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)\
53
+ && !BOOST_WORKAROUND(BOOST_MSVC, < 1310)\
54
+ && !BOOST_WORKAROUND(__BORLANDC__, <= 0x0551)\
55
+ && !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
56
+ template <class T, class A>
57
+ operator std::basic_string<value_type, T, A> ()const
58
+ {
59
+ return matched ? std::basic_string<value_type, T, A>(this->first, this->second) : std::basic_string<value_type, T, A>();
60
+ }
61
+ #else
62
+ operator std::basic_string<value_type> ()const
63
+ {
64
+ return str();
65
+ }
66
+ #endif
67
+ difference_type BOOST_REGEX_CALL length()const
68
+ {
69
+ difference_type n = matched ? ::boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second) : 0;
70
+ return n;
71
+ }
72
+ std::basic_string<value_type> str()const
73
+ {
74
+ std::basic_string<value_type> result;
75
+ if(matched)
76
+ {
77
+ std::size_t len = ::boost::re_detail::distance((BidiIterator)this->first, (BidiIterator)this->second);
78
+ result.reserve(len);
79
+ BidiIterator i = this->first;
80
+ while(i != this->second)
81
+ {
82
+ result.append(1, *i);
83
+ ++i;
84
+ }
85
+ }
86
+ return result;
87
+ }
88
+ int compare(const sub_match& s)const
89
+ {
90
+ if(matched != s.matched)
91
+ return static_cast<int>(matched) - static_cast<int>(s.matched);
92
+ return str().compare(s.str());
93
+ }
94
+ int compare(const std::basic_string<value_type>& s)const
95
+ {
96
+ return str().compare(s);
97
+ }
98
+ int compare(const value_type* p)const
99
+ {
100
+ return str().compare(p);
101
+ }
102
+
103
+ bool operator==(const sub_match& that)const
104
+ { return compare(that) == 0; }
105
+ bool BOOST_REGEX_CALL operator !=(const sub_match& that)const
106
+ { return compare(that) != 0; }
107
+ bool operator<(const sub_match& that)const
108
+ { return compare(that) < 0; }
109
+ bool operator>(const sub_match& that)const
110
+ { return compare(that) > 0; }
111
+ bool operator<=(const sub_match& that)const
112
+ { return compare(that) <= 0; }
113
+ bool operator>=(const sub_match& that)const
114
+ { return compare(that) >= 0; }
115
+
116
+ #ifdef BOOST_REGEX_MATCH_EXTRA
117
+ typedef std::vector<sub_match<BidiIterator> > capture_sequence_type;
118
+
119
+ const capture_sequence_type& captures()const
120
+ {
121
+ if(!m_captures)
122
+ m_captures.reset(new capture_sequence_type());
123
+ return *m_captures;
124
+ }
125
+ //
126
+ // Private implementation API: DO NOT USE!
127
+ //
128
+ capture_sequence_type& get_captures()const
129
+ {
130
+ if(!m_captures)
131
+ m_captures.reset(new capture_sequence_type());
132
+ return *m_captures;
133
+ }
134
+
135
+ private:
136
+ mutable boost::scoped_ptr<capture_sequence_type> m_captures;
137
+ public:
138
+
139
+ #endif
140
+ sub_match(const sub_match& that, bool
141
+ #ifdef BOOST_REGEX_MATCH_EXTRA
142
+ deep_copy
143
+ #endif
144
+ = true
145
+ )
146
+ : std::pair<BidiIterator, BidiIterator>(that),
147
+ matched(that.matched)
148
+ {
149
+ #ifdef BOOST_REGEX_MATCH_EXTRA
150
+ if(that.m_captures)
151
+ if(deep_copy)
152
+ m_captures.reset(new capture_sequence_type(*(that.m_captures)));
153
+ #endif
154
+ }
155
+ sub_match& operator=(const sub_match& that)
156
+ {
157
+ this->first = that.first;
158
+ this->second = that.second;
159
+ matched = that.matched;
160
+ #ifdef BOOST_REGEX_MATCH_EXTRA
161
+ if(that.m_captures)
162
+ get_captures() = *(that.m_captures);
163
+ #endif
164
+ return *this;
165
+ }
166
+
167
+
168
+ #ifdef BOOST_OLD_REGEX_H
169
+ //
170
+ // the following are deprecated, do not use!!
171
+ //
172
+ operator int()const;
173
+ operator unsigned int()const;
174
+ operator short()const
175
+ {
176
+ return (short)(int)(*this);
177
+ }
178
+ operator unsigned short()const
179
+ {
180
+ return (unsigned short)(unsigned int)(*this);
181
+ }
182
+ #endif
183
+ };
184
+
185
+ typedef sub_match<const char*> csub_match;
186
+ typedef sub_match<std::string::const_iterator> ssub_match;
187
+ #ifndef BOOST_NO_WREGEX
188
+ typedef sub_match<const wchar_t*> wcsub_match;
189
+ typedef sub_match<std::wstring::const_iterator> wssub_match;
190
+ #endif
191
+
192
+ // comparison to std::basic_string<> part 1:
193
+ template <class RandomAccessIterator, class traits, class Allocator>
194
+ inline bool operator == (const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
195
+ const sub_match<RandomAccessIterator>& m)
196
+ { return s.compare(m.str()) == 0; }
197
+ template <class RandomAccessIterator, class traits, class Allocator>
198
+ inline bool operator != (const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
199
+ const sub_match<RandomAccessIterator>& m)
200
+ { return s.compare(m.str()) != 0; }
201
+ template <class RandomAccessIterator, class traits, class Allocator>
202
+ inline bool operator < (const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
203
+ const sub_match<RandomAccessIterator>& m)
204
+ { return s.compare(m.str()) < 0; }
205
+ template <class RandomAccessIterator, class traits, class Allocator>
206
+ inline bool operator <= (const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
207
+ const sub_match<RandomAccessIterator>& m)
208
+ { return s.compare(m.str()) <= 0; }
209
+ template <class RandomAccessIterator, class traits, class Allocator>
210
+ inline bool operator >= (const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
211
+ const sub_match<RandomAccessIterator>& m)
212
+ { return s.compare(m.str()) >= 0; }
213
+ template <class RandomAccessIterator, class traits, class Allocator>
214
+ inline bool operator > (const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
215
+ const sub_match<RandomAccessIterator>& m)
216
+ { return s.compare(m.str()) > 0; }
217
+ // comparison to std::basic_string<> part 2:
218
+ template <class RandomAccessIterator, class traits, class Allocator>
219
+ inline bool operator == (const sub_match<RandomAccessIterator>& m,
220
+ const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s)
221
+ { return m.str().compare(s) == 0; }
222
+ template <class RandomAccessIterator, class traits, class Allocator>
223
+ inline bool operator != (const sub_match<RandomAccessIterator>& m,
224
+ const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s)
225
+ { return m.str().compare(s) != 0; }
226
+ template <class RandomAccessIterator, class traits, class Allocator>
227
+ inline bool operator < (const sub_match<RandomAccessIterator>& m,
228
+ const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s)
229
+ { return m.str().compare(s) < 0; }
230
+ template <class RandomAccessIterator, class traits, class Allocator>
231
+ inline bool operator > (const sub_match<RandomAccessIterator>& m,
232
+ const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s)
233
+ { return m.str().compare(s) > 0; }
234
+ template <class RandomAccessIterator, class traits, class Allocator>
235
+ inline bool operator <= (const sub_match<RandomAccessIterator>& m,
236
+ const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s)
237
+ { return m.str().compare(s) <= 0; }
238
+ template <class RandomAccessIterator, class traits, class Allocator>
239
+ inline bool operator >= (const sub_match<RandomAccessIterator>& m,
240
+ const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s)
241
+ { return m.str().compare(s) >= 0; }
242
+ // comparison to const charT* part 1:
243
+ template <class RandomAccessIterator>
244
+ inline bool operator == (const sub_match<RandomAccessIterator>& m,
245
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s)
246
+ { return m.str().compare(s) == 0; }
247
+ template <class RandomAccessIterator>
248
+ inline bool operator != (const sub_match<RandomAccessIterator>& m,
249
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s)
250
+ { return m.str().compare(s) != 0; }
251
+ template <class RandomAccessIterator>
252
+ inline bool operator > (const sub_match<RandomAccessIterator>& m,
253
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s)
254
+ { return m.str().compare(s) > 0; }
255
+ template <class RandomAccessIterator>
256
+ inline bool operator < (const sub_match<RandomAccessIterator>& m,
257
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s)
258
+ { return m.str().compare(s) < 0; }
259
+ template <class RandomAccessIterator>
260
+ inline bool operator >= (const sub_match<RandomAccessIterator>& m,
261
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s)
262
+ { return m.str().compare(s) >= 0; }
263
+ template <class RandomAccessIterator>
264
+ inline bool operator <= (const sub_match<RandomAccessIterator>& m,
265
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s)
266
+ { return m.str().compare(s) <= 0; }
267
+ // comparison to const charT* part 2:
268
+ template <class RandomAccessIterator>
269
+ inline bool operator == (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s,
270
+ const sub_match<RandomAccessIterator>& m)
271
+ { return m.str().compare(s) == 0; }
272
+ template <class RandomAccessIterator>
273
+ inline bool operator != (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s,
274
+ const sub_match<RandomAccessIterator>& m)
275
+ { return m.str().compare(s) != 0; }
276
+ template <class RandomAccessIterator>
277
+ inline bool operator < (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s,
278
+ const sub_match<RandomAccessIterator>& m)
279
+ { return m.str().compare(s) > 0; }
280
+ template <class RandomAccessIterator>
281
+ inline bool operator > (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s,
282
+ const sub_match<RandomAccessIterator>& m)
283
+ { return m.str().compare(s) < 0; }
284
+ template <class RandomAccessIterator>
285
+ inline bool operator <= (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s,
286
+ const sub_match<RandomAccessIterator>& m)
287
+ { return m.str().compare(s) >= 0; }
288
+ template <class RandomAccessIterator>
289
+ inline bool operator >= (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s,
290
+ const sub_match<RandomAccessIterator>& m)
291
+ { return m.str().compare(s) <= 0; }
292
+
293
+ // comparison to const charT& part 1:
294
+ template <class RandomAccessIterator>
295
+ inline bool operator == (const sub_match<RandomAccessIterator>& m,
296
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s)
297
+ { return m.str().compare(0, m.length(), &s, 1) == 0; }
298
+ template <class RandomAccessIterator>
299
+ inline bool operator != (const sub_match<RandomAccessIterator>& m,
300
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s)
301
+ { return m.str().compare(0, m.length(), &s, 1) != 0; }
302
+ template <class RandomAccessIterator>
303
+ inline bool operator > (const sub_match<RandomAccessIterator>& m,
304
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s)
305
+ { return m.str().compare(0, m.length(), &s, 1) > 0; }
306
+ template <class RandomAccessIterator>
307
+ inline bool operator < (const sub_match<RandomAccessIterator>& m,
308
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s)
309
+ { return m.str().compare(0, m.length(), &s, 1) < 0; }
310
+ template <class RandomAccessIterator>
311
+ inline bool operator >= (const sub_match<RandomAccessIterator>& m,
312
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s)
313
+ { return m.str().compare(0, m.length(), &s, 1) >= 0; }
314
+ template <class RandomAccessIterator>
315
+ inline bool operator <= (const sub_match<RandomAccessIterator>& m,
316
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s)
317
+ { return m.str().compare(0, m.length(), &s, 1) <= 0; }
318
+ // comparison to const charT* part 2:
319
+ template <class RandomAccessIterator>
320
+ inline bool operator == (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s,
321
+ const sub_match<RandomAccessIterator>& m)
322
+ { return m.str().compare(0, m.length(), &s, 1) == 0; }
323
+ template <class RandomAccessIterator>
324
+ inline bool operator != (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s,
325
+ const sub_match<RandomAccessIterator>& m)
326
+ { return m.str().compare(0, m.length(), &s, 1) != 0; }
327
+ template <class RandomAccessIterator>
328
+ inline bool operator < (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s,
329
+ const sub_match<RandomAccessIterator>& m)
330
+ { return m.str().compare(0, m.length(), &s, 1) > 0; }
331
+ template <class RandomAccessIterator>
332
+ inline bool operator > (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s,
333
+ const sub_match<RandomAccessIterator>& m)
334
+ { return m.str().compare(0, m.length(), &s, 1) < 0; }
335
+ template <class RandomAccessIterator>
336
+ inline bool operator <= (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s,
337
+ const sub_match<RandomAccessIterator>& m)
338
+ { return m.str().compare(0, m.length(), &s, 1) >= 0; }
339
+ template <class RandomAccessIterator>
340
+ inline bool operator >= (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s,
341
+ const sub_match<RandomAccessIterator>& m)
342
+ { return m.str().compare(0, m.length(), &s, 1) <= 0; }
343
+
344
+ // addition operators:
345
+ template <class RandomAccessIterator, class traits, class Allocator>
346
+ inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
347
+ operator + (const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s,
348
+ const sub_match<RandomAccessIterator>& m)
349
+ {
350
+ std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator> result;
351
+ result.reserve(s.size() + m.length() + 1);
352
+ return result.append(s).append(m.first, m.second);
353
+ }
354
+ template <class RandomAccessIterator, class traits, class Allocator>
355
+ inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>
356
+ operator + (const sub_match<RandomAccessIterator>& m,
357
+ const std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator>& s)
358
+ {
359
+ std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type, traits, Allocator> result;
360
+ result.reserve(s.size() + m.length() + 1);
361
+ return result.append(m.first, m.second).append(s);
362
+ }
363
+ #if !(defined(__GNUC__) && defined(BOOST_NO_STD_LOCALE))
364
+ template <class RandomAccessIterator>
365
+ inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
366
+ operator + (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s,
367
+ const sub_match<RandomAccessIterator>& m)
368
+ {
369
+ std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type> result;
370
+ result.reserve(std::char_traits<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>::length(s) + m.length() + 1);
371
+ return result.append(s).append(m.first, m.second);
372
+ }
373
+ template <class RandomAccessIterator>
374
+ inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
375
+ operator + (const sub_match<RandomAccessIterator>& m,
376
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const * s)
377
+ {
378
+ std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type> result;
379
+ result.reserve(std::char_traits<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>::length(s) + m.length() + 1);
380
+ return result.append(m.first, m.second).append(s);
381
+ }
382
+ #else
383
+ // worwaround versions:
384
+ template <class RandomAccessIterator>
385
+ inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
386
+ operator + (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const* s,
387
+ const sub_match<RandomAccessIterator>& m)
388
+ {
389
+ return s + m.str();
390
+ }
391
+ template <class RandomAccessIterator>
392
+ inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
393
+ operator + (const sub_match<RandomAccessIterator>& m,
394
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const * s)
395
+ {
396
+ return m.str() + s;
397
+ }
398
+ #endif
399
+ template <class RandomAccessIterator>
400
+ inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
401
+ operator + (typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s,
402
+ const sub_match<RandomAccessIterator>& m)
403
+ {
404
+ std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type> result;
405
+ result.reserve(m.length() + 2);
406
+ return result.append(1, s).append(m.first, m.second);
407
+ }
408
+ template <class RandomAccessIterator>
409
+ inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
410
+ operator + (const sub_match<RandomAccessIterator>& m,
411
+ typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type const& s)
412
+ {
413
+ std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type> result;
414
+ result.reserve(m.length() + 2);
415
+ return result.append(m.first, m.second).append(1, s);
416
+ }
417
+ template <class RandomAccessIterator>
418
+ inline std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type>
419
+ operator + (const sub_match<RandomAccessIterator>& m1,
420
+ const sub_match<RandomAccessIterator>& m2)
421
+ {
422
+ std::basic_string<typename re_detail::regex_iterator_traits<RandomAccessIterator>::value_type> result;
423
+ result.reserve(m1.length() + m2.length() + 1);
424
+ return result.append(m1.first, m1.second).append(m2.first, m2.second);
425
+ }
426
+ #ifndef BOOST_NO_STD_LOCALE
427
+ template <class charT, class traits, class RandomAccessIterator>
428
+ std::basic_ostream<charT, traits>&
429
+ operator << (std::basic_ostream<charT, traits>& os,
430
+ const sub_match<RandomAccessIterator>& s)
431
+ {
432
+ return (os << s.str());
433
+ }
434
+ #else
435
+ template <class RandomAccessIterator>
436
+ std::ostream& operator << (std::ostream& os,
437
+ const sub_match<RandomAccessIterator>& s)
438
+ {
439
+ return (os << s.str());
440
+ }
441
+ #endif
442
+
443
+ #ifdef BOOST_OLD_REGEX_H
444
+ namespace re_detail{
445
+ template <class BidiIterator, class charT>
446
+ int do_toi(BidiIterator i, BidiIterator j, char c, int radix)
447
+ {
448
+ std::string s(i, j);
449
+ char* p;
450
+ int result = std::strtol(s.c_str(), &p, radix);
451
+ if(*p)raise_regex_exception("Bad sub-expression");
452
+ return result;
453
+ }
454
+
455
+ //
456
+ // helper:
457
+ template <class I, class charT>
458
+ int do_toi(I& i, I j, charT c)
459
+ {
460
+ int result = 0;
461
+ while((i != j) && (isdigit(*i)))
462
+ {
463
+ result = result*10 + (*i - '0');
464
+ ++i;
465
+ }
466
+ return result;
467
+ }
468
+ }
469
+
470
+
471
+ template <class BidiIterator>
472
+ sub_match<BidiIterator>::operator int()const
473
+ {
474
+ BidiIterator i = first;
475
+ BidiIterator j = second;
476
+ if(i == j)raise_regex_exception("Bad sub-expression");
477
+ int neg = 1;
478
+ if((i != j) && (*i == '-'))
479
+ {
480
+ neg = -1;
481
+ ++i;
482
+ }
483
+ neg *= re_detail::do_toi(i, j, *i);
484
+ if(i != j)raise_regex_exception("Bad sub-expression");
485
+ return neg;
486
+ }
487
+ template <class BidiIterator>
488
+ sub_match<BidiIterator>::operator unsigned int()const
489
+ {
490
+ BidiIterator i = first;
491
+ BidiIterator j = second;
492
+ if(i == j)
493
+ raise_regex_exception("Bad sub-expression");
494
+ return re_detail::do_toi(i, j, *first);
495
+ }
496
+ #endif
497
+
498
+ } // namespace boost
499
+
500
+ #ifdef BOOST_MSVC
501
+ #pragma warning(push)
502
+ #pragma warning(disable: 4103)
503
+ #endif
504
+ #ifdef BOOST_HAS_ABI_HEADERS
505
+ # include BOOST_ABI_SUFFIX
506
+ #endif
507
+ #ifdef BOOST_MSVC
508
+ #pragma warning(pop)
509
+ #endif
510
+
511
+ #endif
512
+