aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/syntax-highlighting/src/lib/format_p.h
blob: d8770f1ef7cd870a5a5d4325a6a34ca6facebd69 (plain)
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
/*
    SPDX-FileCopyrightText: 2016 Volker Krause <vkrause@kde.org>

    SPDX-License-Identifier: MIT
*/

#ifndef KSYNTAXHIGHLIGHTING_FORMAT_P_H
#define KSYNTAXHIGHLIGHTING_FORMAT_P_H

#include "textstyledata_p.h"
#include "theme.h"

#include <QSharedData>
#include <QString>

namespace KSyntaxHighlighting
{
class FormatPrivate : public QSharedData
{
public:
    FormatPrivate() = default;
    static FormatPrivate *detachAndGet(Format &format);

    TextStyleData styleOverride(const Theme &theme) const;
    void load(QXmlStreamReader &reader);

    using StyleColor = QRgb(TextStyleData::*);
    using ThemeColor = QRgb (Theme::*)(Theme::TextStyle) const;
    bool hasColor(const Theme &theme, StyleColor styleColor, ThemeColor themeColor) const;
    QColor color(const Theme &theme, StyleColor styleColor, ThemeColor themeColor) const;

    QString definitionName;
    QString name;
    TextStyleData style;
    Theme::TextStyle defaultStyle = Theme::Normal;
    quint16 id = 0;
    bool spellCheck = true;
};

}

#endif