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
/////////////////////////////////////////////////////////////////////////////// // as_action.hpp // // Copyright 2007 Eric Niebler. // Copyright 2007 David Jenkins. // // 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) #ifndef BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_ACTION_HPP_EAN_04_05_2007 #define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_ACTION_HPP_EAN_04_05_2007 // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif #include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace xpressive { namespace detail { /////////////////////////////////////////////////////////////////////////////// // FindAttr // Look for patterns like (a1= terminal
) and return the type of the RHS. template
struct FindAttr : proto::or_< proto::transform::state< proto::terminal
> // Ignore nested actions, because attributes are scoped: , proto::transform::state< proto::subscript
> , proto::transform::arg< proto::transform::right< proto::assign< proto::terminal
> , proto::_ > > > , proto::transform::fold
> > > > {}; /////////////////////////////////////////////////////////////////////////////// // by_value // Store all terminals within an action by value to avoid dangling references. template
struct by_value : Terminal { template
struct apply : proto::result_of::as_expr
::type> {}; template
static typename apply
::type call(Expr const &expr, State const &, Visitor &) { return proto::as_expr(proto::arg(expr)); } }; /////////////////////////////////////////////////////////////////////////////// // read_attr // Placeholder that knows the slot number of an attribute as well as the type // of the object stored in it. template
struct read_attr { typedef Nbr nbr_type; typedef Matcher matcher_type; }; /////////////////////////////////////////////////////////////////////////////// // as_read_attr // For patterns like (a1 = RHS)[ref(i) = a1], transform to // (a1 = RHS)[ref(i) = read_attr<1, RHS>] so that when reading the attribute // we know what type is stored in the attribute slot. template
struct as_read_attr : Grammar { template
struct apply : proto::result_of::as_expr< read_attr< typename Expr::proto_arg0::nbr_type , typename FindAttr
::template apply
::type > > {}; template
static typename apply
::type call(Expr const &, State const &, Visitor &) { typename apply
::type that = {{}}; return that; } }; /////////////////////////////////////////////////////////////////////////////// // DeepCopy // Turn all refs into values, and also bind all attribute placeholders with // the types from which they are being assigned. struct DeepCopy : proto::or_< as_read_attr
> > , by_value
> , proto::nary_expr
> > {}; /////////////////////////////////////////////////////////////////////////////// // max_attr // Take the maximum of the current attr slot number and the state. template
struct max_attr : Grammar { template
struct apply : mpl::max
::type> {}; }; /////////////////////////////////////////////////////////////////////////////// // attr_nbr // For an attribute placeholder, return the attribute's slot number. template
struct attr_nbr : Grammar { template
struct apply : Expr::proto_arg0::nbr_type {}; }; /////////////////////////////////////////////////////////////////////////////// // MaxAttr // In an action (rx)[act], find the largest attribute slot being used. struct MaxAttr : proto::or_< attr_nbr< proto::terminal< xpressive::detail::attribute_placeholder
> > , proto::transform::state< proto::terminal
> // Ignore nested actions, because attributes are scoped: , proto::transform::state< proto::subscript
> , proto::transform::fold
> > > > {}; /////////////////////////////////////////////////////////////////////////////// // as_attr_matcher // turn a1=matcher into attr_matcher
(1) template
struct as_attr_matcher : Grammar { as_attr_matcher(); template
struct apply { typedef attr_matcher< typename proto::result_of::arg
::type , typename Visitor::traits_type , Visitor::icase_type::value > type; }; template
static typename apply
::type call(Expr const &expr, State const &, Visitor &visitor) { return typename apply
::type( Expr::proto_arg0::proto_base_expr::proto_arg0::nbr_type::value , proto::arg(proto::right(expr)) , visitor.traits() ); } }; /////////////////////////////////////////////////////////////////////////////// // add_attrs // Wrap an expression in attr_begin_matcher/attr_end_matcher pair template
struct add_attrs : Grammar { add_attrs(); template
struct apply : proto::shift_right< typename proto::terminal< attr_begin_matcher
, int>::type> >::type , typename proto::shift_right< Expr , proto::terminal
::type >::type > {}; template
static typename apply
::type call(Expr const &expr, State const &, Visitor &) { attr_begin_matcher
, int>::type> begin; attr_end_matcher end; typename apply
::type that = {{begin}, {expr, {end}}}; return that; } }; /////////////////////////////////////////////////////////////////////////////// // InsertAttrs struct InsertAttrs : proto::or_< add_attrs
, int> > > , proto::_ > {}; /////////////////////////////////////////////////////////////////////////////// // CheckAssertion struct CheckAssertion : proto::function< proto::terminal
, proto::_ > {}; /////////////////////////////////////////////////////////////////////////////// // action_transform // Turn A[B] into (mark_begin(n) >> A >> mark_end(n) >> action_matcher
(n)) // If A and B use attributes, wrap the above expression in // a attr_begin_matcher
/ attr_end_matcher pair, where Count is // the number of attribute slots used by the pattern/action. template
struct as_action : Grammar { as_action(); template
struct apply { typedef typename proto::result_of::left
::type expr_type; typedef typename proto::result_of::right
::type action_type; typedef typename DeepCopy::apply
::type action_copy_type; typedef typename InsertMark::apply
::type marked_expr_type; typedef typename mpl::if_< proto::matches
, predicate_matcher
, action_matcher
>::type matcher_type; typedef typename proto::shift_right< marked_expr_type , typename proto::terminal
::type >::type no_attr_type; typedef typename InsertAttrs::apply
::type type; }; template
static typename apply
::type call(Expr const &expr, State const &state, Visitor &visitor) { typedef apply
apply_type; typedef typename apply_type::matcher_type matcher_type; int dummy = 0; typename apply_type::marked_expr_type marked_expr = InsertMark::call(proto::left(expr), state, visitor); typename apply_type::no_attr_type that = { marked_expr , { matcher_type ( DeepCopy::call(proto::right(expr), proto::left(expr), dummy) , proto::arg(proto::left(marked_expr)).mark_number_ ) } }; return InsertAttrs::call(that, state, visitor); } }; }}} #endif
as_action.hpp
Page URL
File URL
Prev 1/10
Next
Download
( 11 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.