2003-05-17 11:45:48 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Copyright (c) 1998-2002
|
|
|
|
* Dr John Maddock
|
|
|
|
*
|
2003-09-30 13:02:51 +00:00
|
|
|
* Use, modification and distribution is subject to the
|
|
|
|
* Boost Software License, Version 1.0. (See accompanying file
|
|
|
|
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
2003-05-17 11:45:48 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* LOCATION: see http://www.boost.org for most recent version.
|
|
|
|
* FILE regex_format.hpp
|
|
|
|
* VERSION see <boost/version.hpp>
|
|
|
|
* DESCRIPTION: Provides formatting output routines for search and replace
|
|
|
|
* operations. Note this is an internal header file included
|
|
|
|
* by regex.hpp, do not include on its own.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BOOST_REGEX_V4_REGEX_REPLACE_HPP
|
|
|
|
#define BOOST_REGEX_V4_REGEX_REPLACE_HPP
|
|
|
|
|
|
|
|
|
|
|
|
namespace boost{
|
|
|
|
|
2003-08-14 10:22:05 +00:00
|
|
|
#ifdef BOOST_HAS_ABI_HEADERS
|
2003-08-12 11:23:02 +00:00
|
|
|
# include BOOST_ABI_PREFIX
|
2003-05-17 11:45:48 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
|
|
|
|
OutputIterator regex_replace(OutputIterator out,
|
|
|
|
Iterator first,
|
|
|
|
Iterator last,
|
|
|
|
const reg_expression<charT, traits, Allocator>& e,
|
|
|
|
const charT* fmt,
|
|
|
|
match_flag_type flags = match_default)
|
|
|
|
{
|
|
|
|
Iterator l = first;
|
|
|
|
re_detail::merge_out_predicate<OutputIterator, Iterator, charT, Allocator, traits> oi(out, l, fmt, flags, e.get_traits());
|
|
|
|
regex_grep(oi, first, last, e, flags);
|
|
|
|
return (flags & format_no_copy) ? out : re_detail::re_copy_out(out, l, last);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class OutputIterator, class Iterator, class traits, class Allocator, class charT>
|
|
|
|
inline OutputIterator regex_replace(OutputIterator out,
|
|
|
|
Iterator first,
|
|
|
|
Iterator last,
|
|
|
|
const reg_expression<charT, traits, Allocator>& e,
|
|
|
|
const std::basic_string<charT>& fmt,
|
|
|
|
match_flag_type flags = match_default)
|
|
|
|
{
|
|
|
|
return regex_replace(out, first, last, e, fmt.c_str(), flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class traits, class Allocator, class charT>
|
|
|
|
std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
|
|
|
|
const reg_expression<charT, traits, Allocator>& e,
|
|
|
|
const charT* fmt,
|
|
|
|
match_flag_type flags = match_default)
|
|
|
|
{
|
|
|
|
std::basic_string<charT> result;
|
|
|
|
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
|
|
|
regex_replace(i, s.begin(), s.end(), e, fmt, flags);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <class traits, class Allocator, class charT>
|
|
|
|
std::basic_string<charT> regex_replace(const std::basic_string<charT>& s,
|
|
|
|
const reg_expression<charT, traits, Allocator>& e,
|
|
|
|
const std::basic_string<charT>& fmt,
|
|
|
|
match_flag_type flags = match_default)
|
|
|
|
{
|
|
|
|
std::basic_string<charT> result;
|
|
|
|
re_detail::string_out_iterator<std::basic_string<charT> > i(result);
|
|
|
|
regex_replace(i, s.begin(), s.end(), e, fmt.c_str(), flags);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2003-08-14 10:22:05 +00:00
|
|
|
#ifdef BOOST_HAS_ABI_HEADERS
|
2003-08-12 11:23:02 +00:00
|
|
|
# include BOOST_ABI_SUFFIX
|
2003-05-17 11:45:48 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
} // namespace boost
|
|
|
|
|
|
|
|
#endif // BOOST_REGEX_V4_REGEX_REPLACE_HPP
|
|
|
|
|
2003-09-30 13:02:51 +00:00
|
|
|
|