00001 /* Copyright (C) 2000 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; version 2 of the License. 00006 00007 This program is distributed in the hope that it will be useful, 00008 but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 GNU General Public License for more details. 00011 00012 You should have received a copy of the GNU General Public License 00013 along with this program; if not, write to the Free Software 00014 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 00015 00016 #ifndef CLIENT_LINEBUFFER_H 00017 #define CLIENT_LINEBUFFER_H 00018 00019 #include <vector> 00020 #include <sstream> 00021 #include <iostream> 00022 #include <boost/iostreams/stream.hpp> 00023 #include <boost/iostreams/device/file_descriptor.hpp> 00024 00025 class LineBuffer 00026 { 00027 public: 00028 LineBuffer(uint32_t max_size,FILE *file); 00029 void addString(const std::string &argument); 00030 char *readline(); 00031 private: 00032 FILE *file; 00033 std::vector<char> line; 00034 std::iostream *file_stream; 00035 uint32_t max_size; 00036 }; 00037 00038 #endif /* CLIENT_LINEBUFFER_H */