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,73 @@
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_fwd.cpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Forward declares boost::basic_regex<> and
17
+ * associated typedefs.
18
+ */
19
+
20
+ #ifndef BOOST_REGEX_FWD_HPP_INCLUDED
21
+ #define BOOST_REGEX_FWD_HPP_INCLUDED
22
+
23
+ #ifndef BOOST_REGEX_CONFIG_HPP
24
+ #include <boost/regex/config.hpp>
25
+ #endif
26
+
27
+ //
28
+ // define BOOST_REGEX_NO_FWD if this
29
+ // header doesn't work!
30
+ //
31
+ #ifdef BOOST_REGEX_NO_FWD
32
+ # ifndef BOOST_RE_REGEX_HPP
33
+ # include <boost/regex.hpp>
34
+ # endif
35
+ #else
36
+
37
+ namespace boost{
38
+
39
+ template <class charT>
40
+ class cpp_regex_traits;
41
+ template <class charT>
42
+ struct c_regex_traits;
43
+ template <class charT>
44
+ class w32_regex_traits;
45
+
46
+ #ifdef BOOST_REGEX_USE_WIN32_LOCALE
47
+ template <class charT, class implementationT = w32_regex_traits<charT> >
48
+ struct regex_traits;
49
+ #elif defined(BOOST_REGEX_USE_CPP_LOCALE)
50
+ template <class charT, class implementationT = cpp_regex_traits<charT> >
51
+ struct regex_traits;
52
+ #else
53
+ template <class charT, class implementationT = c_regex_traits<charT> >
54
+ struct regex_traits;
55
+ #endif
56
+
57
+ template <class charT, class traits = regex_traits<charT> >
58
+ class basic_regex;
59
+
60
+ typedef basic_regex<char, regex_traits<char> > regex;
61
+ #ifndef BOOST_NO_WREGEX
62
+ typedef basic_regex<wchar_t, regex_traits<wchar_t> > wregex;
63
+ #endif
64
+
65
+ } // namespace boost
66
+
67
+ #endif // BOOST_REGEX_NO_FWD
68
+
69
+ #endif
70
+
71
+
72
+
73
+
@@ -0,0 +1,155 @@
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_grep.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Provides regex_grep implementation.
17
+ */
18
+
19
+ #ifndef BOOST_REGEX_V4_REGEX_GREP_HPP
20
+ #define BOOST_REGEX_V4_REGEX_GREP_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
+ //
37
+ // regex_grep:
38
+ // find all non-overlapping matches within the sequence first last:
39
+ //
40
+ template <class Predicate, class BidiIterator, class charT, class traits>
41
+ inline unsigned int regex_grep(Predicate foo,
42
+ BidiIterator first,
43
+ BidiIterator last,
44
+ const basic_regex<charT, traits>& e,
45
+ match_flag_type flags = match_default)
46
+ {
47
+ if(e.flags() & regex_constants::failbit)
48
+ return false;
49
+
50
+ typedef typename match_results<BidiIterator>::allocator_type match_allocator_type;
51
+
52
+ match_results<BidiIterator> m;
53
+ re_detail::perl_matcher<BidiIterator, match_allocator_type, traits> matcher(first, last, m, e, flags, first);
54
+ unsigned int count = 0;
55
+ while(matcher.find())
56
+ {
57
+ ++count;
58
+ if(0 == foo(m))
59
+ return count; // caller doesn't want to go on
60
+ if(m[0].second == last)
61
+ return count; // we've reached the end, don't try and find an extra null match.
62
+ if(m.length() == 0)
63
+ {
64
+ if(m[0].second == last)
65
+ return count;
66
+ // we found a NULL-match, now try to find
67
+ // a non-NULL one at the same position:
68
+ match_results<BidiIterator, match_allocator_type> m2(m);
69
+ matcher.setf(match_not_null | match_continuous);
70
+ if(matcher.find())
71
+ {
72
+ ++count;
73
+ if(0 == foo(m))
74
+ return count;
75
+ }
76
+ else
77
+ {
78
+ // reset match back to where it was:
79
+ m = m2;
80
+ }
81
+ matcher.unsetf((match_not_null | match_continuous) & ~flags);
82
+ }
83
+ }
84
+ return count;
85
+ }
86
+
87
+ //
88
+ // regex_grep convenience interfaces:
89
+ #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
90
+ //
91
+ // this isn't really a partial specialisation, but template function
92
+ // overloading - if the compiler doesn't support partial specialisation
93
+ // then it really won't support this either:
94
+ template <class Predicate, class charT, class traits>
95
+ inline unsigned int regex_grep(Predicate foo, const charT* str,
96
+ const basic_regex<charT, traits>& e,
97
+ match_flag_type flags = match_default)
98
+ {
99
+ return regex_grep(foo, str, str + traits::length(str), e, flags);
100
+ }
101
+
102
+ template <class Predicate, class ST, class SA, class charT, class traits>
103
+ inline unsigned int regex_grep(Predicate foo, const std::basic_string<charT, ST, SA>& s,
104
+ const basic_regex<charT, traits>& e,
105
+ match_flag_type flags = match_default)
106
+ {
107
+ return regex_grep(foo, s.begin(), s.end(), e, flags);
108
+ }
109
+ #else // partial specialisation
110
+ inline unsigned int regex_grep(bool (*foo)(const cmatch&), const char* str,
111
+ const regex& e,
112
+ match_flag_type flags = match_default)
113
+ {
114
+ return regex_grep(foo, str, str + regex::traits_type::length(str), e, flags);
115
+ }
116
+ #ifndef BOOST_NO_WREGEX
117
+ inline unsigned int regex_grep(bool (*foo)(const wcmatch&), const wchar_t* str,
118
+ const wregex& e,
119
+ match_flag_type flags = match_default)
120
+ {
121
+ return regex_grep(foo, str, str + wregex::traits_type::length(str), e, flags);
122
+ }
123
+ #endif
124
+ inline unsigned int regex_grep(bool (*foo)(const match_results<std::string::const_iterator>&), const std::string& s,
125
+ const regex& e,
126
+ match_flag_type flags = match_default)
127
+ {
128
+ return regex_grep(foo, s.begin(), s.end(), e, flags);
129
+ }
130
+ #if !defined(BOOST_NO_WREGEX)
131
+ inline unsigned int regex_grep(bool (*foo)(const match_results<std::basic_string<wchar_t>::const_iterator>&),
132
+ const std::basic_string<wchar_t>& s,
133
+ const wregex& e,
134
+ match_flag_type flags = match_default)
135
+ {
136
+ return regex_grep(foo, s.begin(), s.end(), e, flags);
137
+ }
138
+ #endif
139
+ #endif
140
+
141
+ #ifdef BOOST_MSVC
142
+ #pragma warning(push)
143
+ #pragma warning(disable: 4103)
144
+ #endif
145
+ #ifdef BOOST_HAS_ABI_HEADERS
146
+ # include BOOST_ABI_SUFFIX
147
+ #endif
148
+ #ifdef BOOST_MSVC
149
+ #pragma warning(pop)
150
+ #endif
151
+
152
+ } // namespace boost
153
+
154
+ #endif // BOOST_REGEX_V4_REGEX_GREP_HPP
155
+
@@ -0,0 +1,201 @@
1
+ /*
2
+ *
3
+ * Copyright (c) 2003
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_iterator.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Provides regex_iterator implementation.
17
+ */
18
+
19
+ #ifndef BOOST_REGEX_V4_REGEX_ITERATOR_HPP
20
+ #define BOOST_REGEX_V4_REGEX_ITERATOR_HPP
21
+
22
+ #include <boost/shared_ptr.hpp>
23
+
24
+ namespace boost{
25
+
26
+ #ifdef BOOST_MSVC
27
+ #pragma warning(push)
28
+ #pragma warning(disable: 4103)
29
+ #endif
30
+ #ifdef BOOST_HAS_ABI_HEADERS
31
+ # include BOOST_ABI_PREFIX
32
+ #endif
33
+ #ifdef BOOST_MSVC
34
+ #pragma warning(pop)
35
+ #endif
36
+
37
+ template <class BidirectionalIterator,
38
+ class charT,
39
+ class traits>
40
+ class regex_iterator_implementation
41
+ {
42
+ typedef basic_regex<charT, traits> regex_type;
43
+
44
+ match_results<BidirectionalIterator> what; // current match
45
+ BidirectionalIterator base; // start of sequence
46
+ BidirectionalIterator end; // end of sequence
47
+ const regex_type re; // the expression
48
+ match_flag_type flags; // flags for matching
49
+
50
+ public:
51
+ regex_iterator_implementation(const regex_type* p, BidirectionalIterator last, match_flag_type f)
52
+ : base(), end(last), re(*p), flags(f){}
53
+ bool init(BidirectionalIterator first)
54
+ {
55
+ base = first;
56
+ return regex_search(first, end, what, re, flags);
57
+ }
58
+ bool compare(const regex_iterator_implementation& that)
59
+ {
60
+ if(this == &that) return true;
61
+ return (&re.get_data() == &that.re.get_data()) && (end == that.end) && (flags == that.flags) && (what[0].first == that.what[0].first) && (what[0].second == that.what[0].second);
62
+ }
63
+ const match_results<BidirectionalIterator>& get()
64
+ { return what; }
65
+ bool next()
66
+ {
67
+ //if(what.prefix().first != what[0].second)
68
+ // flags |= match_prev_avail;
69
+ BidirectionalIterator next_start = what[0].second;
70
+ match_flag_type f(flags);
71
+ if(!what.length() || (f & regex_constants::match_posix))
72
+ f |= regex_constants::match_not_initial_null;
73
+ //if(base != next_start)
74
+ // f |= regex_constants::match_not_bob;
75
+ bool result = regex_search(next_start, end, what, re, f, base);
76
+ if(result)
77
+ what.set_base(base);
78
+ return result;
79
+ }
80
+ private:
81
+ regex_iterator_implementation& operator=(const regex_iterator_implementation&);
82
+ };
83
+
84
+ template <class BidirectionalIterator,
85
+ class charT = BOOST_DEDUCED_TYPENAME re_detail::regex_iterator_traits<BidirectionalIterator>::value_type,
86
+ class traits = regex_traits<charT> >
87
+ class regex_iterator
88
+ #ifndef BOOST_NO_STD_ITERATOR
89
+ : public std::iterator<
90
+ std::forward_iterator_tag,
91
+ match_results<BidirectionalIterator>,
92
+ typename re_detail::regex_iterator_traits<BidirectionalIterator>::difference_type,
93
+ const match_results<BidirectionalIterator>*,
94
+ const match_results<BidirectionalIterator>& >
95
+ #endif
96
+ {
97
+ private:
98
+ typedef regex_iterator_implementation<BidirectionalIterator, charT, traits> impl;
99
+ typedef shared_ptr<impl> pimpl;
100
+ public:
101
+ typedef basic_regex<charT, traits> regex_type;
102
+ typedef match_results<BidirectionalIterator> value_type;
103
+ typedef typename re_detail::regex_iterator_traits<BidirectionalIterator>::difference_type
104
+ difference_type;
105
+ typedef const value_type* pointer;
106
+ typedef const value_type& reference;
107
+ typedef std::forward_iterator_tag iterator_category;
108
+
109
+ regex_iterator(){}
110
+ regex_iterator(BidirectionalIterator a, BidirectionalIterator b,
111
+ const regex_type& re,
112
+ match_flag_type m = match_default)
113
+ : pdata(new impl(&re, b, m))
114
+ {
115
+ if(!pdata->init(a))
116
+ {
117
+ pdata.reset();
118
+ }
119
+ }
120
+ regex_iterator(const regex_iterator& that)
121
+ : pdata(that.pdata) {}
122
+ regex_iterator& operator=(const regex_iterator& that)
123
+ {
124
+ pdata = that.pdata;
125
+ return *this;
126
+ }
127
+ bool operator==(const regex_iterator& that)const
128
+ {
129
+ if((pdata.get() == 0) || (that.pdata.get() == 0))
130
+ return pdata.get() == that.pdata.get();
131
+ return pdata->compare(*(that.pdata.get()));
132
+ }
133
+ bool operator!=(const regex_iterator& that)const
134
+ { return !(*this == that); }
135
+ const value_type& operator*()const
136
+ { return pdata->get(); }
137
+ const value_type* operator->()const
138
+ { return &(pdata->get()); }
139
+ regex_iterator& operator++()
140
+ {
141
+ cow();
142
+ if(0 == pdata->next())
143
+ {
144
+ pdata.reset();
145
+ }
146
+ return *this;
147
+ }
148
+ regex_iterator operator++(int)
149
+ {
150
+ regex_iterator result(*this);
151
+ ++(*this);
152
+ return result;
153
+ }
154
+ private:
155
+
156
+ pimpl pdata;
157
+
158
+ void cow()
159
+ {
160
+ // copy-on-write
161
+ if(pdata.get() && !pdata.unique())
162
+ {
163
+ pdata.reset(new impl(*(pdata.get())));
164
+ }
165
+ }
166
+ };
167
+
168
+ typedef regex_iterator<const char*> cregex_iterator;
169
+ typedef regex_iterator<std::string::const_iterator> sregex_iterator;
170
+ #ifndef BOOST_NO_WREGEX
171
+ typedef regex_iterator<const wchar_t*> wcregex_iterator;
172
+ typedef regex_iterator<std::wstring::const_iterator> wsregex_iterator;
173
+ #endif
174
+
175
+ // make_regex_iterator:
176
+ template <class charT, class traits>
177
+ inline regex_iterator<const charT*, charT, traits> make_regex_iterator(const charT* p, const basic_regex<charT, traits>& e, regex_constants::match_flag_type m = regex_constants::match_default)
178
+ {
179
+ return regex_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, m);
180
+ }
181
+ template <class charT, class traits, class ST, class SA>
182
+ inline regex_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, regex_constants::match_flag_type m = regex_constants::match_default)
183
+ {
184
+ return regex_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, m);
185
+ }
186
+
187
+ #ifdef BOOST_MSVC
188
+ #pragma warning(push)
189
+ #pragma warning(disable: 4103)
190
+ #endif
191
+ #ifdef BOOST_HAS_ABI_HEADERS
192
+ # include BOOST_ABI_SUFFIX
193
+ #endif
194
+ #ifdef BOOST_MSVC
195
+ #pragma warning(pop)
196
+ #endif
197
+
198
+ } // namespace boost
199
+
200
+ #endif // BOOST_REGEX_V4_REGEX_ITERATOR_HPP
201
+
@@ -0,0 +1,382 @@
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_match.hpp
15
+ * VERSION see <boost/version.hpp>
16
+ * DESCRIPTION: Regular expression matching algorithms.
17
+ * Note this is an internal header file included
18
+ * by regex.hpp, do not include on its own.
19
+ */
20
+
21
+
22
+ #ifndef BOOST_REGEX_MATCH_HPP
23
+ #define BOOST_REGEX_MATCH_HPP
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
+ //
39
+ // proc regex_match
40
+ // returns true if the specified regular expression matches
41
+ // the whole of the input. Fills in what matched in m.
42
+ //
43
+ template <class BidiIterator, class Allocator, class charT, class traits>
44
+ bool regex_match(BidiIterator first, BidiIterator last,
45
+ match_results<BidiIterator, Allocator>& m,
46
+ const basic_regex<charT, traits>& e,
47
+ match_flag_type flags = match_default)
48
+ {
49
+ re_detail::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, first);
50
+ return matcher.match();
51
+ }
52
+ template <class iterator, class charT, class traits>
53
+ bool regex_match(iterator first, iterator last,
54
+ const basic_regex<charT, traits>& e,
55
+ match_flag_type flags = match_default)
56
+ {
57
+ match_results<iterator> m;
58
+ return regex_match(first, last, m, e, flags | regex_constants::match_any);
59
+ }
60
+ //
61
+ // query_match convenience interfaces:
62
+ #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
63
+ //
64
+ // this isn't really a partial specialisation, but template function
65
+ // overloading - if the compiler doesn't support partial specialisation
66
+ // then it really won't support this either:
67
+ template <class charT, class Allocator, class traits>
68
+ inline bool regex_match(const charT* str,
69
+ match_results<const charT*, Allocator>& m,
70
+ const basic_regex<charT, traits>& e,
71
+ match_flag_type flags = match_default)
72
+ {
73
+ return regex_match(str, str + traits::length(str), m, e, flags);
74
+ }
75
+
76
+ template <class ST, class SA, class Allocator, class charT, class traits>
77
+ inline bool regex_match(const std::basic_string<charT, ST, SA>& s,
78
+ match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
79
+ const basic_regex<charT, traits>& e,
80
+ match_flag_type flags = match_default)
81
+ {
82
+ return regex_match(s.begin(), s.end(), m, e, flags);
83
+ }
84
+ template <class charT, class traits>
85
+ inline bool regex_match(const charT* str,
86
+ const basic_regex<charT, traits>& e,
87
+ match_flag_type flags = match_default)
88
+ {
89
+ match_results<const charT*> m;
90
+ return regex_match(str, str + traits::length(str), m, e, flags | regex_constants::match_any);
91
+ }
92
+
93
+ template <class ST, class SA, class charT, class traits>
94
+ inline bool regex_match(const std::basic_string<charT, ST, SA>& s,
95
+ const basic_regex<charT, traits>& e,
96
+ match_flag_type flags = match_default)
97
+ {
98
+ typedef typename std::basic_string<charT, ST, SA>::const_iterator iterator;
99
+ match_results<iterator> m;
100
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
101
+ }
102
+ #else // partial ordering
103
+ inline bool regex_match(const char* str,
104
+ cmatch& m,
105
+ const regex& e,
106
+ match_flag_type flags = match_default)
107
+ {
108
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
109
+ }
110
+ inline bool regex_match(const char* str,
111
+ const regex& e,
112
+ match_flag_type flags = match_default)
113
+ {
114
+ match_results<const char*> m;
115
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
116
+ }
117
+ #ifndef BOOST_NO_STD_LOCALE
118
+ inline bool regex_match(const char* str,
119
+ cmatch& m,
120
+ const basic_regex<char, cpp_regex_traits<char> >& e,
121
+ match_flag_type flags = match_default)
122
+ {
123
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
124
+ }
125
+ inline bool regex_match(const char* str,
126
+ const basic_regex<char, cpp_regex_traits<char> >& e,
127
+ match_flag_type flags = match_default)
128
+ {
129
+ match_results<const char*> m;
130
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
131
+ }
132
+ #endif
133
+ inline bool regex_match(const char* str,
134
+ cmatch& m,
135
+ const basic_regex<char, c_regex_traits<char> >& e,
136
+ match_flag_type flags = match_default)
137
+ {
138
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
139
+ }
140
+ inline bool regex_match(const char* str,
141
+ const basic_regex<char, c_regex_traits<char> >& e,
142
+ match_flag_type flags = match_default)
143
+ {
144
+ match_results<const char*> m;
145
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
146
+ }
147
+ #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
148
+ inline bool regex_match(const char* str,
149
+ cmatch& m,
150
+ const basic_regex<char, w32_regex_traits<char> >& e,
151
+ match_flag_type flags = match_default)
152
+ {
153
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags);
154
+ }
155
+ inline bool regex_match(const char* str,
156
+ const basic_regex<char, w32_regex_traits<char> >& e,
157
+ match_flag_type flags = match_default)
158
+ {
159
+ match_results<const char*> m;
160
+ return regex_match(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
161
+ }
162
+ #endif
163
+ #ifndef BOOST_NO_WREGEX
164
+ inline bool regex_match(const wchar_t* str,
165
+ wcmatch& m,
166
+ const wregex& e,
167
+ match_flag_type flags = match_default)
168
+ {
169
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
170
+ }
171
+ inline bool regex_match(const wchar_t* str,
172
+ const wregex& e,
173
+ match_flag_type flags = match_default)
174
+ {
175
+ match_results<const wchar_t*> m;
176
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
177
+ }
178
+ #ifndef BOOST_NO_STD_LOCALE
179
+ inline bool regex_match(const wchar_t* str,
180
+ wcmatch& m,
181
+ const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e,
182
+ match_flag_type flags = match_default)
183
+ {
184
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
185
+ }
186
+ inline bool regex_match(const wchar_t* str,
187
+ const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e,
188
+ match_flag_type flags = match_default)
189
+ {
190
+ match_results<const wchar_t*> m;
191
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
192
+ }
193
+ #endif
194
+ inline bool regex_match(const wchar_t* str,
195
+ wcmatch& m,
196
+ const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e,
197
+ match_flag_type flags = match_default)
198
+ {
199
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
200
+ }
201
+ inline bool regex_match(const wchar_t* str,
202
+ const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e,
203
+ match_flag_type flags = match_default)
204
+ {
205
+ match_results<const wchar_t*> m;
206
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
207
+ }
208
+ #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
209
+ inline bool regex_match(const wchar_t* str,
210
+ wcmatch& m,
211
+ const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e,
212
+ match_flag_type flags = match_default)
213
+ {
214
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags);
215
+ }
216
+ inline bool regex_match(const wchar_t* str,
217
+ const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e,
218
+ match_flag_type flags = match_default)
219
+ {
220
+ match_results<const wchar_t*> m;
221
+ return regex_match(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
222
+ }
223
+ #endif
224
+ #endif
225
+ inline bool regex_match(const std::string& s,
226
+ smatch& m,
227
+ const regex& e,
228
+ match_flag_type flags = match_default)
229
+ {
230
+ return regex_match(s.begin(), s.end(), m, e, flags);
231
+ }
232
+ inline bool regex_match(const std::string& s,
233
+ const regex& e,
234
+ match_flag_type flags = match_default)
235
+ {
236
+ match_results<std::string::const_iterator> m;
237
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
238
+ }
239
+ #ifndef BOOST_NO_STD_LOCALE
240
+ inline bool regex_match(const std::string& s,
241
+ smatch& m,
242
+ const basic_regex<char, cpp_regex_traits<char> >& e,
243
+ match_flag_type flags = match_default)
244
+ {
245
+ return regex_match(s.begin(), s.end(), m, e, flags);
246
+ }
247
+ inline bool regex_match(const std::string& s,
248
+ const basic_regex<char, cpp_regex_traits<char> >& e,
249
+ match_flag_type flags = match_default)
250
+ {
251
+ match_results<std::string::const_iterator> m;
252
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
253
+ }
254
+ #endif
255
+ inline bool regex_match(const std::string& s,
256
+ smatch& m,
257
+ const basic_regex<char, c_regex_traits<char> >& e,
258
+ match_flag_type flags = match_default)
259
+ {
260
+ return regex_match(s.begin(), s.end(), m, e, flags);
261
+ }
262
+ inline bool regex_match(const std::string& s,
263
+ const basic_regex<char, c_regex_traits<char> >& e,
264
+ match_flag_type flags = match_default)
265
+ {
266
+ match_results<std::string::const_iterator> m;
267
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
268
+ }
269
+ #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
270
+ inline bool regex_match(const std::string& s,
271
+ smatch& m,
272
+ const basic_regex<char, w32_regex_traits<char> >& e,
273
+ match_flag_type flags = match_default)
274
+ {
275
+ return regex_match(s.begin(), s.end(), m, e, flags);
276
+ }
277
+ inline bool regex_match(const std::string& s,
278
+ const basic_regex<char, w32_regex_traits<char> >& e,
279
+ match_flag_type flags = match_default)
280
+ {
281
+ match_results<std::string::const_iterator> m;
282
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
283
+ }
284
+ #endif
285
+ #if !defined(BOOST_NO_WREGEX)
286
+ inline bool regex_match(const std::basic_string<wchar_t>& s,
287
+ match_results<std::basic_string<wchar_t>::const_iterator>& m,
288
+ const wregex& e,
289
+ match_flag_type flags = match_default)
290
+ {
291
+ return regex_match(s.begin(), s.end(), m, e, flags);
292
+ }
293
+ inline bool regex_match(const std::basic_string<wchar_t>& s,
294
+ const wregex& e,
295
+ match_flag_type flags = match_default)
296
+ {
297
+ match_results<std::basic_string<wchar_t>::const_iterator> m;
298
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
299
+ }
300
+ #ifndef BOOST_NO_STD_LOCALE
301
+ inline bool regex_match(const std::basic_string<wchar_t>& s,
302
+ match_results<std::basic_string<wchar_t>::const_iterator>& m,
303
+ const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e,
304
+ match_flag_type flags = match_default)
305
+ {
306
+ return regex_match(s.begin(), s.end(), m, e, flags);
307
+ }
308
+ inline bool regex_match(const std::basic_string<wchar_t>& s,
309
+ const basic_regex<wchar_t, cpp_regex_traits<wchar_t> >& e,
310
+ match_flag_type flags = match_default)
311
+ {
312
+ match_results<std::basic_string<wchar_t>::const_iterator> m;
313
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
314
+ }
315
+ #endif
316
+ inline bool regex_match(const std::basic_string<wchar_t>& s,
317
+ match_results<std::basic_string<wchar_t>::const_iterator>& m,
318
+ const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e,
319
+ match_flag_type flags = match_default)
320
+ {
321
+ return regex_match(s.begin(), s.end(), m, e, flags);
322
+ }
323
+ inline bool regex_match(const std::basic_string<wchar_t>& s,
324
+ const basic_regex<wchar_t, c_regex_traits<wchar_t> >& e,
325
+ match_flag_type flags = match_default)
326
+ {
327
+ match_results<std::basic_string<wchar_t>::const_iterator> m;
328
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
329
+ }
330
+ #if defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)
331
+ inline bool regex_match(const std::basic_string<wchar_t>& s,
332
+ match_results<std::basic_string<wchar_t>::const_iterator>& m,
333
+ const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e,
334
+ match_flag_type flags = match_default)
335
+ {
336
+ return regex_match(s.begin(), s.end(), m, e, flags);
337
+ }
338
+ inline bool regex_match(const std::basic_string<wchar_t>& s,
339
+ const basic_regex<wchar_t, w32_regex_traits<wchar_t> >& e,
340
+ match_flag_type flags = match_default)
341
+ {
342
+ match_results<std::basic_string<wchar_t>::const_iterator> m;
343
+ return regex_match(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
344
+ }
345
+ #endif
346
+ #endif
347
+
348
+ #endif
349
+
350
+
351
+ #ifdef BOOST_MSVC
352
+ #pragma warning(push)
353
+ #pragma warning(disable: 4103)
354
+ #endif
355
+ #ifdef BOOST_HAS_ABI_HEADERS
356
+ # include BOOST_ABI_SUFFIX
357
+ #endif
358
+ #ifdef BOOST_MSVC
359
+ #pragma warning(pop)
360
+ #endif
361
+
362
+ } // namespace boost
363
+
364
+ #endif // BOOST_REGEX_MATCH_HPP
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+