Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:38:58

0001 //  Boost string_algo library formatter_regex.hpp header file  ---------------------------//
0002 
0003 //  Copyright Pavol Droba 2002-2003.
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 //    (See accompanying file LICENSE_1_0.txt or copy at
0007 //          http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 //  See http://www.boost.org/ for updates, documentation, and revision history.
0010 
0011 #ifndef BOOST_STRING_FORMATTER_REGEX_DETAIL_HPP
0012 #define BOOST_STRING_FORMATTER_REGEX_DETAIL_HPP
0013 
0014 #include <boost/algorithm/string/config.hpp>
0015 #include <string>
0016 #include <boost/regex.hpp>
0017 #include <boost/algorithm/string/detail/finder_regex.hpp>
0018 
0019 namespace boost {
0020     namespace algorithm {
0021         namespace detail {
0022 
0023 //  regex format functor -----------------------------------------//
0024 
0025             // regex format functor
0026             template<typename StringT>
0027             struct regex_formatF
0028             {
0029             private:
0030                 typedef StringT result_type;
0031                 typedef BOOST_STRING_TYPENAME StringT::value_type char_type;
0032 
0033             public:
0034                 // Construction
0035                 regex_formatF( const StringT& Fmt, match_flag_type Flags=format_default ) :
0036                     m_Fmt(Fmt), m_Flags( Flags ) {}
0037 
0038                 template<typename InputIteratorT>
0039                 result_type operator()( 
0040                     const regex_search_result<InputIteratorT>& Replace ) const
0041                 {
0042                     if ( Replace.empty() )
0043                     {
0044                         return result_type();
0045                     }
0046                     else
0047                     {
0048                         return Replace.match_results().format( m_Fmt, m_Flags );                      
0049                     }
0050                 }
0051             private:
0052                 const StringT& m_Fmt;
0053                 match_flag_type m_Flags;
0054             };
0055 
0056         
0057         } // namespace detail
0058     } // namespace algorithm
0059 } // namespace boost
0060 
0061 #endif  // BOOST_STRING_FORMATTER_DETAIL_HPP