x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
as_set.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\xpressive\detail\static\transforms\as_set.hpp
旋转
特效
属性
历史版本
/////////////////////////////////////////////////////////////////////////////// // as_set.hpp // // Copyright 2007 Eric Niebler. 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_SET_HPP_EAN_04_05_2007 #define BOOST_XPRESSIVE_DETAIL_STATIC_TRANSFORMS_AS_SET_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
namespace boost { namespace xpressive { namespace detail { template
typename I::next next_(I) { return typename I::next(); } template
struct next : Grammar { next(); template
struct apply : Grammar::template apply
::type::next {}; template
static typename apply
::type call(Expr const &expr, State const &state, Visitor &visitor) { return detail::next_(Grammar::call(expr, state, visitor)); } }; template
struct push_back : Grammar { push_back(); template
static typename Grammar::template apply
::type call(Expr const &expr, State const &state, Visitor &visitor) { visitor.accept(proto::arg(expr)); return Grammar::call(expr, state, visitor); } }; /////////////////////////////////////////////////////////////////////////// // CharLiteral template
struct CharLiteral : proto::or_< proto::terminal
, proto::terminal
> {}; template<> struct CharLiteral
: proto::terminal
{}; /////////////////////////////////////////////////////////////////////////// // ListSet // matches expressions like (set= 'a','b','c') // calculates the size of the set // populates an array of characters template
struct ListSet : proto::transform::left< proto::or_< proto::comma< next
> , push_back
> > , proto::assign< proto::transform::always
> , push_back
> > > > {}; /////////////////////////////////////////////////////////////////////////// // set_fill_visitor template
struct set_fill_visitor { typedef typename Traits::char_type char_type; set_fill_visitor(char_type *buffer, Traits const &traits) : buffer_(buffer) , traits_(traits) {} template
void accept(Char ch) { *this->buffer_++ = this->traits_.translate( char_cast
(ch, this->traits_) ); } char_type *buffer_; Traits const &traits_; }; /////////////////////////////////////////////////////////////////////////////// // as_list_set template
struct as_list_set : Grammar { as_list_set(); template
struct apply { typedef typename Visitor::traits_type traits_type; typedef set_matcher< traits_type , Grammar::template apply
>::type::value > type; }; template
static typename apply
::type call(Expr const &expr, State const &state, Visitor &visitor) { typename apply
::type set; set_fill_visitor
filler(set.set_, visitor.traits()); Grammar::call(expr, state, filler); return set; } }; /////////////////////////////////////////////////////////////////////////////// // charset_context // template
struct charset_context { template
struct eval_ { typedef void result_type; void operator()(Expr const &expr, charset_context const &ctx) const { ctx.set(Grammar::call(expr, end_xpression(), ctx.visitor_)); } }; template
struct eval_
{ typedef void result_type; void operator()(Expr const &expr, charset_context const &ctx) const { proto::eval(proto::left(expr), ctx); proto::eval(proto::right(expr), ctx); } }; // Gah, this is to work around a MSVC bug. template
struct eval : eval_
{}; typedef typename Visitor::traits_type traits_type; typedef typename CharSet::char_type char_type; typedef typename CharSet::icase_type icase_type; explicit charset_context(CharSet &charset, Visitor &visitor) : charset_(charset) , visitor_(visitor) {} template
void set(literal_matcher
const &ch) const { // BUGBUG fixme! BOOST_MPL_ASSERT_NOT((mpl::bool_
)); set_char(this->charset_.charset_, ch.ch_, this->visitor_.traits(), icase_type()); } void set(range_matcher
const &rg) const { // BUGBUG fixme! BOOST_ASSERT(!rg.not_); set_range(this->charset_.charset_, rg.ch_min_, rg.ch_max_, this->visitor_.traits(), icase_type()); } template
void set(set_matcher
const &set_) const { // BUGBUG fixme! BOOST_ASSERT(!set_.not_); for(int i=0; i
charset_.charset_, set_.set_[i], this->visitor_.traits(), icase_type::value); } } void set(posix_charset_matcher
const &posix) const { set_class(this->charset_.charset_, posix.mask_, posix.not_, this->visitor_.traits()); } CharSet &charset_; Visitor &visitor_; }; /////////////////////////////////////////////////////////////////////////////// // template
struct as_set : Grammar { as_set(); template
struct apply { typedef typename Visitor::char_type char_type; // if sizeof(char_type)==1, merge everything into a basic_chset // BUGBUG this is not optimal. typedef typename mpl::if_< is_narrow_char
, basic_chset
, compound_charset
>::type charset_type; typedef charset_matcher< typename Visitor::traits_type , Visitor::icase_type::value , charset_type > type; }; template
static typename apply
::type call(Expr const &expr, State const &, Visitor &visitor) { typedef typename apply
::type set_type; set_type matcher; charset_context
ctx(matcher, visitor); // Walks the tree and fills in the charset proto::eval(expr, ctx); return matcher; } }; }}} #endif
as_set.hpp
网页地址
文件地址
上一页
10/10 下一页
下载
( 8 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.