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) && (_MSC_VER >= 1020) 13 # pragma once 14 #endif 15 16 #include <vector> 17 #include <boost/shared_ptr.hpp> 18 #include <boost/xpressive/detail/detail_fwd.hpp> 19 #include <boost/xpressive/detail/dynamic/matchable.hpp> 20 #include <boost/xpressive/match_results.hpp> // for type_info_less 21 22 namespace boost { namespace xpressive { namespace detail 23 { 24 25 /////////////////////////////////////////////////////////////////////////////// 26 // core_access 27 // 28 template<typename BidiIter> 29 struct core_access 30 { 31 typedef typename iterator_value<BidiIter>::type char_type; 32 get_hidden_mark_countboost::xpressive::detail::core_access33 static std::size_t get_hidden_mark_count(basic_regex<BidiIter> const &rex) 34 { 35 return proto::arg(rex)->hidden_mark_count_; 36 } 37 invalidboost::xpressive::detail::core_access38 static bool invalid(basic_regex<BidiIter> const &rex) 39 { 40 return rex.invalid_(); 41 } 42 matchboost::xpressive::detail::core_access43 static bool match(basic_regex<BidiIter> const &rex, match_state<BidiIter> &state) 44 { 45 return rex.match_(state); 46 } 47 48 static shared_ptr<detail::regex_impl<BidiIter> > const & get_regex_implboost::xpressive::detail::core_access49 get_regex_impl(basic_regex<BidiIter> const &rex) 50 { 51 return proto::arg(rex).get(); 52 } 53 init_sub_match_vectorboost::xpressive::detail::core_access54 static void init_sub_match_vector 55 ( 56 sub_match_vector<BidiIter> &subs_vect 57 , sub_match_impl<BidiIter> *subs_ptr 58 , std::size_t size 59 ) 60 { 61 subs_vect.init_(subs_ptr, size); 62 } 63 init_sub_match_vectorboost::xpressive::detail::core_access64 static void init_sub_match_vector 65 ( 66 sub_match_vector<BidiIter> &subs_vect 67 , sub_match_impl<BidiIter> *subs_ptr 68 , std::size_t size 69 , sub_match_vector<BidiIter> const &that 70 ) 71 { 72 subs_vect.init_(subs_ptr, size, that); 73 } 74 init_match_resultsboost::xpressive::detail::core_access75 static void init_match_results 76 ( 77 match_results<BidiIter> &what 78 , regex_id_type regex_id 79 , intrusive_ptr<traits<char_type> const> const &traits 80 , sub_match_impl<BidiIter> *sub_matches 81 , std::size_t size 82 , std::vector<named_mark<char_type> > const &named_marks 83 ) 84 { 85 what.init_(regex_id, traits, sub_matches, size, named_marks); 86 } 87 get_sub_match_vectorboost::xpressive::detail::core_access88 static sub_match_vector<BidiIter> &get_sub_match_vector(match_results<BidiIter> &what) 89 { 90 return what.sub_matches_; 91 } 92 get_sub_matchesboost::xpressive::detail::core_access93 static sub_match_impl<BidiIter> *get_sub_matches(sub_match_vector<BidiIter> &subs) 94 { 95 return subs.sub_matches_; 96 } 97 get_extrasboost::xpressive::detail::core_access98 static results_extras<BidiIter> &get_extras(match_results<BidiIter> &what) 99 { 100 return what.get_extras_(); 101 } 102 get_nested_resultsboost::xpressive::detail::core_access103 static nested_results<BidiIter> &get_nested_results(match_results<BidiIter> &what) 104 { 105 return what.nested_results_; 106 } 107 get_action_argsboost::xpressive::detail::core_access108 static action_args_type &get_action_args(match_results<BidiIter> &what) 109 { 110 return what.args_; 111 } 112 set_prefix_suffixboost::xpressive::detail::core_access113 static void set_prefix_suffix(match_results<BidiIter> &what, BidiIter begin, BidiIter end) 114 { 115 what.set_prefix_suffix_(begin, end); 116 } 117 resetboost::xpressive::detail::core_access118 static void reset(match_results<BidiIter> &what) 119 { 120 what.reset_(); 121 } 122 set_baseboost::xpressive::detail::core_access123 static void set_base(match_results<BidiIter> &what, BidiIter base) 124 { 125 what.set_base_(base); 126 } 127 }; 128 129 }}} // namespace boost::xpressive::detail 130 131 #endif 132