Source-highlight Library
|
Associates to an element name the corresponding formatter. More...
#include <formattermanager.h>
Public Member Functions | |
FormatterManager (FormatterPtr _defaultFormatter) | |
FormatterPtr | getFormatter (const std::string &elem) const |
Returns the formatter for the specific element (this function always returns a valid pointer, since if no formatter is found for the specified element, it will return the default formatter) More... | |
FormatterPtr | getDefaultFormatter () const |
void | setDefaultFormatter (FormatterPtr def) |
FormatterPtr | hasFormatter (const std::string &elem) const |
Returns the formatter for the specific element or an empty pointer if there's no such formatter. More... | |
void | addFormatter (const std::string &elem, FormatterPtr formatter) |
Associates the formatter to the element name (possible previous associated formatter is discarded). More... | |
void | reset () |
Resets this formatter manager: it removes all the current associations. | |
const FormatterMap & | getFormatterMap () const |
Private Attributes | |
FormatterMap | formatterMap |
the map associating to each element name a formatter | |
FormatterPtr | defaultFormatter |
the default formatter, i.e., the one that is used when there's no formatter associated to an element name | |
Associates to an element name the corresponding formatter.
This class uses shared pointers for formatters
srchilite::FormatterManager::FormatterManager | ( | FormatterPtr | _defaultFormatter | ) |
_defaultFormatter | the default formatter, i.e., the one that is used when there's no formatter associated to an element name |
void srchilite::FormatterManager::addFormatter | ( | const std::string & | elem, |
FormatterPtr | formatter | ||
) |
Associates the formatter to the element name (possible previous associated formatter is discarded).
elem | |
formatter |
FormatterPtr srchilite::FormatterManager::getFormatter | ( | const std::string & | elem | ) | const |
Returns the formatter for the specific element (this function always returns a valid pointer, since if no formatter is found for the specified element, it will return the default formatter)
elem |
|
inline |
FormatterPtr srchilite::FormatterManager::hasFormatter | ( | const std::string & | elem | ) | const |
Returns the formatter for the specific element or an empty pointer if there's no such formatter.
elem |