00001 00008 #ifndef _TEXTSTYLEFORMATTER_H_ 00009 #define _TEXTSTYLEFORMATTER_H_ 00010 00011 #include "textstyle.h" 00012 #include "formatter.h" 00013 00014 namespace srchilite { 00015 00016 class BufferedOutput; 00017 class PreFormatter; 00018 class CTagsFormatter; 00019 00023 class TextStyleFormatter : public Formatter { 00024 private: 00026 TextStyle textstyle; 00027 00029 BufferedOutput *output; 00030 00032 PreFormatter *preFormatter; 00033 00035 CTagsFormatter *ctagsFormatter; 00036 00037 public: 00038 TextStyleFormatter(const TextStyle &style, BufferedOutput *o = 0); 00039 TextStyleFormatter(const std::string &repr = "$text", 00040 BufferedOutput *o = 0); 00041 00042 virtual ~TextStyleFormatter() { 00043 } 00044 00045 virtual void 00046 format(const std::string &s, const FormatterParams *params = 0); 00047 00048 BufferedOutput *getBufferedOutput() const { 00049 return output; 00050 } 00051 00052 CTagsFormatter *getCTagsFormatter() const { 00053 return ctagsFormatter; 00054 } 00055 00056 void setBufferedOutput(BufferedOutput *o) { 00057 output = o; 00058 } 00059 00060 void setPreFormatter(PreFormatter *p) { 00061 preFormatter = p; 00062 } 00063 00064 void setCTagsFormatter(CTagsFormatter *f) { 00065 ctagsFormatter = f; 00066 } 00067 00071 const std::string &toString() const { 00072 return textstyle.toString(); 00073 } 00074 00075 protected: 00082 void doFormat(const std::string &s, bool preformat = true); 00083 00090 bool formatReferences(const std::string &s, const FormatterParams *params); 00091 00092 }; 00093 00094 } 00095 00096 #endif /* _TEXTSTYLEFORMATTER_H_ */