ignore .lib and .exe
[prop.git] / prop-src / textbuf.h
blob64ccff5fb2939e0e3e989918e26c97b389d86a92
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // Text buffer class
4 //
5 ///////////////////////////////////////////////////////////////////////////////
6 #ifndef text_buffer_h
7 #define text_buffer_h
9 #include <stdlib.h>
11 ///////////////////////////////////////////////////////////////////////////////
13 // Text buffer represents a simple open-ended insertion only buffer,
14 // sort of like a light weight ostrstream.
16 ///////////////////////////////////////////////////////////////////////////////
17 class TextBuffer
19 protected:
21 char * buffer; // storage to buffer
22 char * limit; // limit of buffer
23 char * cursor; // cursor to next insertion point
25 void grow (size_t); // expand buffer
27 public:
29 TextBuffer();
30 TextBuffer(const TextBuffer&); // transfer to another buffer
31 ~TextBuffer();
33 void operator = (const TextBuffer&); // transfer to another buffer
34 void emit (const char *, long = -1);
35 void emit (char);
36 inline const char * text () const { return buffer; }
37 inline size_t length () const { return cursor - buffer; }
38 inline void reset () { cursor = buffer; }
41 #endif