Panda3D
|
00001 // Filename: lineStream.h 00002 // Created by: drose (26Feb00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef LINESTREAM_H 00016 #define LINESTREAM_H 00017 00018 #include "pandabase.h" 00019 00020 #include "lineStreamBuf.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : LineStream 00024 // Description : This is a special ostream that writes to a memory 00025 // buffer, like ostrstream. However, its contents can 00026 // be continuously extracted as a sequence of lines of 00027 // text. 00028 // 00029 // Unlike ostrstream, which can only be extracted from 00030 // once (and then the buffer freezes and it can no 00031 // longer be written to), the LineStream is not 00032 // otherwise affected when a line of text is extracted. 00033 // More text can still be written to it and continuously 00034 // extracted. 00035 //////////////////////////////////////////////////////////////////// 00036 class EXPCL_PANDA_PUTIL LineStream : public ostream { 00037 PUBLISHED: 00038 INLINE LineStream(); 00039 00040 INLINE bool is_text_available() const; 00041 INLINE string get_line(); 00042 INLINE bool has_newline() const; 00043 00044 private: 00045 LineStreamBuf _lsb; 00046 }; 00047 00048 #include "lineStream.I" 00049 00050 #endif