This file is indexed.

/usr/include/srchiliteqt/Qt4TextFormatter.h is in libsource-highlight-qt4-dev 0.2.2-0ubuntu7.

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
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 *  Copyright (C) 2008-2010  Lorenzo Bettini, http://www.lorenzobettini.it
 *  License: See COPYING file that comes with this distribution
 */

#ifndef QT4TEXTFORMATTER_H_
#define QT4TEXTFORMATTER_H_

#include <QTextCharFormat>
#include <QSyntaxHighlighter>

#include "TextFormatter.h"

namespace srchiliteqt {

class Qt4SyntaxHighlighter;

/**
 * The implementation of TextFormatter for Qt4, relying on QTextCharFormat
 */
class Qt4TextFormatter: public TextFormatter {
protected:
    /**
     * The format represented by this formatter.
     */
    QTextCharFormat textFormat;

    /** the (possibly invalid) foreground color.
     * We need to keep a copy to be sure whether the color is valid or not,
     * since QTextCharFormat has always a default (valid) color */
    QColor foregroundColor;

    /// the (possibly invalid) background color
    QColor backgroundColor;

    /**
     * The reference to QSyntaxHighlighter object.
     *
     * Since this header file does not include the header file for QSyntaxHighlighter,
     * then this same class can be re-used both for Qt3 and for Qt4 (the subclasses
     * of this class will include the correct header file for QSyntaxHighlighter).
     */
    Qt4SyntaxHighlighter *qSyntaxHighlighter;

public:
    Qt4TextFormatter(const std::string &elem_ = "normal");
    virtual ~Qt4TextFormatter();

    const QTextCharFormat &getQTextCharFormat() const {
        return textFormat;
    }

    virtual void setQSyntaxHighlighter(QSyntaxHighlighter *qSyntaxHighlighter_);

    /**
     * Formats the passed string.
     *
     * @param the string to format
     * @param params possible additional parameters for the formatter (NOT USED)
     */
    void format(const std::string &s, const srchilite::FormatterParams *params);

    /**
     * @return a string representation of this formatter
     */
    const QString toString() const;

    /**
     * Starting from this formatter, it builds a string representation using
     * the syntax of source-highlight style file
     *
     * @return a string representation using the syntax of source-highlight
     * style file
     */
    const QString toSourceHighlightStyleString() const;

    bool isBold() const {
        return textFormat.fontWeight() == QFont::Bold;
    }

    void setBold(bool b) {
        textFormat.setFontWeight(b ? QFont::Bold : QFont::Normal);
    }

    bool isItalic() const {
        return textFormat.fontItalic();
    }

    void setItalic(bool i) {
        textFormat.setFontItalic(i);
    }

    bool isUnderline() const {
        return textFormat.fontUnderline();
    }

    void setUnderline(bool u) {
        textFormat.setFontUnderline(u);
    }

    bool isMonospace() const {
        return textFormat.fontFamily() == "Monospace";
    }

    void setMonospace(bool m) {
        if (m)
            textFormat.setFontFamily("Monospace");
    }

    /// @return the (possibly invalid, if not set) foreground color
    const QColor &getForegroundColor() const {
        return foregroundColor;
    }

    void setForegroundColor(const QColor &color);

    /// @return the (possibly invalid, if not set) background color
    const QColor &getBackgroundColor() const {
        return backgroundColor;
    }

    void setBackgroundColor(const QColor &color);
};

}

#endif /* QT4TEXTFORMATTER_H_ */