LCOV - code coverage report
Current view: top level - usr/include/boost/algorithm/string/detail - finder_regex.hpp (source / functions) Hit Total Coverage
Test: ROSE Lines: 0 12 0.0 %
Date: 2022-12-08 13:48:47 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //  Boost string_algo library find_regex.hpp header file  ---------------------------//
       2             : 
       3             : //  Copyright Pavol Droba 2002-2003.
       4             : //
       5             : // Distributed under the Boost Software License, Version 1.0.
       6             : //    (See accompanying file LICENSE_1_0.txt or copy at
       7             : //          http://www.boost.org/LICENSE_1_0.txt)
       8             : 
       9             : //  See http://www.boost.org/ for updates, documentation, and revision history.
      10             : 
      11             : #ifndef BOOST_STRING_FINDER_REGEX_DETAIL_HPP
      12             : #define BOOST_STRING_FINDER_REGEX_DETAIL_HPP
      13             : 
      14             : #include <boost/algorithm/string/config.hpp>
      15             : #include <boost/regex.hpp>
      16             : 
      17             : #include <boost/range/iterator_range_core.hpp>
      18             : #include <boost/range/begin.hpp>
      19             : #include <boost/range/end.hpp>
      20             : 
      21             : namespace boost {
      22             :     namespace algorithm {
      23             :         namespace detail {
      24             : 
      25             : //  regex find functor -----------------------------------------------//
      26             : 
      27             :             // regex search result
      28             :             template<typename IteratorT>
      29           0 :             struct regex_search_result : 
      30             :                 public iterator_range<IteratorT>
      31             :             {
      32             :                 typedef regex_search_result<IteratorT> type;
      33             :                 typedef iterator_range<IteratorT> base_type;
      34             :                 typedef BOOST_STRING_TYPENAME base_type::value_type value_type;
      35             :                 typedef BOOST_STRING_TYPENAME base_type::difference_type difference_type;
      36             :                 typedef BOOST_STRING_TYPENAME base_type::const_iterator const_iterator;
      37             :                 typedef BOOST_STRING_TYPENAME base_type::iterator iterator;
      38             :                 typedef boost::match_results<iterator> match_results_type;
      39             : 
      40             :                 // Construction
      41             : 
      42             :                 // Construction from the match result
      43           0 :                 regex_search_result( const match_results_type& MatchResults ) :
      44           0 :                     base_type( MatchResults[0].first, MatchResults[0].second ),
      45           0 :                     m_MatchResults( MatchResults ) {}
      46             :                 
      47             :                 // Construction of empty match. End iterator has to be specified
      48           0 :                 regex_search_result( IteratorT End ) :
      49           0 :                     base_type( End, End ) {}
      50             : 
      51             :                 regex_search_result( const regex_search_result& Other ) :
      52             :                     base_type( Other.begin(), Other.end() ),
      53             :                     m_MatchResults( Other.m_MatchResults ) {}
      54             : 
      55             :                 // Assignment
      56             :                 regex_search_result& operator=( const regex_search_result& Other )
      57             :                 {
      58             :                     base_type::operator=( Other );
      59             :                     m_MatchResults=Other.m_MatchResults;
      60             :                     return *this;
      61             :                 }
      62             : 
      63             :                 // Match result retrieval
      64             :                 const match_results_type& match_results() const
      65             :                 {
      66             :                     return m_MatchResults;
      67             :                 }
      68             : 
      69             :             private:
      70             :                 // Saved match result
      71             :                 match_results_type m_MatchResults;
      72             :             };
      73             : 
      74             :             // find_regex
      75             :             /*
      76             :                 Regex based search functor
      77             :             */
      78             :             template<typename RegExT>
      79             :             struct find_regexF
      80             :             {
      81             :                 typedef RegExT regex_type;
      82             :                 typedef const RegExT& regex_reference_type;
      83             :                     
      84             :                 // Construction
      85           0 :                 find_regexF( regex_reference_type Rx, match_flag_type MatchFlags = match_default ) : 
      86             :                     m_Rx(Rx), m_MatchFlags(MatchFlags) {}   
      87             : 
      88             :                 // Operation
      89             :                 template< typename ForwardIteratorT >
      90             :                 regex_search_result<ForwardIteratorT>
      91           0 :                 operator()( 
      92             :                     ForwardIteratorT Begin, 
      93             :                     ForwardIteratorT End ) const
      94             :                 {
      95             :                     typedef ForwardIteratorT input_iterator_type;
      96             :                     typedef regex_search_result<ForwardIteratorT> result_type;
      97             : 
      98             :                     // instantiate match result
      99           0 :                     match_results<input_iterator_type> result;
     100             :                     // search for a match
     101           0 :                     if ( ::boost::regex_search( Begin, End, result, m_Rx, m_MatchFlags ) )
     102             :                     {
     103             :                         // construct a result
     104           0 :                         return result_type( result );
     105             :                     }
     106             :                     else
     107             :                     {
     108             :                         // empty result
     109           0 :                         return result_type( End );
     110             :                     }
     111             :                 }
     112             : 
     113             :             private:
     114             :                 regex_reference_type m_Rx; // Regexp
     115             :                 match_flag_type m_MatchFlags;     // match flags
     116             :             };
     117             : 
     118             :         } // namespace detail
     119             :     } // namespace algorithm
     120             : } // namespace boost
     121             : 
     122             : #endif  // BOOST_STRING_FIND_DETAIL_HPP

Generated by: LCOV version 1.14