Source-highlight Library
textstyleformatter.h
1
7
8#ifndef _TEXTSTYLEFORMATTER_H_
9#define _TEXTSTYLEFORMATTER_H_
10
11#include "textstyle.h"
12#include "formatter.h"
13
14namespace srchilite {
15
16class BufferedOutput;
17class PreFormatter;
18class CTagsFormatter;
19
23class TextStyleFormatter : public Formatter {
24private:
27
30
33
36
37public:
38 TextStyleFormatter(const TextStyle &style, BufferedOutput *o = 0);
39 TextStyleFormatter(const std::string &repr = "$text",
40 BufferedOutput *o = 0);
41
42 virtual ~TextStyleFormatter() {
43 }
44
45 virtual void
46 format(const std::string &s, const FormatterParams *params = 0);
47
48 BufferedOutput *getBufferedOutput() const {
49 return output;
50 }
51
52 CTagsFormatter *getCTagsFormatter() const {
53 return ctagsFormatter;
54 }
55
56 void setBufferedOutput(BufferedOutput *o) {
57 output = o;
58 }
59
60 void setPreFormatter(PreFormatter *p) {
61 preFormatter = p;
62 }
63
64 void setCTagsFormatter(CTagsFormatter *f) {
66 }
67
71 const std::string &toString() const {
72 return textstyle.toString();
73 }
74
75protected:
82 void doFormat(const std::string &s, bool preformat = true);
83
90 bool formatReferences(const std::string &s, const FormatterParams *params);
91
92};
93
94}
95
96#endif /* _TEXTSTYLEFORMATTER_H_ */
The main class for writing into the output.
Definition bufferedoutput.h:28
Formatter for information gathered from ctags.
Definition ctagsformatter.h:50
Preformats text to be generated.
Definition preformatter.h:31
PreFormatter * preFormatter
the possible pre formatter for text
Definition textstyleformatter.h:32
TextStyle textstyle
the TextStyle for formatting
Definition textstyleformatter.h:26
BufferedOutput * output
where to output the formatting
Definition textstyleformatter.h:29
CTagsFormatter * ctagsFormatter
the possible formatter for ctags (references and anchors)
Definition textstyleformatter.h:35
bool formatReferences(const std::string &s, const FormatterParams *params)
Performs reference formatting (by relying on the CTagsFormatter).
Definition textstyleformatter.cpp:48
const std::string & toString() const
Definition textstyleformatter.h:71
void doFormat(const std::string &s, bool preformat=true)
Actually performs formatting (no reference formatting); this is used internally.
Definition textstyleformatter.cpp:37
virtual void format(const std::string &s, const FormatterParams *params=0)
Formats the passed string.
Definition textstyleformatter.cpp:31
Represents a formatting template where there can be some variables (starting with $,...
Definition textstyle.h:36
C++ class: doctemplate.h.
Definition bufferedoutput.cpp:13
Additional parameters that can be passed to a formatter.
Definition formatterparams.h:18