DriveHQ Start Menu
Cloud Drive Mapping
Folder Sync
Cloud Backup
True Drop Box
FTP/SFTP Hosting
Group Account
DriveHQ Start Menu
Online File Server
My Storage
|
Manage Shares
|
Publishes
|
Drop Boxes
|
Group Account
WebDAV Drive Mapping
Cloud Drive Home
|
WebDAV Guide
|
Drive Mapping Tool
|
Drive Mapping URL
Complete Data Backup
Backup Guide
|
Online Backup Tool
|
Cloud-to-Cloud Backup
FTP, Email & Web Service
FTP Home
|
FTP Hosting FAQ
|
Email Hosting
|
EmailManager
|
Web Hosting
Help & Resources
About
|
Enterprise Service
|
Partnership
|
Comparisons
|
Support
Quick Links
Security and Privacy
Download Software
Service Manual
Use Cases
Group Account
Online Help
Blog
Contact
Cloud Surveillance
Sign Up
Login
Features
Business Features
Online File Server
FTP Hosting
Cloud Drive Mapping
Cloud File Backup
Email Backup & Hosting
Cloud File Sharing
Folder Synchronization
Group Management
True Drop Box
Full-text Search
AD Integration/SSO
Mobile Access
IP Camera & DVR Solution
More...
Personal Features
Personal Cloud Drive
Backup All Devices
Mobile APPs
Personal Web Hosting
Sub-Account (for Kids)
Home/PC/Kids Monitoring
More...
Software
DriveHQ Drive Mapping Tool
DriveHQ FileManager
DriveHQ Online Backup
DriveHQ Mobile Apps
Pricing
Business Plans & Pricing
Personal Plans & Pricing
Price Comparison with Others
Feature Comparison with Others
Install Mobile App
Sign up
Creating account...
Invalid character in username! Only 0-9, a-z, A-Z, _, -, . allowed.
Username is required!
Invalid email address!
E-mail is required!
Password is required!
Password is invalid!
Password and confirmation do not match.
Confirm password is required!
I accept
Membership Agreement
Please read the Membership Agreement and check "I accept"!
Free Quick Sign-up
Sign-up Page
Log in
Signing in...
Username or e-mail address is required!
Password is required!
Keep me logged in
Quick Login
Forgot Password
Up
Upload
Download
Share
Publish
New Folder
New File
Copy
Cut
Delete
Paste
Rate
Upgrade
Rotate
Effect
Edit
Slide
History
// Boost string_algo library trim.hpp header file ---------------------------// // Copyright Pavol Droba 2002-2003. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org/ for updates, documentation, and revision history. #ifndef BOOST_STRING_TRIM_HPP #define BOOST_STRING_TRIM_HPP #include
#include
#include
#include
#include
#include
#include
#include
#include
/*! \file Defines trim algorithms. Trim algorithms are used to remove trailing and leading spaces from a sequence (string). Space is recognized using given locales. Parametric (\c _if) variants use a predicate (functor) to select which characters are to be trimmed.. Functions take a selection predicate as a parameter, which is used to determine whether a character is a space. Common predicates are provided in classification.hpp header. */ namespace boost { namespace algorithm { // left trim -----------------------------------------------// //! Left trim - parametric /*! Remove all leading spaces from the input. The supplied predicate is used to determine which characters are considered spaces. 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 IsSpace An unary predicate identifying spaces \return An output iterator pointing just after the last inserted character or a copy of the input \note The second variant of this function provides the strong exception-safety guarantee */ template
inline OutputIteratorT trim_left_copy_if( OutputIteratorT Output, const RangeT& Input, PredicateT IsSpace) { iterator_range
::type> lit_range(as_literal(Input)); std::copy( ::boost::algorithm::detail::trim_begin( begin(lit_range), end(lit_range), IsSpace ), end(lit_range), Output); return Output; } //! Left trim - parametric /*! \overload */ template
inline SequenceT trim_left_copy_if(const SequenceT& Input, PredicateT IsSpace) { return SequenceT( ::boost::algorithm::detail::trim_begin( begin(Input), end(Input), IsSpace ), end(Input)); } //! Left trim - parametric /*! Remove all leading spaces from the input. The result is a trimmed copy of the input. \param Input An input sequence \param Loc a locale used for 'space' classification \return A trimmed copy of the input \note This function provides the strong exception-safety guarantee */ template
inline SequenceT trim_left_copy(const SequenceT& Input, const std::locale& Loc=std::locale()) { return trim_left_copy_if( Input, is_space(Loc)); } //! Left trim /*! Remove all leading spaces from the input. The supplied predicate is used to determine which characters are considered spaces. The input sequence is modified in-place. \param Input An input sequence \param IsSpace An unary predicate identifying spaces */ template
inline void trim_left_if(SequenceT& Input, PredicateT IsSpace) { Input.erase( begin(Input), ::boost::algorithm::detail::trim_begin( begin(Input), end(Input), IsSpace)); } //! Left trim /*! Remove all leading spaces from the input. The Input sequence is modified in-place. \param Input An input sequence \param Loc A locale used for 'space' classification */ template
inline void trim_left(SequenceT& Input, const std::locale& Loc=std::locale()) { trim_left_if( Input, is_space(Loc)); } // right trim -----------------------------------------------// //! Right trim - parametric /*! Remove all trailing spaces from the input. The supplied predicate is used to determine which characters are considered spaces. 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 IsSpace An unary predicate identifying spaces \return An output iterator pointing just after the last inserted character or a copy of the input \note The second variant of this function provides the strong exception-safety guarantee */ template
inline OutputIteratorT trim_right_copy_if( OutputIteratorT Output, const RangeT& Input, PredicateT IsSpace ) { iterator_range
::type> lit_range(as_literal(Input)); std::copy( begin(lit_range), ::boost::algorithm::detail::trim_end( begin(lit_range), end(lit_range), IsSpace ), Output ); return Output; } //! Right trim - parametric /*! \overload */ template
inline SequenceT trim_right_copy_if(const SequenceT& Input, PredicateT IsSpace) { return SequenceT( begin(Input), ::boost::algorithm::detail::trim_end( begin(Input), end(Input), IsSpace) ); } //! Right trim /*! Remove all trailing spaces from the input. The result is a trimmed copy of the input \param Input An input sequence \param Loc A locale used for 'space' classification \return A trimmed copy of the input \note This function provides the strong exception-safety guarantee */ template
inline SequenceT trim_right_copy(const SequenceT& Input, const std::locale& Loc=std::locale()) { return trim_right_copy_if( Input, is_space(Loc)); } //! Right trim - parametric /*! Remove all trailing spaces from the input. The supplied predicate is used to determine which characters are considered spaces. The input sequence is modified in-place. \param Input An input sequence \param IsSpace An unary predicate identifying spaces */ template
inline void trim_right_if(SequenceT& Input, PredicateT IsSpace) { Input.erase( ::boost::algorithm::detail::trim_end( begin(Input), end(Input), IsSpace ), end(Input) ); } //! Right trim /*! Remove all trailing spaces from the input. The input sequence is modified in-place. \param Input An input sequence \param Loc A locale used for 'space' classification */ template
inline void trim_right(SequenceT& Input, const std::locale& Loc=std::locale()) { trim_right_if( Input, is_space(Loc) ); } // both side trim -----------------------------------------------// //! Trim - parametric /*! Remove all trailing and leading spaces from the input. The supplied predicate is used to determine which characters are considered spaces. 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 IsSpace An unary predicate identifying spaces \return An output iterator pointing just after the last inserted character or a copy of the input \note The second variant of this function provides the strong exception-safety guarantee */ template
inline OutputIteratorT trim_copy_if( OutputIteratorT Output, const RangeT& Input, PredicateT IsSpace) { iterator_range
::type> lit_range(as_literal(Input)); BOOST_STRING_TYPENAME range_const_iterator
::type TrimEnd= ::boost::algorithm::detail::trim_end( begin(lit_range), end(lit_range), IsSpace); std::copy( detail::trim_begin( begin(lit_range), TrimEnd, IsSpace), TrimEnd, Output ); return Output; } //! Trim - parametric /*! \overload */ template
inline SequenceT trim_copy_if(const SequenceT& Input, PredicateT IsSpace) { BOOST_STRING_TYPENAME range_const_iterator
::type TrimEnd= ::boost::algorithm::detail::trim_end( begin(Input), end(Input), IsSpace); return SequenceT( detail::trim_begin( begin(Input), TrimEnd, IsSpace), TrimEnd ); } //! Trim /*! Remove all leading and trailing spaces from the input. The result is a trimmed copy of the input \param Input An input sequence \param Loc A locale used for 'space' classification \return A trimmed copy of the input \note This function provides the strong exception-safety guarantee */ template
inline SequenceT trim_copy( const SequenceT& Input, const std::locale& Loc=std::locale() ) { return trim_copy_if( Input, is_space(Loc) ); } //! Trim /*! Remove all leading and trailing spaces from the input. The supplied predicate is used to determine which characters are considered spaces. The input sequence is modified in-place. \param Input An input sequence \param IsSpace An unary predicate identifying spaces */ template
inline void trim_if(SequenceT& Input, PredicateT IsSpace) { trim_right_if( Input, IsSpace ); trim_left_if( Input, IsSpace ); } //! Trim /*! Remove all leading and trailing spaces from the input. The input sequence is modified in-place. \param Input An input sequence \param Loc A locale used for 'space' classification */ template
inline void trim(SequenceT& Input, const std::locale& Loc=std::locale()) { trim_if( Input, is_space( Loc ) ); } } // namespace algorithm // pull names to the boost namespace using algorithm::trim_left; using algorithm::trim_left_if; using algorithm::trim_left_copy; using algorithm::trim_left_copy_if; using algorithm::trim_right; using algorithm::trim_right_if; using algorithm::trim_right_copy; using algorithm::trim_right_copy_if; using algorithm::trim; using algorithm::trim_if; using algorithm::trim_copy; using algorithm::trim_copy_if; } // namespace boost #endif // BOOST_STRING_TRIM_HPP
trim.hpp
Page URL
File URL
Prev
23/24
Next
Download
( 13 KB )
Note: The DriveHQ service banners will NOT be displayed if the file owner is a paid member.
Comments
Total ratings:
0
Average rating:
Not Rated
Would you like to comment?
Join DriveHQ
for a free account, or
Logon
if you are already a member.