/usr/include/srchiliteqt/TextFormatterFactory.h is in libsource-highlight-qt4-dev 0.2.2-0ubuntu5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | /*
* Copyright (C) 2008-2010 Lorenzo Bettini, http://www.lorenzobettini.it
* License: See COPYING file that comes with this distribution
*/
#ifndef TEXTFORMATTERFACTORY_H_
#define TEXTFORMATTERFACTORY_H_
#include <map>
#include "srchilite/formatterfactory.h"
#include "TextFormatter.h"
#include "QtColorMap.h"
namespace srchiliteqt {
using std::string;
typedef std::map<string, TextFormatterPtr> TextFormatterMap;
/**
* Specialization of FormatterFactory to create TextFormatter objects
* to format text in a TextEdit.
*/
class TextFormatterFactory: public srchilite::FormatterFactory {
protected:
TextFormatterMap textFormatterMap;
/// whether to default font to monospace (default true)
bool defaultToMonospace;
public:
/// the color map for source-highlight colors into RGB #RRGGBB values
static QtColorMap colorMap;
TextFormatterFactory();
virtual ~TextFormatterFactory();
/**
* Checks whether a formatter for the given key is already present. If not found,
* then it returns an empty TextFormatterPtr
* @param key
* @return whether a formatter for the given key is already present
*/
bool hasFormatter(const string &key) const;
/**
* Returns the formatter for the given key.
* @param key
* @return the formatter for the given key is already present
*/
TextFormatterPtr getFormatter(const string &key) const;
/**
* Adds the formatter for the given key.
* @param key
* @param formatter
*/
void addFormatter(const string &key, TextFormatterPtr formatter);
/**
* @return the TextFormatterMap
*/
const TextFormatterMap &getTextFormatterMap() const {
return textFormatterMap;
}
bool isDefaultToMonospace() const {
return defaultToMonospace;
}
/**
* Whether the created formatters should use monospace font
* by default if nothing is specified about the font family
*
* @param d
*/
void setDefaultToMonospace(bool d) {
defaultToMonospace = d;
}
};
}
#endif /* TEXTFORMATTERFACTORY_H_ */
|