x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
find_format_all.hpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\references\boost_1_35_0\boost\algorithm\string\detail\find_format_all.hpp
旋转
特效
属性
历史版本
// Boost string_algo library find_format_all.hpp header file ---------------------------// // Copyright Pavol Droba 2002-2003. // // 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) // See http://www.boost.org/ for updates, documentation, and revision history. #ifndef BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP #define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP #include
#include
#include
#include
#include
#include
namespace boost { namespace algorithm { namespace detail { // find_format_all_copy (iterator variant) implementation ---------------------------// template< typename OutputIteratorT, typename InputT, typename FinderT, typename FormatterT, typename FindResultT > inline OutputIteratorT find_format_all_copy_impl( OutputIteratorT Output, const InputT& Input, FinderT Finder, FormatterT Formatter, const FindResultT& FindResult ) { return find_format_all_copy_impl2( Output, Input, Finder, Formatter, FindResult, Formatter(FindResult) ); } template< typename OutputIteratorT, typename InputT, typename FinderT, typename FormatterT, typename FindResultT, typename FormatResultT > inline OutputIteratorT find_format_all_copy_impl2( OutputIteratorT Output, const InputT& Input, FinderT Finder, FormatterT Formatter, const FindResultT& FindResult, const FormatResultT& FormatResult ) { typedef BOOST_STRING_TYPENAME range_const_iterator
::type input_iterator_type; typedef find_format_store< input_iterator_type, FormatterT, FormatResultT > store_type; // Create store for the find result store_type M( FindResult, FormatResult, Formatter ); // Initialize last match input_iterator_type LastMatch=begin(Input); // Iterate through all matches while( M ) { // Copy the beginning of the sequence std::copy( LastMatch, M.begin(), Output ); // Copy formated result std::copy( begin(M.format_result()), end(M.format_result()), Output ); // Proceed to the next match LastMatch=M.end(); M=Finder( LastMatch, end(Input) ); } // Copy the rest of the sequence std::copy( LastMatch, end(Input), Output ); return Output; } // find_format_all_copy implementation ----------------------------------------------// template< typename InputT, typename FinderT, typename FormatterT, typename FindResultT > inline InputT find_format_all_copy_impl( const InputT& Input, FinderT Finder, FormatterT Formatter, const FindResultT& FindResult) { return find_format_all_copy_impl2( Input, Finder, Formatter, FindResult, Formatter(FindResult) ); } template< typename InputT, typename FinderT, typename FormatterT, typename FindResultT, typename FormatResultT > inline InputT find_format_all_copy_impl2( const InputT& Input, FinderT Finder, FormatterT Formatter, const FindResultT& FindResult, const FormatResultT& FormatResult) { typedef BOOST_STRING_TYPENAME range_const_iterator
::type input_iterator_type; typedef find_format_store< input_iterator_type, FormatterT, FormatResultT > store_type; // Create store for the find result store_type M( FindResult, FormatResult, Formatter ); // Initialize last match input_iterator_type LastMatch=begin(Input); // Output temporary InputT Output; // Iterate through all matches while( M ) { // Copy the beginning of the sequence insert( Output, end(Output), LastMatch, M.begin() ); // Copy formated result insert( Output, end(Output), M.format_result() ); // Proceed to the next match LastMatch=M.end(); M=Finder( LastMatch, end(Input) ); } // Copy the rest of the sequence insert( Output, end(Output), LastMatch, end(Input) ); return Output; } // find_format_all implementation ------------------------------------------------// template< typename InputT, typename FinderT, typename FormatterT, typename FindResultT > inline void find_format_all_impl( InputT& Input, FinderT Finder, FormatterT Formatter, FindResultT FindResult) { find_format_all_impl2( Input, Finder, Formatter, FindResult, Formatter(FindResult) ); } template< typename InputT, typename FinderT, typename FormatterT, typename FindResultT, typename FormatResultT > inline void find_format_all_impl2( InputT& Input, FinderT Finder, FormatterT Formatter, FindResultT FindResult, FormatResultT FormatResult) { typedef BOOST_STRING_TYPENAME range_iterator
::type input_iterator_type; typedef find_format_store< input_iterator_type, FormatterT, FormatResultT > store_type; // Create store for the find result store_type M( FindResult, FormatResult, Formatter ); // Instantiate replacement storage std::deque< BOOST_STRING_TYPENAME range_value
::type> Storage; // Initialize replacement iterators input_iterator_type InsertIt=begin(Input); input_iterator_type SearchIt=begin(Input); while( M ) { // process the segment InsertIt=process_segment( Storage, Input, InsertIt, SearchIt, M.begin() ); // Adjust search iterator SearchIt=M.end(); // Copy formated replace to the storage copy_to_storage( Storage, M.format_result() ); // Find range for a next match M=Finder( SearchIt, end(Input) ); } // process the last segment InsertIt=process_segment( Storage, Input, InsertIt, SearchIt, end(Input) ); if ( Storage.empty() ) { // Truncate input erase( Input, InsertIt, end(Input) ); } else { // Copy remaining data to the end of input insert( Input, end(Input), Storage.begin(), Storage.end() ); } } } // namespace detail } // namespace algorithm } // namespace boost #endif // BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
find_format_all.hpp
网页地址
文件地址
上一页
4/15
下一页
下载
( 9 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.