Panda3D
lineStream.h
1 // Filename: lineStream.h
2 // Created by: drose (26Feb00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef LINESTREAM_H
16 #define LINESTREAM_H
17 
18 #include "dtoolbase.h"
19 
20 #include "lineStreamBuf.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : LineStream
24 // Description : This is a special ostream that writes to a memory
25 // buffer, like ostrstream. However, its contents can
26 // be continuously extracted as a sequence of lines of
27 // text.
28 //
29 // Unlike ostrstream, which can only be extracted from
30 // once (and then the buffer freezes and it can no
31 // longer be written to), the LineStream is not
32 // otherwise affected when a line of text is extracted.
33 // More text can still be written to it and continuously
34 // extracted.
35 ////////////////////////////////////////////////////////////////////
36 class EXPCL_DTOOL LineStream : public ostream {
37 PUBLISHED:
38  INLINE LineStream();
39 
40  INLINE bool is_text_available() const;
41  INLINE string get_line();
42  INLINE bool has_newline() const;
43 
44 private:
45  LineStreamBuf _lsb;
46 };
47 
48 #include "lineStream.I"
49 
50 #endif
Used by LineStream to implement an ostream that writes to a memory buffer, whose contents can be cont...
Definition: lineStreamBuf.h:29
This is a special ostream that writes to a memory buffer, like ostrstream.
Definition: lineStream.h:36