CppCMS
cppcms/copy_filter.h
00001 
00002 //                                                                             
00003 //  Copyright (C) 2008-2012  Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>     
00004 //                                                                             
00005 //  See accompanying file COPYING.TXT file for licensing details.
00006 //
00008 #ifndef CPPCMS_COPY_FILTER_H
00009 #define CPPCMS_COPY_FILTER_H
00010 
00011 
00012 #include <booster/streambuf.h>
00013 #include <booster/noncopyable.h>
00014 #include <booster/hold_ptr.h>
00015 #include <cppcms/defs.h>
00016 #include <list>
00017 #include <ostream>
00018 
00019 namespace cppcms {
00043         class CPPCMS_API copy_filter : public booster::noncopyable {
00044         public:
00048                 copy_filter(std::ostream &output);
00053                 ~copy_filter();
00057                 std::string detach();
00058                 
00059         private:
00060                 class tee_device;
00061                 struct data;
00062                 booster::hold_ptr<data> d;
00063                 booster::streambuf copy_buffer_;
00064                 std::ostream &output_;
00065                 std::ostream real_output_stream_;
00066                 std::list<std::string> data_;
00067                 bool detached_;
00068         };
00069 } // cppcms
00070 
00071 
00072 #endif