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 predicate.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_PREDICATE_HPP #define BOOST_STRING_PREDICATE_HPP #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
/*! \file boost/algorithm/string/predicate.hpp Defines string-related predicates. The predicates determine whether a substring is contained in the input string under various conditions: a string starts with the substring, ends with the substring, simply contains the substring or if both strings are equal. Additionaly the algorithm \c all() checks all elements of a container to satisfy a condition. All predicates provide the strong exception guarantee. */ namespace boost { namespace algorithm { // starts_with predicate -----------------------------------------------// //! 'Starts with' predicate /*! This predicate holds when the test string is a prefix of the Input. In other words, if the input starts with the test. When the optional predicate is specified, it is used for character-wise comparison. \param Input An input sequence \param Test A test sequence \param Comp An element comparison predicate \return The result of the test \note This function provides the strong exception-safety guarantee */ template
inline bool starts_with( const Range1T& Input, const Range2T& Test, PredicateT Comp) { iterator_range
::type> lit_input(as_literal(Input)); iterator_range
::type> lit_test(as_literal(Test)); typedef BOOST_STRING_TYPENAME range_const_iterator
::type Iterator1T; typedef BOOST_STRING_TYPENAME range_const_iterator
::type Iterator2T; Iterator1T InputEnd=end(lit_input); Iterator2T TestEnd=end(lit_test); Iterator1T it=begin(lit_input); Iterator2T pit=begin(lit_test); for(; it!=InputEnd && pit!=TestEnd; ++it,++pit) { if( !(Comp(*it,*pit)) ) return false; } return pit==TestEnd; } //! 'Starts with' predicate /*! \overload */ template
inline bool starts_with( const Range1T& Input, const Range2T& Test) { return starts_with(Input, Test, is_equal()); } //! 'Starts with' predicate ( case insensitive ) /*! This predicate holds when the test string is a prefix of the Input. In other words, if the input starts with the test. Elements are compared case insensitively. \param Input An input sequence \param Test A test sequence \param Loc A locale used for case insensitive comparison \return The result of the test \note This function provides the strong exception-safety guarantee */ template
inline bool istarts_with( const Range1T& Input, const Range2T& Test, const std::locale& Loc=std::locale()) { return starts_with(Input, Test, is_iequal(Loc)); } // ends_with predicate -----------------------------------------------// //! 'Ends with' predicate /*! This predicate holds when the test string is a suffix of the Input. In other words, if the input ends with the test. When the optional predicate is specified, it is used for character-wise comparison. \param Input An input sequence \param Test A test sequence \param Comp An element comparison predicate \return The result of the test \note This function provides the strong exception-safety guarantee */ template
inline bool ends_with( const Range1T& Input, const Range2T& Test, PredicateT Comp) { iterator_range
::type> lit_input(as_literal(Input)); iterator_range
::type> lit_test(as_literal(Test)); typedef BOOST_STRING_TYPENAME range_const_iterator
::type Iterator1T; typedef BOOST_STRING_TYPENAME boost::detail:: iterator_traits
::iterator_category category; return detail:: ends_with_iter_select( begin(lit_input), end(lit_input), begin(lit_test), end(lit_test), Comp, category()); } //! 'Ends with' predicate /*! \overload */ template
inline bool ends_with( const Range1T& Input, const Range2T& Test) { return ends_with(Input, Test, is_equal()); } //! 'Ends with' predicate ( case insensitive ) /*! This predicate holds when the test container is a suffix of the Input. In other words, if the input ends with the test. Elements are compared case insensitively. \param Input An input sequence \param Test A test sequence \param Loc A locale used for case insensitive comparison \return The result of the test \note This function provides the strong exception-safety guarantee */ template
inline bool iends_with( const Range1T& Input, const Range2T& Test, const std::locale& Loc=std::locale()) { return ends_with(Input, Test, is_iequal(Loc)); } // contains predicate -----------------------------------------------// //! 'Contains' predicate /*! This predicate holds when the test container is contained in the Input. When the optional predicate is specified, it is used for character-wise comparison. \param Input An input sequence \param Test A test sequence \param Comp An element comparison predicate \return The result of the test \note This function provides the strong exception-safety guarantee */ template
inline bool contains( const Range1T& Input, const Range2T& Test, PredicateT Comp) { iterator_range
::type> lit_input(as_literal(Input)); iterator_range
::type> lit_test(as_literal(Test)); if (empty(lit_test)) { // Empty range is contained always return true; } // Use the temporary variable to make VACPP happy bool bResult=(first_finder(lit_test,Comp)(begin(lit_input), end(lit_input))); return bResult; } //! 'Contains' predicate /*! \overload */ template
inline bool contains( const Range1T& Input, const Range2T& Test) { return contains(Input, Test, is_equal()); } //! 'Contains' predicate ( case insensitive ) /*! This predicate holds when the test container is contained in the Input. Elements are compared case insensitively. \param Input An input sequence \param Test A test sequence \param Loc A locale used for case insensitive comparison \return The result of the test \note This function provides the strong exception-safety guarantee */ template
inline bool icontains( const Range1T& Input, const Range2T& Test, const std::locale& Loc=std::locale()) { return contains(Input, Test, is_iequal(Loc)); } // equals predicate -----------------------------------------------// //! 'Equals' predicate /*! This predicate holds when the test container is equal to the input container i.e. all elements in both containers are same. When the optional predicate is specified, it is used for character-wise comparison. \param Input An input sequence \param Test A test sequence \param Comp An element comparison predicate \return The result of the test \note This is a two-way version of \c std::equal algorithm \note This function provides the strong exception-safety guarantee */ template
inline bool equals( const Range1T& Input, const Range2T& Test, PredicateT Comp) { iterator_range
::type> lit_input(as_literal(Input)); iterator_range
::type> lit_test(as_literal(Test)); typedef BOOST_STRING_TYPENAME range_const_iterator
::type Iterator1T; typedef BOOST_STRING_TYPENAME range_const_iterator
::type Iterator2T; Iterator1T InputEnd=end(lit_input); Iterator2T TestEnd=end(lit_test); Iterator1T it=begin(lit_input); Iterator2T pit=begin(lit_test); for(; it!=InputEnd && pit!=TestEnd; ++it,++pit) { if( !(Comp(*it,*pit)) ) return false; } return (pit==TestEnd) && (it==InputEnd); } //! 'Equals' predicate /*! \overload */ template
inline bool equals( const Range1T& Input, const Range2T& Test) { return equals(Input, Test, is_equal()); } //! 'Equals' predicate ( case insensitive ) /*! This predicate holds when the test container is equal to the input container i.e. all elements in both containers are same. Elements are compared case insensitively. \param Input An input sequence \param Test A test sequence \param Loc A locale used for case insensitive comparison \return The result of the test \note This is a two-way version of \c std::equal algorithm \note This function provides the strong exception-safety guarantee */ template
inline bool iequals( const Range1T& Input, const Range2T& Test, const std::locale& Loc=std::locale()) { return equals(Input, Test, is_iequal(Loc)); } // lexicographical_compare predicate -----------------------------// //! Lexicographical compare predicate /*! This predicate is an overload of std::lexicographical_compare for range arguments It check whether the first argument is lexicographically less then the second one. If the optional predicate is specified, it is used for character-wise comparison \param Arg1 First argument \param Arg2 Second argument \param Pred Comparison predicate \return The result of the test \note This function provides the strong exception-safety guarantee */ template
inline bool lexicographical_compare( const Range1T& Arg1, const Range2T& Arg2, PredicateT Pred) { iterator_range
::type> lit_arg1(as_literal(Arg1)); iterator_range
::type> lit_arg2(as_literal(Arg2)); return std::lexicographical_compare( begin(lit_arg1), end(lit_arg1), begin(lit_arg2), end(lit_arg2), Pred); } //! Lexicographical compare predicate /*! \overload */ template
inline bool lexicographical_compare( const Range1T& Arg1, const Range2T& Arg2) { return lexicographical_compare(Arg1, Arg2, is_less()); } //! Lexicographical compare predicate (case-insensitive) /*! This predicate is an overload of std::lexicographical_compare for range arguments. It check whether the first argument is lexicographically less then the second one. Elements are compared case insensitively \param Arg1 First argument \param Arg2 Second argument \param Loc A locale used for case insensitive comparison \return The result of the test \note This function provides the strong exception-safety guarantee */ template
inline bool ilexicographical_compare( const Range1T& Arg1, const Range2T& Arg2, const std::locale& Loc=std::locale()) { return lexicographical_compare(Arg1, Arg2, is_iless(Loc)); } // all predicate -----------------------------------------------// //! 'All' predicate /*! This predicate holds it all its elements satisfy a given condition, represented by the predicate. \param Input An input sequence \param Pred A predicate \return The result of the test \note This function provides the strong exception-safety guarantee */ template
inline bool all( const RangeT& Input, PredicateT Pred) { iterator_range
::type> lit_input(as_literal(Input)); typedef BOOST_STRING_TYPENAME range_const_iterator
::type Iterator1T; Iterator1T InputEnd=end(lit_input); for( Iterator1T It=begin(lit_input); It!=InputEnd; ++It) { if (!Pred(*It)) return false; } return true; } } // namespace algorithm // pull names to the boost namespace using algorithm::starts_with; using algorithm::istarts_with; using algorithm::ends_with; using algorithm::iends_with; using algorithm::contains; using algorithm::icontains; using algorithm::equals; using algorithm::iequals; using algorithm::all; using algorithm::lexicographical_compare; using algorithm::ilexicographical_compare; } // namespace boost #endif // BOOST_STRING_PREDICATE_HPP
predicate.hpp
Page URL
File URL
Prev
15/24
Next
Download
( 16 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.