regex_merge.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. *
  3. * Copyright (c) 1998-2002
  4. * John Maddock
  5. *
  6. * Use, modification and distribution are subject to the
  7. * Boost Software License, Version 1.0. (See accompanying file
  8. * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. *
  10. */
  11. /*
  12. * LOCATION: see http://www.boost.org for most recent version.
  13. * FILE regex_format.hpp
  14. * VERSION see <boost/version.hpp>
  15. * DESCRIPTION: Provides formatting output routines for search and replace
  16. * operations. Note this is an internal header file included
  17. * by regex.hpp, do not include on its own.
  18. */
  19. #ifndef BOOST_REGEX_V4_REGEX_MERGE_HPP
  20. #define BOOST_REGEX_V4_REGEX_MERGE_HPP
  21. namespace boost{
  22. #ifdef BOOST_MSVC
  23. #pragma warning(push)
  24. #pragma warning(disable: 4103)
  25. #endif
  26. #ifdef BOOST_HAS_ABI_HEADERS
  27. # include BOOST_ABI_PREFIX
  28. #endif
  29. #ifdef BOOST_MSVC
  30. #pragma warning(pop)
  31. #endif
  32. template <class OutputIterator, class Iterator, class traits, class charT>
  33. inline OutputIterator regex_merge(OutputIterator out,
  34. Iterator first,
  35. Iterator last,
  36. const basic_regex<charT, traits>& e,
  37. const charT* fmt,
  38. match_flag_type flags = match_default)
  39. {
  40. return regex_replace(out, first, last, e, fmt, flags);
  41. }
  42. template <class OutputIterator, class Iterator, class traits, class charT>
  43. inline OutputIterator regex_merge(OutputIterator out,
  44. Iterator first,
  45. Iterator last,
  46. const basic_regex<charT, traits>& e,
  47. const std::basic_string<charT>& fmt,
  48. match_flag_type flags = match_default)
  49. {
  50. return regex_merge(out, first, last, e, fmt.c_str(), flags);
  51. }
  52. template <class traits, class charT>
  53. inline std::basic_string<charT> regex_merge(const std::basic_string<charT>& s,
  54. const basic_regex<charT, traits>& e,
  55. const charT* fmt,
  56. match_flag_type flags = match_default)
  57. {
  58. return regex_replace(s, e, fmt, flags);
  59. }
  60. template <class traits, class charT>
  61. inline std::basic_string<charT> regex_merge(const std::basic_string<charT>& s,
  62. const basic_regex<charT, traits>& e,
  63. const std::basic_string<charT>& fmt,
  64. match_flag_type flags = match_default)
  65. {
  66. return regex_replace(s, e, fmt, flags);
  67. }
  68. #ifdef BOOST_MSVC
  69. #pragma warning(push)
  70. #pragma warning(disable: 4103)
  71. #endif
  72. #ifdef BOOST_HAS_ABI_HEADERS
  73. # include BOOST_ABI_SUFFIX
  74. #endif
  75. #ifdef BOOST_MSVC
  76. #pragma warning(pop)
  77. #endif
  78. } // namespace boost
  79. #endif // BOOST_REGEX_V4_REGEX_MERGE_HPP