socket_stream.h

00001 /*
00002  * socket_stream.h
00003  * This file is part of dbPager Server
00004  *
00005  * Copyright (c) 2009 Dennis Prochko <wolfsoft@mail.ru>
00006  *
00007  * dbPager Server is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation version 3.
00010  *
00011  * dbPager Server is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with dbPager Server; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor,
00019  * Boston, MA  02110-1301  USA
00020  */
00021 
00022 #ifndef _SOCKET_STREAM_H_
00023 #define _SOCKET_STREAM_H_
00024 
00025 #include <streambuf>
00026 
00027 #include <dcl/noncopyable.h>
00028 #include <dcl/socket.h>
00029 
00030 namespace dbp {
00031 
00033 
00036 class socket_stream: public std::streambuf, public noncopyable {
00037 public:
00038         socket_stream(socket &s, std::size_t buf_size = 1500,
00039           std::size_t put_back = 8);
00040 protected:
00041         int_type underflow();
00042 private:
00043         const std::size_t _put_back;
00044         std::vector<char> _buf;
00045         socket _s;
00046 };
00047 
00048 } // namespace
00049 
00050 #endif /*_SOCKET_STREAM_H_*/

 
Support This Project
SourceForge.net Logo