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 find_iterator.hpp header file ---------------------------// // Copyright Pavol Droba 2002-2004. // // 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_FIND_ITERATOR_HPP #define BOOST_STRING_FIND_ITERATOR_HPP #include
#include
#include
#include
#include
#include
#include
#include
#include
/*! \file Defines find iterator classes. Find iterator repeatly applies a Finder to the specified input string to search for matches. Dereferencing the iterator yields the current match or a range between the last and the current match depending on the iterator used. */ namespace boost { namespace algorithm { // find_iterator -----------------------------------------------// //! find_iterator /*! Find iterator encapsulates a Finder and allows for incremental searching in a string. Each increment moves the iterator to the next match. Find iterator is a readable forward traversal iterator. Dereferencing the iterator yields an iterator_range delimiting the current match. */ template
class find_iterator : public iterator_facade< find_iterator
, const iterator_range
, forward_traversal_tag >, private detail::find_iterator_base
{ private: // facade support friend class ::boost::iterator_core_access; // base type typedef iterator_facade< find_iterator
, const iterator_range
, forward_traversal_tag> facade_type; private: // typedefs typedef detail::find_iterator_base
base_type; typedef BOOST_STRING_TYPENAME base_type::input_iterator_type input_iterator_type; typedef BOOST_STRING_TYPENAME base_type::match_type match_type; public: //! Default constructor /*! Construct null iterator. All null iterators are equal. \post eof()==true */ find_iterator() {} //! Copy constructor /*! Construct a copy of the find_iterator */ find_iterator( const find_iterator& Other ) : base_type(Other), m_Match(Other.m_Match), m_End(Other.m_End) {} //! Constructor /*! Construct new find_iterator for a given finder and a range. */ template
find_iterator( IteratorT Begin, IteratorT End, FinderT Finder ) : detail::find_iterator_base
(Finder,0), m_Match(Begin,Begin), m_End(End) { increment(); } //! Constructor /*! Construct new find_iterator for a given finder and a range. */ template
find_iterator( RangeT& Col, FinderT Finder ) : detail::find_iterator_base
(Finder,0) { iterator_range
::type> lit_col(as_literal(Col)); m_Match=make_iterator_range(begin(lit_col), begin(lit_col)); m_End=end(lit_col); increment(); } private: // iterator operations // dereference const match_type& dereference() const { return m_Match; } // increment void increment() { m_Match=this->do_find(m_Match.end(),m_End); } // comparison bool equal( const find_iterator& Other ) const { bool bEof=eof(); bool bOtherEof=Other.eof(); return bEof || bOtherEof ? bEof==bOtherEof : ( m_Match==Other.m_Match && m_End==Other.m_End ); } public: // operations //! Eof check /*! Check the eof condition. Eof condition means that there is nothing more to be searched i.e. find_iterator is after the last match. */ bool eof() const { return this->is_null() || ( m_Match.begin() == m_End && m_Match.end() == m_End ); } private: // Attributes match_type m_Match; input_iterator_type m_End; }; //! find iterator construction helper /*! * Construct a find iterator to iterate through the specified string */ template
inline find_iterator< BOOST_STRING_TYPENAME range_iterator
::type> make_find_iterator( RangeT& Collection, FinderT Finder) { return find_iterator
::type>( Collection, Finder); } // split iterator -----------------------------------------------// //! split_iterator /*! Split iterator encapsulates a Finder and allows for incremental searching in a string. Unlike the find iterator, split iterator iterates through gaps between matches. Find iterator is a readable forward traversal iterator. Dereferencing the iterator yields an iterator_range delimiting the current match. */ template
class split_iterator : public iterator_facade< split_iterator
, const iterator_range
, forward_traversal_tag >, private detail::find_iterator_base
{ private: // facade support friend class ::boost::iterator_core_access; // base type typedef iterator_facade< find_iterator
, iterator_range
, forward_traversal_tag> facade_type; private: // typedefs typedef detail::find_iterator_base
base_type; typedef BOOST_STRING_TYPENAME base_type::input_iterator_type input_iterator_type; typedef BOOST_STRING_TYPENAME base_type::match_type match_type; public: //! Default constructor /*! Construct null iterator. All null iterators are equal. \post eof()==true */ split_iterator() {} //! Copy constructor /*! Construct a copy of the split_iterator */ split_iterator( const split_iterator& Other ) : base_type(Other), m_Match(Other.m_Match), m_Next(Other.m_Next), m_End(Other.m_End), m_bEof(false) {} //! Constructor /*! Construct new split_iterator for a given finder and a range. */ template
split_iterator( IteratorT Begin, IteratorT End, FinderT Finder ) : detail::find_iterator_base
(Finder,0), m_Match(Begin,Begin), m_Next(Begin), m_End(End), m_bEof(false) { increment(); } //! Constructor /*! Construct new split_iterator for a given finder and a collection. */ template
split_iterator( RangeT& Col, FinderT Finder ) : detail::find_iterator_base
(Finder,0), m_bEof(false) { iterator_range
::type> lit_col(as_literal(Col)); m_Match=make_iterator_range(begin(lit_col), begin(lit_col)); m_Next=begin(lit_col); m_End=end(lit_col); increment(); } private: // iterator operations // dereference const match_type& dereference() const { return m_Match; } // increment void increment() { match_type FindMatch=this->do_find( m_Next, m_End ); if(FindMatch.begin()==m_End && FindMatch.end()==m_End) { if(m_Match.end()==m_End) { // Mark iterator as eof m_bEof=true; } } m_Match=match_type( m_Next, FindMatch.begin() ); m_Next=FindMatch.end(); } // comparison bool equal( const split_iterator& Other ) const { bool bEof=eof(); bool bOtherEof=Other.eof(); return bEof || bOtherEof ? bEof==bOtherEof : ( m_Match==Other.m_Match && m_Next==Other.m_Next && m_End==Other.m_End ); } public: // operations //! Eof check /*! Check the eof condition. Eof condition means that there is nothing more to be searched i.e. find_iterator is after the last match. */ bool eof() const { return this->is_null() || m_bEof; } private: // Attributes match_type m_Match; input_iterator_type m_Next; input_iterator_type m_End; bool m_bEof; }; //! split iterator construction helper /*! * Construct a split iterator to iterate through the specified collection */ template
inline split_iterator< BOOST_STRING_TYPENAME range_iterator
::type> make_split_iterator( RangeT& Collection, FinderT Finder) { return split_iterator
::type>( Collection, Finder); } } // namespace algorithm // pull names to the boost namespace using algorithm::find_iterator; using algorithm::make_find_iterator; using algorithm::split_iterator; using algorithm::make_split_iterator; } // namespace boost #endif // BOOST_STRING_FIND_ITERATOR_HPP
find_iterator.hpp
Page URL
File URL
Prev
10/24
Next
Download
( 12 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.