x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
regex_iterator.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\regex\v4\regex_iterator.hpp
旋转
特效
属性
历史版本
/* * * Copyright (c) 2003 * John Maddock * * Use, modification and distribution are 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) * */ /* * LOCATION: see http://www.boost.org for most recent version. * FILE regex_iterator.hpp * VERSION see
* DESCRIPTION: Provides regex_iterator implementation. */ #ifndef BOOST_REGEX_V4_REGEX_ITERATOR_HPP #define BOOST_REGEX_V4_REGEX_ITERATOR_HPP #include
namespace boost{ #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif template
class regex_iterator_implementation { typedef basic_regex
regex_type; match_results
what; // current match BidirectionalIterator base; // start of sequence BidirectionalIterator end; // end of sequence const regex_type re; // the expression match_flag_type flags; // flags for matching public: regex_iterator_implementation(const regex_type* p, BidirectionalIterator last, match_flag_type f) : base(), end(last), re(*p), flags(f){} bool init(BidirectionalIterator first) { base = first; return regex_search(first, end, what, re, flags); } bool compare(const regex_iterator_implementation& that) { if(this == &that) return true; return (&re.get_data() == &that.re.get_data()) && (end == that.end) && (flags == that.flags) && (what[0].first == that.what[0].first) && (what[0].second == that.what[0].second); } const match_results
& get() { return what; } bool next() { //if(what.prefix().first != what[0].second) // flags |= match_prev_avail; BidirectionalIterator next_start = what[0].second; match_flag_type f(flags); if(!what.length()) f |= regex_constants::match_not_initial_null; //if(base != next_start) // f |= regex_constants::match_not_bob; bool result = regex_search(next_start, end, what, re, f, base); if(result) what.set_base(base); return result; } private: regex_iterator_implementation& operator=(const regex_iterator_implementation&); }; template
::value_type, class traits = regex_traits
> class regex_iterator #ifndef BOOST_NO_STD_ITERATOR : public std::iterator< std::forward_iterator_tag, match_results
, typename re_detail::regex_iterator_traits
::difference_type, const match_results
*, const match_results
& > #endif { private: typedef regex_iterator_implementation
impl; typedef shared_ptr
pimpl; public: typedef basic_regex
regex_type; typedef match_results
value_type; typedef typename re_detail::regex_iterator_traits
::difference_type difference_type; typedef const value_type* pointer; typedef const value_type& reference; typedef std::forward_iterator_tag iterator_category; regex_iterator(){} regex_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re, match_flag_type m = match_default) : pdata(new impl(&re, b, m)) { if(!pdata->init(a)) { pdata.reset(); } } regex_iterator(const regex_iterator& that) : pdata(that.pdata) {} regex_iterator& operator=(const regex_iterator& that) { pdata = that.pdata; return *this; } bool operator==(const regex_iterator& that)const { if((pdata.get() == 0) || (that.pdata.get() == 0)) return pdata.get() == that.pdata.get(); return pdata->compare(*(that.pdata.get())); } bool operator!=(const regex_iterator& that)const { return !(*this == that); } const value_type& operator*()const { return pdata->get(); } const value_type* operator->()const { return &(pdata->get()); } regex_iterator& operator++() { cow(); if(0 == pdata->next()) { pdata.reset(); } return *this; } regex_iterator operator++(int) { regex_iterator result(*this); ++(*this); return result; } private: pimpl pdata; void cow() { // copy-on-write if(pdata.get() && !pdata.unique()) { pdata.reset(new impl(*(pdata.get()))); } } }; typedef regex_iterator
cregex_iterator; typedef regex_iterator
sregex_iterator; #ifndef BOOST_NO_WREGEX typedef regex_iterator
wcregex_iterator; typedef regex_iterator
wsregex_iterator; #endif // make_regex_iterator: template
inline regex_iterator
make_regex_iterator(const charT* p, const basic_regex
& e, regex_constants::match_flag_type m = regex_constants::match_default) { return regex_iterator
(p, p+traits::length(p), e, m); } template
inline regex_iterator
::const_iterator, charT, traits> make_regex_iterator(const std::basic_string
& p, const basic_regex
& e, regex_constants::match_flag_type m = regex_constants::match_default) { return regex_iterator
::const_iterator, charT, traits>(p.begin(), p.end(), e, m); } #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable: 4103) #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #ifdef BOOST_MSVC #pragma warning(pop) #endif } // namespace boost #endif // BOOST_REGEX_V4_REGEX_ITERATOR_HPP
regex_iterator.hpp
网页地址
文件地址
上一页
27/43
下一页
下载
( 6 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.