1 ///////////////////////////////////////////////////////////////////////////////
4 // Copyright 2008 Eric Niebler. Distributed under the Boost
5 // Software License, Version 1.0. (See accompanying file
6 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 #ifndef BOOST_XPRESSIVE_DETAIL_CORE_ACCESS_HPP_EAN_10_04_2005
9 #define BOOST_XPRESSIVE_DETAIL_CORE_ACCESS_HPP_EAN_10_04_2005
11 // MS compatible compilers support #pragma once
17 #include <boost/shared_ptr.hpp>
18 #include <boost/proto/traits.hpp>
19 #include <boost/xpressive/detail/detail_fwd.hpp>
20 #include <boost/xpressive/detail/dynamic/matchable.hpp>
21 #include <boost/xpressive/match_results.hpp> // for type_info_less
23 namespace boost { namespace xpressive { namespace detail
26 ///////////////////////////////////////////////////////////////////////////////
29 template<typename BidiIter>
32 typedef typename iterator_value<BidiIter>::type char_type;
34 static std::size_t get_hidden_mark_count(basic_regex<BidiIter> const &rex)
36 return proto::value(rex)->hidden_mark_count_;
39 static bool match(basic_regex<BidiIter> const &rex, match_state<BidiIter> &state)
41 return rex.match_(state);
44 static shared_ptr<detail::regex_impl<BidiIter> > const &
45 get_regex_impl(basic_regex<BidiIter> const &rex)
47 return proto::value(rex).get();
50 static void init_sub_match_vector
52 sub_match_vector<BidiIter> &subs_vect
53 , sub_match_impl<BidiIter> *subs_ptr
57 subs_vect.init_(subs_ptr, size);
60 static void init_sub_match_vector
62 sub_match_vector<BidiIter> &subs_vect
63 , sub_match_impl<BidiIter> *subs_ptr
65 , sub_match_vector<BidiIter> const &that
68 subs_vect.init_(subs_ptr, size, that);
71 static void init_match_results
73 match_results<BidiIter> &what
74 , regex_id_type regex_id
75 , intrusive_ptr<traits<char_type> const> const &tr
76 , sub_match_impl<BidiIter> *sub_matches
78 , std::vector<named_mark<char_type> > const &named_marks
81 what.init_(regex_id, tr, sub_matches, size, named_marks);
84 static sub_match_vector<BidiIter> &get_sub_match_vector(match_results<BidiIter> &what)
86 return what.sub_matches_;
89 static sub_match_impl<BidiIter> *get_sub_matches(sub_match_vector<BidiIter> &subs)
91 return subs.sub_matches_;
94 static results_extras<BidiIter> &get_extras(match_results<BidiIter> &what)
96 return what.get_extras_();
99 static nested_results<BidiIter> &get_nested_results(match_results<BidiIter> &what)
101 return what.nested_results_;
104 static action_args_type &get_action_args(match_results<BidiIter> &what)
109 static void set_prefix_suffix(match_results<BidiIter> &what, BidiIter begin, BidiIter end)
111 what.set_prefix_suffix_(begin, end);
114 static void reset(match_results<BidiIter> &what)
119 static void set_base(match_results<BidiIter> &what, BidiIter base)
121 what.set_base_(base);
124 static BidiIter get_base(match_results<BidiIter> &what)
130 }}} // namespace boost::xpressive::detail