00001 // Filename: lineStream.h 00002 // Created by: drose (26Feb00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef LINESTREAM_H 00020 #define LINESTREAM_H 00021 00022 #include <pandabase.h> 00023 00024 #include "lineStreamBuf.h" 00025 00026 //////////////////////////////////////////////////////////////////// 00027 // Class : LineStream 00028 // Description : This is a special ostream that writes to a memory 00029 // buffer, like ostrstream. However, its contents can 00030 // be continuously extracted as a sequence of lines of 00031 // text. 00032 // 00033 // Unlike ostrstream, which can only be extracted from 00034 // once (and then the buffer freezes and it can no 00035 // longer be written to), the LineStream is not 00036 // otherwise affected when a line of text is extracted. 00037 // More text can still be written to it and continuously 00038 // extracted. 00039 //////////////////////////////////////////////////////////////////// 00040 class EXPCL_PANDA LineStream : public ostream { 00041 PUBLISHED: 00042 INLINE LineStream(); 00043 00044 INLINE bool is_text_available() const; 00045 INLINE string get_line(); 00046 INLINE bool has_newline() const; 00047 00048 private: 00049 LineStreamBuf _lsb; 00050 }; 00051 00052 #include "lineStream.I" 00053 00054 #endif