Source-highlight Library
srchilite::TextStyleFormatterFactory Class Reference

Generates TextStyleFormatters based on TextStyles. More...

#include <textstyleformatterfactory.h>

Inheritance diagram for srchilite::TextStyleFormatterFactory:
Collaboration diagram for srchilite::TextStyleFormatterFactory:

Public Member Functions

 TextStyleFormatterFactory (TextStylesPtr textStyles, PreFormatter *preformatter, CTagsFormatter *ctagsFormatter, FormatterManager *formatterManager)
 
bool createFormatter (const string &key, const string &color, const string &bgcolor, StyleConstantsPtr styleconstants)
 Creates a formatter for the specific language element (identified by key) with the passed style parameters. More...
 
string preprocessColor (const string &color)
 Check whether the color must be translated with the color map or left as it is (in that case, remove the ") More...
 
bool createMissingFormatter (const string &key1, const string &key2)
 Creates a formatter for key1, if not already present, that has the same style as the formatter for key2. More...
 
void addDefaultFormatter ()
 Adds the formatter for the normal style if not already present. More...
 
const
TextStyleFormatterCollection
getFormatterCollection () const
 

Private Attributes

TextStylesPtr textStyles
 contains all the styles for formatting
 
PreFormatterpreformatter
 to preformat text
 
CTagsFormatterctagsFormatter
 for ctgas reference generation (can be null)
 
FormatterManagerformatterManager
 the formatter manager (associating a formatter to an element)
 
TextStyleFormatterCollection formatterCollection
 all the formatters that are created by this factory
 

Detailed Description

Generates TextStyleFormatters based on TextStyles.

Member Function Documentation

void srchilite::TextStyleFormatterFactory::addDefaultFormatter ( )

Adds the formatter for the normal style if not already present.

This must be called after all the formatter for the language elements were generated

bool srchilite::TextStyleFormatterFactory::createFormatter ( const string &  key,
const string &  color,
const string &  bgcolor,
StyleConstantsPtr  styleconstants 
)
virtual

Creates a formatter for the specific language element (identified by key) with the passed style parameters.

Parameters
key
color
bgcolor
styleconstants
Returns
false if a formatter for the specific key is already present

Implements srchilite::FormatterFactory.

bool srchilite::TextStyleFormatterFactory::createMissingFormatter ( const string &  key1,
const string &  key2 
)

Creates a formatter for key1, if not already present, that has the same style as the formatter for key2.

Returns
false if the formatter for key1 is already present, or there's no formatter for key2
string srchilite::TextStyleFormatterFactory::preprocessColor ( const string &  color)

Check whether the color must be translated with the color map or left as it is (in that case, remove the ")

Parameters
color
Returns

The documentation for this class was generated from the following files: