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

          Line data    Source code
       1             : //  Boost string_algo library formatter.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_FORMATTER_DETAIL_HPP
      12             : #define BOOST_STRING_FORMATTER_DETAIL_HPP
      13             : 
      14             : 
      15             : #include <boost/range/iterator_range_core.hpp>
      16             : #include <boost/range/begin.hpp>
      17             : #include <boost/range/end.hpp>
      18             : #include <boost/range/const_iterator.hpp>
      19             : 
      20             : #include <boost/algorithm/string/detail/util.hpp>
      21             : 
      22             : //  generic replace functors -----------------------------------------------//
      23             : 
      24             : namespace boost {
      25             :     namespace algorithm {
      26             :         namespace detail {
      27             : 
      28             : //  const format functor ----------------------------------------------------//
      29             : 
      30             :             // constant format functor
      31             :             template<typename RangeT>
      32             :             struct const_formatF
      33             :             {
      34             :             private:
      35             :                 typedef BOOST_STRING_TYPENAME
      36             :                     range_const_iterator<RangeT>::type format_iterator;
      37             :                 typedef iterator_range<format_iterator> result_type;
      38             :             
      39             :             public:
      40             :                 // Construction
      41         562 :                 const_formatF(const RangeT& Format) :
      42         562 :                     m_Format(::boost::begin(Format), ::boost::end(Format)) {}
      43             : 
      44             :                 // Operation
      45             : #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
      46             :                 template<typename Range2T>
      47             :                 result_type& operator()(const Range2T&)
      48             :                 {
      49             :                     return m_Format;
      50             :                 }
      51             : #endif
      52             : 
      53             :                 template<typename Range2T>
      54           0 :                 const result_type& operator()(const Range2T&) const
      55             :                 {
      56             :                     return m_Format;
      57             :                 }
      58             : 
      59             :             private:
      60             :                 result_type m_Format;
      61             :             };
      62             : 
      63             : //  identity format functor ----------------------------------------------------//
      64             : 
      65             :             // identity format functor
      66             :             template<typename RangeT>
      67             :             struct identity_formatF
      68             :             {
      69             :                 // Operation
      70             :                 template< typename Range2T >
      71             :                 const RangeT& operator()(const Range2T& Replace) const
      72             :                 {
      73             :                     return RangeT(::boost::begin(Replace), ::boost::end(Replace));
      74             :                 }
      75             :             };
      76             : 
      77             : //  empty format functor ( used by erase ) ------------------------------------//
      78             :         
      79             :             // empty format functor
      80             :             template< typename CharT >
      81             :             struct empty_formatF
      82             :             {
      83             :                 template< typename ReplaceT >
      84             :                 empty_container<CharT> operator()(const ReplaceT&) const
      85             :                 {
      86             :                     return empty_container<CharT>();
      87             :                 }
      88             :             };
      89             : 
      90             : //  dissect format functor ----------------------------------------------------//
      91             : 
      92             :             // dissect format functor
      93             :             template<typename FinderT>
      94             :             struct dissect_formatF
      95             :             {
      96             :             public:
      97             :                 // Construction
      98             :                 dissect_formatF(FinderT Finder) :
      99             :                   m_Finder(Finder) {}
     100             : 
     101             :                   // Operation
     102             :                   template<typename RangeT>
     103             :                   inline iterator_range< 
     104             :                       BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
     105             :                   operator()(const RangeT& Replace) const
     106             :                   {
     107             :                       return m_Finder(::boost::begin(Replace), ::boost::end(Replace));
     108             :                   }
     109             : 
     110             :             private:
     111             :                 FinderT m_Finder;
     112             :             };
     113             : 
     114             : 
     115             :         } // namespace detail
     116             :     } // namespace algorithm
     117             : } // namespace boost
     118             : 
     119             : #endif  // BOOST_STRING_FORMATTER_DETAIL_HPP

Generated by: LCOV version 1.14