Source-highlight Library
linebuffer.h
1//
2// Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2005
3//
4// Copyright: See COPYING file that comes with this distribution
5//
6//
7#ifndef LINEBUFFER_H
8#define LINEBUFFER_H
9
10#include <string>
11#include <set>
12#include <boost/shared_ptr.hpp>
13
14#include <sstream>
15
16namespace srchilite {
17
22public:
24 typedef std::set<std::string> PostContents;
25
26private:
27 ostringstream buffer;
29
30public:
31 LineBuffer() {
32 }
33 ~LineBuffer() {
34 }
35
39 void output(const std::string &s) {
40 buffer << s;
41 }
42
46 void output_post(const std::string &s) {
47 post.insert(s);
48 }
49
53 const std::string getContents() const {
54 return buffer.str();
55 }
56
61 return post;
62 }
63
67 bool empty() const {
68 return (buffer.str().size() == 0 && post.size() == 0);
69 }
70};
71
73typedef boost::shared_ptr<LineBuffer> LineBufferPtr;
74
75}
76
77#endif
A buffer for a line to be generated.
Definition: linebuffer.h:21
const std::string getContents() const
Definition: linebuffer.h:53
void output(const std::string &s)
Puts something in the buffer.
Definition: linebuffer.h:39
ostringstream buffer
the line contents
Definition: linebuffer.h:27
PostContents post
to be generated after the line
Definition: linebuffer.h:28
void output_post(const std::string &s)
Stores something to be generated after the line.
Definition: linebuffer.h:46
const PostContents & getPostContents() const
Definition: linebuffer.h:60
bool empty() const
Definition: linebuffer.h:67
std::set< std::string > PostContents
Stores contents to be printed after the line.
Definition: linebuffer.h:24
C++ class: doctemplate.h.
Definition: bufferedoutput.cpp:13
boost::shared_ptr< LineBuffer > LineBufferPtr
shared pointer for LineBuffer
Definition: linebuffer.h:73