⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 collector.cpp

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 CPP
字号:
/*=============================================================================    Copyright (c) 2002 2004 2006 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)=============================================================================*/#include "./collector.hpp"#include <boost/assert.hpp>namespace quickbook{    string_stream::string_stream()        : buffer_ptr(new std::string())        , stream_ptr(new ostream(boost::iostreams::back_inserter(*buffer_ptr.get())))    {}    string_stream::string_stream(string_stream const& other)        : buffer_ptr(other.buffer_ptr)        , stream_ptr(other.stream_ptr)    {}        string_stream&    string_stream::operator=(string_stream const& other)    {        buffer_ptr = other.buffer_ptr;        stream_ptr = other.stream_ptr;        return *this;    }            collector::collector()        : main(default_)        , top(default_)    {    }    collector::collector(string_stream& out)        : main(out)         , top(out)     {    }        collector::~collector()    {        BOOST_ASSERT(streams.empty()); // assert there are no more pushes than pops!!!    }        void     collector::push()    {        streams.push(string_stream());        top = boost::ref(streams.top());    }        void     collector::pop()    {        BOOST_ASSERT(!streams.empty());        streams.pop();        if (streams.empty())            top = boost::ref(main);        else            top = boost::ref(streams.top());    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -