File: QSyntaxStyle.hpp

package info (click to toggle)
qcodeeditor 1.0%2B1gitdc644d-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 528 kB
  • sloc: cpp: 2,502; xml: 731; python: 11; makefile: 9
file content (70 lines) | stat: -rw-r--r-- 1,273 bytes parent folder | download | duplicates (2)
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
#pragma once

// Qt
#include <QObject> // Required for inheritance
#include <QMap>
#include <QString>
#include <QTextCharFormat>

/**
 * @brief Class, that describes Qt style
 * parser for QCodeEditor.
 */
class QSyntaxStyle : public QObject
{
    Q_OBJECT

public:

    /**
     * @brief Constructor.
     * @param parent Pointer to parent QObject
     */
    explicit QSyntaxStyle(QObject* parent=nullptr);

    /**
     * @brief Method for loading and parsing
     * style.
     * @param fl Style.
     * @return Success.
     */
    bool load(QString fl);

    /**
     * @brief Method for getting style name.
     * @return Name.
     */
    QString name() const;

    /**
     * @brief Method for checking is syntax style loaded.
     * @return Is loaded.
     */
    bool isLoaded() const;

    /**
     * @brief Method for getting format for property
     * name.
     * @param name Property name.
     * @return Text char format.
     */
    QTextCharFormat getFormat(QString name) const;

    /**
     * @brief Static method for getting default style.
     * @return Pointer to default style.
     */
    static QSyntaxStyle* defaultStyle();

private:

    QString m_name;

    QMap<
        QString,
        QTextCharFormat
    > m_data;

    bool m_loaded;
};