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