Panda3D
wordWrapStreamBuf.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file wordWrapStreamBuf.h
10  * @author drose
11  * @date 2000-06-28
12  */
13 
14 #ifndef WORDWRAPSTREAMBUF_H
15 #define WORDWRAPSTREAMBUF_H
16 
17 #include "pandatoolbase.h"
18 
19 #include <string>
20 
21 class ProgramBase;
22 class WordWrapStream;
23 
24 /**
25  * Used by WordWrapStream to implement an ostream that flushes its output to
26  * ProgramBase::show_text().
27  */
28 class WordWrapStreamBuf : public std::streambuf {
29 public:
31  virtual ~WordWrapStreamBuf();
32 
33 protected:
34  virtual int overflow(int c);
35  virtual int sync();
36 
37 private:
38  void write_chars(const char *start, int length);
39  INLINE void set_literal_mode(bool mode);
40  void flush_data();
41 
42  std::string _data;
43  WordWrapStream *_owner;
44  ProgramBase *_program;
45  bool _literal_mode;
46 };
47 
48 #include "wordWrapStreamBuf.I"
49 
50 #endif
This is intended to be the base class for most general-purpose utility programs in the PANDATOOL tree...
Definition: programBase.h:34
Used by WordWrapStream to implement an ostream that flushes its output to ProgramBase::show_text().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A special ostream that formats all of its output through ProgramBase::show_text().