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
/*============================================================================= Copyright (c) 2003 Hartmut Kaiser http://spirit.sourceforge.net/ Use, modification and distribution is subject to 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) =============================================================================*/ #ifndef BOOST_SPIRIT_SWITCH_HPP #define BOOST_SPIRIT_SWITCH_HPP /////////////////////////////////////////////////////////////////////////////// // // The default_p parser generator template uses the following magic number // as the corresponding case label value inside the generated switch() // statements. If this number conflicts with your code, please pick a // different one. // /////////////////////////////////////////////////////////////////////////////// #if !defined(BOOST_SPIRIT_DEFAULTCASE_MAGIC) #define BOOST_SPIRIT_DEFAULTCASE_MAGIC 0x15F97A7 #endif /////////////////////////////////////////////////////////////////////////////// // // Spirit predefined maximum number of possible case_p/default_p case branch // parsers. // /////////////////////////////////////////////////////////////////////////////// #if !defined(BOOST_SPIRIT_SWITCH_CASE_LIMIT) #define BOOST_SPIRIT_SWITCH_CASE_LIMIT 3 #endif // !defined(BOOST_SPIRIT_SWITCH_CASE_LIMIT) /////////////////////////////////////////////////////////////////////////////// #include
/////////////////////////////////////////////////////////////////////////////// // // Ensure BOOST_SPIRIT_SELECT_LIMIT > 0 // /////////////////////////////////////////////////////////////////////////////// BOOST_STATIC_ASSERT(BOOST_SPIRIT_SWITCH_CASE_LIMIT > 0); #include
#include
#include
#include
#include
/////////////////////////////////////////////////////////////////////////////// namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////////// // // The switch_parser allows to build switch like parsing constructs, which // will have much better perfomance as comparable straight solutions. // // Input stream driven syntax: // // switch_p // [ // case_p<'a'> // (...parser to use, if the next character is 'a'...), // case_p<'b'> // (...parser to use, if the next character is 'b'...), // default_p // (...parser to use, if nothing was matched before...) // ] // // General syntax: // // switch_p(...lazy expression returning the switch condition value...) // [ // case_p<1> // (...parser to use, if the switch condition value is 1...), // case_p<2> // (...parser to use, if the switch condition value is 2...), // default_p // (...parser to use, if nothing was matched before...) // ] // // The maximum number of possible case_p branches is defined by the p constant // BOOST_SPIRIT_SWITCH_CASE_LIMIT (this value defaults to 3 if not otherwise // defined). // /////////////////////////////////////////////////////////////////////////////// template
struct switch_parser : public unary
> > { typedef switch_parser
self_t; typedef unary_parser_category parser_category_t; typedef unary
> base_t; switch_parser(CaseT const &case_) : base_t(case_), cond(CondT()) {} switch_parser(CaseT const &case_, CondT const &cond_) : base_t(case_), cond(cond_) {} template
struct result { typedef typename match_result
::type type; }; template
typename parser_result
::type parse(ScannerT const& scan) const { return this->subject().parse(scan, impl::make_cond_functor
::do_(cond)); } CondT cond; }; /////////////////////////////////////////////////////////////////////////////// template
struct switch_cond_parser { switch_cond_parser(CondT const &cond_) : cond(cond_) {} template
switch_parser
operator[](parser
const &p) const { return switch_parser
(p.derived(), cond); } CondT const &cond; }; /////////////////////////////////////////////////////////////////////////////// template
struct case_parser : public unary
> > { typedef case_parser
self_t; typedef unary_parser_category parser_category_t; typedef unary
> base_t; typedef typename base_t::subject_t self_subject_t; BOOST_STATIC_CONSTANT(int, value = N); BOOST_STATIC_CONSTANT(bool, is_default = IsDefault); BOOST_STATIC_CONSTANT(bool, is_simple = true); BOOST_STATIC_CONSTANT(bool, is_epsilon = ( is_default && boost::is_same
::value )); case_parser(parser
const &p) : base_t(p.derived()) {} template
struct result { typedef typename match_result
::type type; }; template
typename parser_result
::type parse(ScannerT const& scan, CondT const &cond) const { typedef impl::default_case
default_t; if (!scan.at_end()) { typedef impl::default_delegate_parse< value, is_default, default_t::value> default_parse_t; typename ScannerT::iterator_t const save(scan.first); return default_parse_t::parse(cond(scan), *this, *this, scan, save); } return default_t::is_epsilon ? scan.empty_match() : scan.no_match(); } template
impl::compound_case_parser< self_t, case_parser
, IsDefault1 > operator, (case_parser
const &p) const { // If the following compile time assertion fires, you've probably used // more than one default_p case inside the switch_p parser construct. BOOST_STATIC_ASSERT(!is_default || !IsDefault1); typedef case_parser
right_t; return impl::compound_case_parser
(*this, p); } }; /////////////////////////////////////////////////////////////////////////////// struct switch_parser_gen { // This generates a switch parser, which is driven by the condition value // returned by the lazy parameter expression 'cond'. This may be a parser, // which result is used or a phoenix actor, which will be dereferenced to // obtain the switch condition value. template
switch_cond_parser
operator()(CondT const &cond) const { return switch_cond_parser
(cond); } // This generates a switch parser, which is driven by the next character/token // found in the input stream. template
switch_parser
operator[](parser
const &p) const { return switch_parser
(p.derived()); } }; switch_parser_gen const switch_p = switch_parser_gen(); /////////////////////////////////////////////////////////////////////////////// template
inline case_parser
case_p(parser
const &p) { return case_parser
(p); } /////////////////////////////////////////////////////////////////////////////// struct default_parser_gen : public case_parser
{ default_parser_gen() : case_parser
(epsilon_p) {} template
case_parser
operator()(parser
const &p) const { return case_parser
(p); } }; default_parser_gen const default_p = default_parser_gen(); /////////////////////////////////////////////////////////////////////////////// }} // namespace boost::spirit #endif // BOOST_SPIRIT_SWITCH_HPP
switch.hpp
Page URL
File URL
Prev
8/10
Next
Download
( 8 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.