x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
match.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\spirit\core\match.hpp
旋转
特效
属性
历史版本
/*============================================================================= Copyright (c) 1998-2003 Joel de Guzman 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_MATCH_HPP) #define BOOST_SPIRIT_MATCH_HPP #include
#include
#include
#include
#include
#include
#include
#include
#include
namespace boost { namespace spirit { /////////////////////////////////////////////////////////////////////////// // // match class // // The match holds the result of a parser. A match object evaluates // to true when a successful match is found, otherwise false. The // length of the match is the number of characters (or tokens) that // is successfully matched. This can be queried through its length() // member function. A negative value means that the match is // unsucessful. // // Each parser may have an associated attribute. This attribute is // also returned back to the client on a successful parse through // the match object. The match's value() member function returns the // match's attribute. // // A match attribute is valid: // // * on a successful match // * when its value is set through the value(val) member function // * if it is assigned or copied from a compatible match object // (e.g. match
from match
) with a valid attribute. // // The match attribute is undefined: // // * on an unsuccessful match // * when an attempt to copy or assign from another match object // with an incompatible attribute type (e.g. match
// from match
). // // The member function has_valid_attribute() can be queried to know if // it is safe to get the match's attribute. The attribute may be set // through the member function value(v) where v is the new attribute // value. // /////////////////////////////////////////////////////////////////////////// template
class match : public safe_bool
> { public: typedef typename boost::optional
optional_type; typedef typename optional_type::argument_type ctor_param_t; typedef typename optional_type::reference_const_type return_t; typedef T attr_t; match(); explicit match(std::size_t length); match(std::size_t length, ctor_param_t val); bool operator!() const; std::ptrdiff_t length() const; bool has_valid_attribute() const; return_t value() const; void swap(match& other); template
match(match
const& other) : len(other.length()), val() { impl::match_attr_traits
::copy(val, other); } template
match& operator=(match
const& other) { impl::match_attr_traits
::assign(val, other); len = other.length(); return *this; } template
void concat(MatchT const& other) { BOOST_SPIRIT_ASSERT(*this && other); len += other.length(); } template
void value(ValueT const& val_) { impl::match_attr_traits
::set_value(val, val_, is_reference
()); } bool operator_bool() const { return len >= 0; } private: std::ptrdiff_t len; optional_type val; }; /////////////////////////////////////////////////////////////////////////// // // match class specialization for nil_t values // /////////////////////////////////////////////////////////////////////////// template <> class match
: public safe_bool
> { public: typedef nil_t attr_t; typedef nil_t return_t; match(); explicit match(std::size_t length); match(std::size_t length, nil_t); bool operator!() const; bool has_valid_attribute() const; std::ptrdiff_t length() const; nil_t value() const; void value(nil_t); void swap(match& other); template
match(match
const& other) : len(other.length()) {} template
match<>& operator=(match
const& other) { len = other.length(); return *this; } template
void concat(match
const& other) { BOOST_SPIRIT_ASSERT(*this && other); len += other.length(); } bool operator_bool() const { return len >= 0; } private: std::ptrdiff_t len; }; }} // namespace boost::spirit #endif #include
match.hpp
网页地址
文件地址
上一页
3/7
下一页
下载
( 5 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.