123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- #ifndef BOOST_STRING_TRIM_ALL_HPP
- #define BOOST_STRING_TRIM_ALL_HPP
- #include <boost/algorithm/string/config.hpp>
- #include <boost/algorithm/string/trim.hpp>
- #include <boost/algorithm/string/classification.hpp>
- #include <boost/algorithm/string/find_format.hpp>
- #include <boost/algorithm/string/formatter.hpp>
- #include <boost/algorithm/string/finder.hpp>
- #include <locale>
- namespace boost {
- namespace algorithm {
-
-
-
- template<typename SequenceT, typename PredicateT>
- inline SequenceT trim_all_copy_if(const SequenceT& Input, PredicateT IsSpace)
- {
- return
- ::boost::find_format_all_copy(
- ::boost::trim_copy_if(Input, IsSpace),
- ::boost::token_finder(IsSpace, ::boost::token_compress_on),
- ::boost::dissect_formatter(::boost::head_finder(1)));
- }
-
-
- template<typename SequenceT, typename PredicateT>
- inline void trim_all_if(SequenceT& Input, PredicateT IsSpace)
- {
- ::boost::trim_if(Input, IsSpace);
- ::boost::find_format_all(
- Input,
- ::boost::token_finder(IsSpace, ::boost::token_compress_on),
- ::boost::dissect_formatter(::boost::head_finder(1)));
- }
-
-
- template<typename SequenceT>
- inline SequenceT trim_all_copy(const SequenceT& Input, const std::locale& Loc =std::locale())
- {
- return trim_all_copy_if(Input, ::boost::is_space(Loc));
- }
-
-
- template<typename SequenceT>
- inline void trim_all(SequenceT& Input, const std::locale& Loc =std::locale())
- {
- trim_all_if(Input, ::boost::is_space(Loc));
- }
-
-
- template<typename SequenceT, typename RangeT, typename PredicateT>
- inline SequenceT trim_fill_copy_if(const SequenceT& Input, const RangeT& Fill, PredicateT IsSpace)
- {
- return
- ::boost::find_format_all_copy(
- ::boost::trim_copy_if(Input, IsSpace),
- ::boost::token_finder(IsSpace, ::boost::token_compress_on),
- ::boost::const_formatter(::boost::as_literal(Fill)));
- }
-
-
- template<typename SequenceT, typename RangeT, typename PredicateT>
- inline void trim_fill_if(SequenceT& Input, const RangeT& Fill, PredicateT IsSpace)
- {
- ::boost::trim_if(Input, IsSpace);
- ::boost::find_format_all(
- Input,
- ::boost::token_finder(IsSpace, ::boost::token_compress_on),
- ::boost::const_formatter(::boost::as_literal(Fill)));
- }
-
-
- template<typename SequenceT, typename RangeT>
- inline SequenceT trim_fill_copy(const SequenceT& Input, const RangeT& Fill, const std::locale& Loc =std::locale())
- {
- return trim_fill_copy_if(Input, Fill, ::boost::is_space(Loc));
- }
-
-
- template<typename SequenceT, typename RangeT>
- inline void trim_fill(SequenceT& Input, const RangeT& Fill, const std::locale& Loc =std::locale())
- {
- trim_fill_if(Input, Fill, ::boost::is_space(Loc));
- }
- }
-
- using algorithm::trim_all;
- using algorithm::trim_all_if;
- using algorithm::trim_all_copy;
- using algorithm::trim_all_copy_if;
- using algorithm::trim_fill;
- using algorithm::trim_fill_if;
- using algorithm::trim_fill_copy;
- using algorithm::trim_fill_copy_if;
- }
- #endif
|