Index: E:/gsoc-boost/sandbox/stringalgos/boost/algorithm/string/trim.hpp =================================================================== --- E:/gsoc-boost/sandbox/stringalgos/boost/algorithm/string/trim.hpp (revision 62167) +++ E:/gsoc-boost/sandbox/stringalgos/boost/algorithm/string/trim.hpp (working copy) @@ -13,6 +13,8 @@ #include +#include + #include #include #include @@ -91,17 +93,37 @@ ::boost::end(Input)); } - //! Left trim - parametric + // ! Left trim /*! - Remove all leading spaces from the input. - The result is a trimmed copy of the input. + Remove all leading spaces from the input. + The result is a trimmed copy of the input. It is returned as a sequence or copied to + the output iterator. - \param Input An input sequence - \param Loc a locale used for 'space' classification - \return A trimmed copy of the input + \param Output An output iterator to which the result will be copied + \param Input An input range + \param Loc A locale used for 'space' classification + \return + An output iterator pointing just after the last inserted character or + a copy of the input - \note This function provides the strong exception-safety guarantee + \note The second version of this function provides strong exception-safety guarantee */ + template + inline OutputIteratorT trim_left_copy( + OutputIteratorT Output, + const RangeT &Input, + const std::locale &Loc=std::locale()) + { + return ::boost::algorithm::trim_left_copy_if( + Output, + Input, + is_space(Loc)); + } + + //! Left trim - parametric + /*! + \overload + */ template inline SequenceT trim_left_copy(const SequenceT& Input, const std::locale& Loc=std::locale()) { @@ -203,14 +225,33 @@ //! Right trim /*! Remove all trailing spaces from the input. - The result is a trimmed copy of the input + The result is a trimmed copy of the input. It is returned as a sequence or copied to + the output iterator. - \param Input An input sequence + \param Output An output iterator to which the result will be copied + \param Input An input range \param Loc A locale used for 'space' classification - \return A trimmed copy of the input + \return + An output iterator pointing just after the last inserted character or + a copy of the input - \note This function provides the strong exception-safety guarantee + \note The second version of this function provides strong exception-safety guarantee */ + template + inline OutputIteratorT trim_right_copy(OutputIteratorT Output, const RangeT &Input, const std::locale &Loc=std::locale()) + { + return + ::boost::algorithm::trim_right_copy_if( + Output, + Input, + is_space(Loc)); + } + + //! Right trim + /*! + \overload + */ + template inline SequenceT trim_right_copy(const SequenceT& Input, const std::locale& Loc=std::locale()) { @@ -328,14 +369,29 @@ //! Trim /*! Remove all leading and trailing spaces from the input. - The result is a trimmed copy of the input - - \param Input An input sequence + The result is a trimmed copy of the input. It is returned as a sequence + or copied to the output iterator + + \param Output An output iterator to which the result will be copied + \param Input An input range \param Loc A locale used for 'space' classification - \return A trimmed copy of the input + \return + An output iterator pointing just after the last inserted character or + a copy of the input - \note This function provides the strong exception-safety guarantee + \note The second variant of this function provides the strong exception-safety guarantee */ + template + inline OutputIteratorT trim_copy( OutputIteratorT Output, const RangeT &Input, const std::locale &Loc=std::locale() ) + { + return + ::boost::algorithm::trim_copy_if(Output, Input, is_space(Loc)); + } + + //! Trim + /*! + \overload + */ template inline SequenceT trim_copy( const SequenceT& Input, const std::locale& Loc=std::locale() ) {