00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef TEXTFORMATTERFACTORY_H_
00010 #define TEXTFORMATTERFACTORY_H_
00011
00012 #include <map>
00013
00014 #include "srchilite/formatterfactory.h"
00015
00016 #include "TextFormatter.h"
00017 #include "QtColorMap.h"
00018
00019 namespace srchiliteqt {
00020
00021 using std::string;
00022
00023 typedef std::map<string, TextFormatterPtr> TextFormatterMap;
00024
00029 class TextFormatterFactory: public srchilite::FormatterFactory {
00030 protected:
00031 TextFormatterMap textFormatterMap;
00032
00034 bool defaultToMonospace;
00035
00036 public:
00038 static QtColorMap colorMap;
00039
00040 TextFormatterFactory();
00041 virtual ~TextFormatterFactory();
00042
00049 bool hasFormatter(const string &key) const;
00050
00056 TextFormatterPtr getFormatter(const string &key) const;
00057
00063 void addFormatter(const string &key, TextFormatterPtr formatter);
00064
00068 const TextFormatterMap &getTextFormatterMap() const {
00069 return textFormatterMap;
00070 }
00071
00072 bool isDefaultToMonosapce() const {
00073 return defaultToMonospace;
00074 }
00075
00082 void setDefaultToMonosapce(bool d) {
00083 defaultToMonospace = d;
00084 }
00085 };
00086
00087 }
00088
00089 #endif