x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
parser_traits.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\spirit\meta\parser_traits.hpp
旋转
特效
属性
历史版本
/*============================================================================= Copyright (c) 2002-2003 Joel de Guzman Copyright (c) 2002-2003 Hartmut Kaiser Copyright (c) 2003 Martin Wille 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_PARSER_TRAITS_HPP) #define BOOST_SPIRIT_PARSER_TRAITS_HPP #include
#include
#include
#include
/////////////////////////////////////////////////////////////////////////////// namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////////// // // Parser traits templates // // Used to determine the type and several other characteristics of a given // parser type. // /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // // The is_parser traits template can be used to tell wether a given // class is a parser. // /////////////////////////////////////////////////////////////////////////////// template
struct is_parser { BOOST_STATIC_CONSTANT(bool, value = (::boost::is_base_and_derived
, T>::value)); // [JDG 2/3/03] simplified implementation by // using boost::is_base_and_derived }; /////////////////////////////////////////////////////////////////////////////// // // The is_unary_composite traits template can be used to tell if a given // parser is a unary parser as for instance kleene_star or optional. // /////////////////////////////////////////////////////////////////////////////// template
struct is_unary_composite { BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible< typename UnaryT::parser_category_t, unary_parser_category>::value)); }; /////////////////////////////////////////////////////////////////////////////// // // The is_acction_parser traits template can be used to tell if a given // parser is a action parser, i.e. it is a composite consisting of a // auxilliary parser and an attached semantic action. // /////////////////////////////////////////////////////////////////////////////// template
struct is_action_parser { BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible< typename ActionT::parser_category_t, action_parser_category>::value)); }; /////////////////////////////////////////////////////////////////////////////// // // The is_binary_composite traits template can be used to tell if a given // parser is a binary parser as for instance sequence or difference. // /////////////////////////////////////////////////////////////////////////////// template
struct is_binary_composite { BOOST_STATIC_CONSTANT(bool, value = (::boost::is_convertible< typename BinaryT::parser_category_t, binary_parser_category>::value)); }; /////////////////////////////////////////////////////////////////////////////// // // The is_composite_parser traits template can be used to tell if a given // parser is a unary or a binary parser composite type. // /////////////////////////////////////////////////////////////////////////////// template
struct is_composite_parser { BOOST_STATIC_CONSTANT(bool, value = ( ::boost::spirit::is_unary_composite
::value || ::boost::spirit::is_binary_composite
::value)); }; /////////////////////////////////////////////////////////////////////////////// template
struct is_alternative { BOOST_STATIC_CONSTANT(bool, value = ( ::boost::spirit::impl::parser_type_traits
::is_alternative)); }; template
struct is_sequence { BOOST_STATIC_CONSTANT(bool, value = ( ::boost::spirit::impl::parser_type_traits
::is_sequence)); }; template
struct is_sequential_or { BOOST_STATIC_CONSTANT(bool, value = ( ::boost::spirit::impl::parser_type_traits
::is_sequential_or)); }; template
struct is_intersection { BOOST_STATIC_CONSTANT(bool, value = ( ::boost::spirit::impl::parser_type_traits
::is_intersection)); }; template
struct is_difference { BOOST_STATIC_CONSTANT(bool, value = ( ::boost::spirit::impl::parser_type_traits
::is_difference)); }; template
struct is_exclusive_or { BOOST_STATIC_CONSTANT(bool, value = ( ::boost::spirit::impl::parser_type_traits
::is_exclusive_or)); }; template
struct is_optional { BOOST_STATIC_CONSTANT(bool, value = ( ::boost::spirit::impl::parser_type_traits
::is_optional)); }; template
struct is_kleene_star { BOOST_STATIC_CONSTANT(bool, value = ( ::boost::spirit::impl::parser_type_traits
::is_kleene_star)); }; template
struct is_positive { BOOST_STATIC_CONSTANT(bool, value = ( ::boost::spirit::impl::parser_type_traits
::is_positive)); }; /////////////////////////////////////////////////////////////////////////////// // // Parser extraction templates // /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // // The unary_subject template can be used to return the type of the // parser used as the subject of an unary parser. // If the parser under inspection is not an unary type parser the compilation // will fail. // /////////////////////////////////////////////////////////////////////////////// template
struct unary_subject { BOOST_STATIC_ASSERT(::boost::spirit::is_unary_composite
::value); typedef typename UnaryT::subject_t type; }; /////////////////////////////////////////////////////////////////////////////// // // The get_unary_subject template function returns the parser object, which // is used as the subject of an unary parser. // If the parser under inspection is not an unary type parser the compilation // will fail. // /////////////////////////////////////////////////////////////////////////////// template
inline typename unary_subject
::type const & get_unary_subject(UnaryT const &unary_) { BOOST_STATIC_ASSERT(::boost::spirit::is_unary_composite
::value); return unary_.subject(); } /////////////////////////////////////////////////////////////////////////////// // // The binary_left_subject and binary_right_subject templates can be used to // return the types of the parsers used as the left and right subject of an // binary parser. // If the parser under inspection is not a binary type parser the compilation // will fail. // /////////////////////////////////////////////////////////////////////////////// template
struct binary_left_subject { BOOST_STATIC_ASSERT(::boost::spirit::is_binary_composite
::value); typedef typename BinaryT::left_t type; }; template
struct binary_right_subject { BOOST_STATIC_ASSERT(::boost::spirit::is_binary_composite
::value); typedef typename BinaryT::right_t type; }; /////////////////////////////////////////////////////////////////////////////// // // The get_binary_left_subject and get_binary_right_subject template functions // return the parser object, which is used as the left or right subject of a // binary parser. // If the parser under inspection is not a binary type parser the compilation // will fail. // /////////////////////////////////////////////////////////////////////////////// template
inline typename binary_left_subject
::type const & get_binary_left_subject(BinaryT const &binary_) { BOOST_STATIC_ASSERT(::boost::spirit::is_binary_composite
::value); return binary_.left(); } template
inline typename binary_right_subject
::type const & get_binary_right_subject(BinaryT const &binary_) { BOOST_STATIC_ASSERT(::boost::spirit::is_binary_composite
::value); return binary_.right(); } /////////////////////////////////////////////////////////////////////////////// // // The action_subject template can be used to return the type of the // parser used as the subject of an action parser. // If the parser under inspection is not an action type parser the compilation // will fail. // /////////////////////////////////////////////////////////////////////////////// template
struct action_subject { BOOST_STATIC_ASSERT(::boost::spirit::is_action_parser
::value); typedef typename ActionT::subject_t type; }; /////////////////////////////////////////////////////////////////////////////// // // The get_action_subject template function returns the parser object, which // is used as the subject of an action parser. // If the parser under inspection is not an action type parser the compilation // will fail. // /////////////////////////////////////////////////////////////////////////////// template
inline typename action_subject
::type const & get_action_subject(ActionT const &action_) { BOOST_STATIC_ASSERT(::boost::spirit::is_action_parser
::value); return action_.subject(); } /////////////////////////////////////////////////////////////////////////////// // // The semantic_action template can be used to return the type of the // attached semantic action of an action parser. // If the parser under inspection is not an action type parser the compilation // will fail. // /////////////////////////////////////////////////////////////////////////////// template
struct semantic_action { BOOST_STATIC_ASSERT(::boost::spirit::is_action_parser
::value); typedef typename ActionT::predicate_t type; }; /////////////////////////////////////////////////////////////////////////////// // // The get_semantic_action template function returns the attached semantic // action of an action parser. // If the parser under inspection is not an action type parser the compilation // will fail. // /////////////////////////////////////////////////////////////////////////////// template
inline typename semantic_action
::type const & get_semantic_action(ActionT const &action_) { BOOST_STATIC_ASSERT(::boost::spirit::is_action_parser
::value); return action_.predicate(); } /////////////////////////////////////////////////////////////////////////////// }} // namespace boost::spirit #endif // !defined(BOOST_SPIRIT_PARSER_TRAITS_HPP)
parser_traits.hpp
网页地址
文件地址
上一页
3/5
下一页
下载
( 11 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.