Panda3D
wordWrapStreamBuf.h
1 // Filename: wordWrapStreamBuf.h
2 // Created by: drose (28Jun00)
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 WORDWRAPSTREAMBUF_H
16 #define WORDWRAPSTREAMBUF_H
17 
18 #include "pandatoolbase.h"
19 
20 #include <string>
21 
22 class ProgramBase;
23 class WordWrapStream;
24 
25 ////////////////////////////////////////////////////////////////////
26 // Class : WordWrapStreamBuf
27 // Description : Used by WordWrapStream to implement an ostream that
28 // flushes its output to ProgramBase::show_text().
29 ////////////////////////////////////////////////////////////////////
30 class WordWrapStreamBuf : public streambuf {
31 public:
33  virtual ~WordWrapStreamBuf();
34 
35 protected:
36  virtual int overflow(int c);
37  virtual int sync();
38 
39 private:
40  void write_chars(const char *start, int length);
41  INLINE void set_literal_mode(bool mode);
42  void flush_data();
43 
44  string _data;
45  WordWrapStream *_owner;
46  ProgramBase *_program;
47  bool _literal_mode;
48 };
49 
50 #include "wordWrapStreamBuf.I"
51 
52 #endif
This is intended to be the base class for most general-purpose utility programs in the PANDATOOL tree...
Definition: programBase.h:37
Used by WordWrapStream to implement an ostream that flushes its output to ProgramBase::show_text().
A special ostream that formats all of its output through ProgramBase::show_text().