Panda3D
 All Classes Functions Variables Enumerations
lineStreamBuf.h
1 // Filename: lineStreamBuf.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 LINESTREAMBUF_H
16 #define LINESTREAMBUF_H
17 
18 #include "dtoolbase.h"
19 
20 #include <string>
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : LineStreamBuf
24 // Description : Used by LineStream to implement an ostream that
25 // writes to a memory buffer, whose contents can be
26 // continuously extracted as a sequence of lines of
27 // text.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_DTOOL LineStreamBuf : public streambuf {
30 public:
31  LineStreamBuf();
32  virtual ~LineStreamBuf();
33 
34  INLINE bool is_text_available() const;
35  string get_line();
36  INLINE bool has_newline() const;
37 
38 protected:
39  virtual int overflow(int c);
40  virtual int sync();
41 
42 private:
43  INLINE void write_chars(const char *start, int length);
44 
45  string _data;
46  bool _has_newline;
47 };
48 
49 #include "lineStreamBuf.I"
50 
51 #endif
Used by LineStream to implement an ostream that writes to a memory buffer, whose contents can be cont...
Definition: lineStreamBuf.h:29