Source-highlight Library
/home/bettini/work/source-highlight/src-highlite/lib/srchilite/textstyleformatterfactory.h
00001 //
00002 // Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 2004-2008
00003 //
00004 // Copyright: See COPYING file that comes with this distribution
00005 //
00006 
00007 #ifndef TEXTSTYLEFORMATTERFACTORY_H_
00008 #define TEXTSTYLEFORMATTERFACTORY_H_
00009 
00010 #include <string>
00011 #include <list>
00012 #include <boost/shared_ptr.hpp>
00013 
00014 #include "formatterfactory.h"
00015 #include "textstyles.h"
00016 #include "textstyleformattercollection.h"
00017 
00018 namespace srchilite {
00019 
00020 using std::string;
00021 
00022 class PreFormatter;
00023 class CTagsFormatter;
00024 class FormatterManager;
00025 class TextStyleFormatter;
00026 
00030 class TextStyleFormatterFactory : public FormatterFactory {
00032     TextStylesPtr textStyles;
00033 
00035     PreFormatter *preformatter;
00036 
00038     CTagsFormatter *ctagsFormatter;
00039 
00041     FormatterManager *formatterManager;
00042 
00044     TextStyleFormatterCollection formatterCollection;
00045 
00046 public:
00047     TextStyleFormatterFactory(TextStylesPtr textStyles,
00048             PreFormatter *preformatter, CTagsFormatter *ctagsFormatter,
00049             FormatterManager *formatterManager);
00050     ~TextStyleFormatterFactory();
00051 
00062     bool createFormatter(const string &key, const string &color,
00063             const string &bgcolor, StyleConstantsPtr styleconstants);
00064 
00071     string preprocessColor(const string &color);
00072 
00080     bool createMissingFormatter(const string &key1, const string &key2);
00081 
00087     void addDefaultFormatter();
00088 
00089     const TextStyleFormatterCollection &getFormatterCollection() const {
00090         return formatterCollection;
00091     }
00092 };
00093 
00094 }
00095 
00096 #endif /*TEXTSTYLEFORMATTERFACTORY_H_*/