OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / texteditor / generichighlighter / context.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef CONTEXT_H
34 #define CONTEXT_H
35
36 #include "includerulesinstruction.h"
37
38 #include <QtCore/QString>
39 #include <QtCore/QList>
40 #include <QtCore/QSharedPointer>
41
42 namespace TextEditor {
43 namespace Internal {
44
45 class Rule;
46 class HighlightDefinition;
47
48 class Context
49 {
50 public:
51     Context();
52     Context(const Context &context);
53     const Context &operator=(Context copy);
54     ~Context();
55
56     void configureId(const int unique);
57     const QString &id() const;
58
59     void setName(const QString &name);
60     const QString &name() const;
61
62     void setLineBeginContext(const QString &context);
63     const QString &lineBeginContext() const;
64
65     void setLineEndContext(const QString &context);
66     const QString &lineEndContext() const;
67
68     void setFallthroughContext(const QString &context);
69     const QString &fallthroughContext() const;
70
71     void setItemData(const QString &itemData);
72     const QString &itemData() const;
73
74     void setFallthrough(const QString &fallthrough);
75     bool isFallthrough() const;
76
77     void setDynamic(const QString &dynamic);
78     bool isDynamic() const;
79     void updateDynamicRules(const QStringList &captures) const;
80
81     void addRule(const QSharedPointer<Rule> &rule);
82     void addRule(const QSharedPointer<Rule> &rule, int index);
83     const QList<QSharedPointer<Rule> > &rules() const;
84
85     void addIncludeRulesInstruction(const IncludeRulesInstruction &instruction);
86     const QList<IncludeRulesInstruction> &includeRulesInstructions() const;
87     void clearIncludeRulesInstructions();
88
89     void setDefinition(const QSharedPointer<HighlightDefinition> &definition);
90     const QSharedPointer<HighlightDefinition> &definition() const;
91
92     void swap(Context &context);
93
94 private:
95     QString m_id;
96     QString m_name;
97     QString m_lineBeginContext;
98     QString m_lineEndContext;
99     QString m_fallthroughContext;
100     QString m_itemData;
101     bool m_fallthrough;
102     bool m_dynamic;
103
104     QList<QSharedPointer<Rule> > m_rules;
105     QList<IncludeRulesInstruction> m_instructions;
106
107     QSharedPointer<HighlightDefinition> m_definition;
108 };
109
110 } // namespace Internal
111 } // namespace TextEditor
112
113 #endif // CONTEXT_H