1 /////////////////////////////////////////////////////////////////////////////// 2 // access.hpp 3 // 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) 7 8 #ifndef BOOST_XPRESSIVE_DETAIL_CORE_ACCESS_HPP_EAN_10_04_2005 9 #define BOOST_XPRESSIVE_DETAIL_CORE_ACCESS_HPP_EAN_10_04_2005 10 11 // MS compatible compilers support #pragma once 12 #if defined(_MSC_VER) 13 # pragma once 14 #endif 15 16 #include <vector> 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 22 23 namespace boost { namespace xpressive { namespace detail 24 { 25 26 /////////////////////////////////////////////////////////////////////////////// 27 // core_access 28 // 29 template<typename BidiIter> 30 struct core_access 31 { 32 typedef typename iterator_value<BidiIter>::type char_type; 33 get_hidden_mark_countboost::xpressive::detail::core_access34 static std::size_t get_hidden_mark_count(basic_regex<BidiIter> const &rex) 35 { 36 return proto::value(rex)->hidden_mark_count_; 37 } 38 matchboost::xpressive::detail::core_access39 static bool match(basic_regex<BidiIter> const &rex, match_state<BidiIter> &state) 40 { 41 return rex.match_(state); 42 } 43 44 static shared_ptr<detail::regex_impl<BidiIter> > const & get_regex_implboost::xpressive::detail::core_access45 get_regex_impl(basic_regex<BidiIter> const &rex) 46 { 47 return proto::value(rex).get(); 48 } 49 init_sub_match_vectorboost::xpressive::detail::core_access50 static void init_sub_match_vector 51 ( 52 sub_match_vector<BidiIter> &subs_vect 53 , sub_match_impl<BidiIter> *subs_ptr 54 , std::size_t size 55 ) 56 { 57 subs_vect.init_(subs_ptr, size); 58 } 59 init_sub_match_vectorboost::xpressive::detail::core_access60 static void init_sub_match_vector 61 ( 62 sub_match_vector<BidiIter> &subs_vect 63 , sub_match_impl<BidiIter> *subs_ptr 64 , std::size_t size 65 , sub_match_vector<BidiIter> const &that 66 ) 67 { 68 subs_vect.init_(subs_ptr, size, that); 69 } 70 init_match_resultsboost::xpressive::detail::core_access71 static void init_match_results 72 ( 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 77 , std::size_t size 78 , std::vector<named_mark<char_type> > const &named_marks 79 ) 80 { 81 what.init_(regex_id, tr, sub_matches, size, named_marks); 82 } 83 get_sub_match_vectorboost::xpressive::detail::core_access84 static sub_match_vector<BidiIter> &get_sub_match_vector(match_results<BidiIter> &what) 85 { 86 return what.sub_matches_; 87 } 88 get_sub_matchesboost::xpressive::detail::core_access89 static sub_match_impl<BidiIter> *get_sub_matches(sub_match_vector<BidiIter> &subs) 90 { 91 return subs.sub_matches_; 92 } 93 get_extrasboost::xpressive::detail::core_access94 static results_extras<BidiIter> &get_extras(match_results<BidiIter> &what) 95 { 96 return what.get_extras_(); 97 } 98 get_nested_resultsboost::xpressive::detail::core_access99 static nested_results<BidiIter> &get_nested_results(match_results<BidiIter> &what) 100 { 101 return what.nested_results_; 102 } 103 get_action_argsboost::xpressive::detail::core_access104 static action_args_type &get_action_args(match_results<BidiIter> &what) 105 { 106 return what.args_; 107 } 108 set_prefix_suffixboost::xpressive::detail::core_access109 static void set_prefix_suffix(match_results<BidiIter> &what, BidiIter begin, BidiIter end) 110 { 111 what.set_prefix_suffix_(begin, end); 112 } 113 resetboost::xpressive::detail::core_access114 static void reset(match_results<BidiIter> &what) 115 { 116 what.reset_(); 117 } 118 set_baseboost::xpressive::detail::core_access119 static void set_base(match_results<BidiIter> &what, BidiIter base) 120 { 121 what.set_base_(base); 122 } 123 get_baseboost::xpressive::detail::core_access124 static BidiIter get_base(match_results<BidiIter> &what) 125 { 126 return *what.base_; 127 } 128 }; 129 130 }}} // namespace boost::xpressive::detail 131 132 #endif 133