1// Boost string_algo library regex_find_format.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_REGEX_FIND_FORMAT_HPP
12#define BOOST_STRING_REGEX_FIND_FORMAT_HPP
13
14#include <boost/algorithm/string/config.hpp>
15#include <boost/regex.hpp>
16#include <boost/algorithm/string/detail/finder_regex.hpp>
17#include <boost/algorithm/string/detail/formatter_regex.hpp>
18
19/*! \file
20 Defines the \c regex_finder and \c regex_formatter generators. These two functors
21 are designed to work together. \c regex_formatter uses additional information
22 about a match contained in the regex_finder search result.
23*/
24
25namespace boost {
26 namespace algorithm {
27
28// regex_finder -----------------------------------------------//
29
30 //! "Regex" finder
31 /*!
32 Construct the \c regex_finder. Finder uses the regex engine to search
33 for a match.
34 Result is given in \c regex_search_result. This is an extension
35 of the iterator_range. In addition it contains match results
36 from the \c regex_search algorithm.
37
38 \param Rx A regular expression
39 \param MatchFlags Regex search options
40 \return An instance of the \c regex_finder object
41 */
42 template<
43 typename CharT,
44 typename RegexTraitsT>
45 inline detail::find_regexF< basic_regex<CharT, RegexTraitsT> >
46 regex_finder(
47 const basic_regex<CharT, RegexTraitsT>& Rx,
48 match_flag_type MatchFlags=match_default )
49 {
50 return detail::
51 find_regexF<
52 basic_regex<CharT, RegexTraitsT> >( Rx, MatchFlags );
53 }
54
55// regex_formater ---------------------------------------------//
56
57 //! Regex formatter
58 /*!
59 Construct the \c regex_formatter. Regex formatter uses the regex engine to
60 format a match found by the \c regex_finder.
61 This formatted it designed to closely cooperate with \c regex_finder.
62
63 \param Format Regex format definition
64 \param Flags Format flags
65 \return An instance of the \c regex_formatter functor
66 */
67 template<
68 typename CharT,
69 typename TraitsT, typename AllocT >
70 inline detail::regex_formatF< std::basic_string< CharT, TraitsT, AllocT > >
71 regex_formatter(
72 const std::basic_string<CharT, TraitsT, AllocT>& Format,
73 match_flag_type Flags=format_default )
74 {
75 return
76 detail::regex_formatF< std::basic_string<CharT, TraitsT, AllocT> >(
77 Format,
78 Flags );
79 }
80
81 } // namespace algorithm
82
83 // pull the names to the boost namespace
84 using algorithm::regex_finder;
85 using algorithm::regex_formatter;
86
87} // namespace boost
88
89
90#endif // BOOST_STRING_REGEX_FIND_FORMAT_HPP
91