x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
traverse.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\spirit\meta\traverse.hpp
旋转
特效
属性
历史版本
/*============================================================================= Copyright (c) 2002-2003 Joel de Guzman Copyright (c) 2002-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) =============================================================================*/ #if !defined(BOOST_SPIRIT_TRAVERSE_HPP) #define BOOST_SPIRIT_TRAVERSE_HPP #include
namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// // // Post-order traversal of auxilliary parsers. // /////////////////////////////////////////////////////////////////////////// struct post_order { // Return the parser type, which is generated as the result of the // traverse function below. template
struct result { typedef typename traverse_post_order_return< MetaT , ParserT , traverse_post_order_env<0, 0, 0, 0> >::type type; }; // Traverse a given parser and refactor it with the help of the given // MetaT metafunction template. template
static typename result
::type traverse(MetaT const &meta_, ParserT const &parser_) { typedef typename ParserT::parser_category_t parser_category_t; return impl::traverse_post_order
::generate( meta_, parser_, traverse_post_order_env<0, 0, 0, 0>()); } }; /////////////////////////////////////////////////////////////////////////// // // Transform policies // // The following policy classes could be used to assemble some new // transformation metafunction which uses identity transformations // for some parser_category type parsers. // /////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////// // transform plain parsers template
struct plain_identity_policy { template
struct plain_result { // plain parsers should be embedded and returned correctly typedef typename ParserT::embed_t type; }; template
typename parser_traversal_plain_result
::type generate_plain(ParserT const &parser_, EnvT const& /*env*/) const { return parser_; } }; ////////////////////////////////// // transform unary parsers template
struct unary_identity_policy_return { typedef typename UnaryT::parser_generator_t parser_generator_t; typedef typename parser_generator_t ::template result
::type type; }; template
struct unary_identity_policy { template
struct unary_result { typedef typename unary_identity_policy_return
::type type; }; template
typename parser_traversal_unary_result< TransformT, UnaryT, SubjectT, EnvT>::type generate_unary( UnaryT const &, SubjectT const &subject_, EnvT const& /*env*/) const { typedef typename UnaryT::parser_generator_t parser_generator_t; return parser_generator_t::template generate
(subject_); } }; ////////////////////////////////// // transform action parsers template
struct action_identity_policy { template
struct action_result { typedef action
type; }; template
typename parser_traversal_action_result< TransformT, ActionT, SubjectT, EnvT >::type generate_action(ActionT const &action_, SubjectT const &subject_, EnvT const& /*env*/) const { return subject_[action_.predicate()]; } }; ////////////////////////////////// // transform binary parsers template
struct binary_identity_policy_return { typedef typename BinaryT::parser_generator_t parser_generator_t; typedef typename parser_generator_t ::template result
::type type; }; template
struct binary_identity_policy { template
struct binary_result { typedef typename binary_identity_policy_return
::type type; }; template
typename parser_traversal_binary_result< TransformT, BinaryT, LeftT, RightT, EnvT >::type generate_binary( BinaryT const &, LeftT const& left_ , RightT const& right_, EnvT const& /*env*/) const { typedef typename BinaryT::parser_generator_t parser_generator_t; return parser_generator_t:: template generate
(left_, right_); } }; /////////////////////////////////////////////////////////////////////////// // // transform_policies template // // The transform_policies template metafunction could serve as a // base class for new metafunctions to be passed to the traverse meta // template (see above), where only minimal parts have to be // overwritten. // /////////////////////////////////////////////////////////////////////////// template < typename TransformT, typename PlainPolicyT = plain_identity_policy
, typename UnaryPolicyT = unary_identity_policy
, typename ActionPolicyT = action_identity_policy
, typename BinaryPolicyT = binary_identity_policy
> struct transform_policies : public PlainPolicyT, public UnaryPolicyT, public ActionPolicyT, public BinaryPolicyT { }; /////////////////////////////////////////////////////////////////////////// // // Identity transformation // // The identity_transform metafunction supplied to the traverse // template will generate a new parser, which will be exactly // identical to the parser given as the parameter to the traverse // metafunction. I.e. the following conceptual 'equation' will be // always true: // // some_parser == // post_order::traverse(identity_transform(), some_parser) // /////////////////////////////////////////////////////////////////////////// struct identity_transform : transform_policies
{}; }} // namespace boost::spirit #endif // !defined(BOOST_SPIRIT_TRAVERSE_HPP)
traverse.hpp
网页地址
文件地址
上一页
5/5 下一页
下载
( 7 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.