1 /****************************************************************************
2 **
3 ** Copyright (C) 2006-2009 fullmetalcoder <fullmetalcoder@hotmail.fr>
4 **
5 ** This file is part of the Edyuk project <http://edyuk.org>
6 **
7 ** This file may be used under the terms of the GNU General Public License
8 ** version 3 as published by the Free Software Foundation and appearing in the
9 ** file GPL.txt included in the packaging of this file.
10 **
11 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13 **
14 ****************************************************************************/
15 
16 #include "qlanguagedefinition.h"
17 
18 /*!
19 	\file qlanguagedefinition.cpp
20 	\brief Implementation of QLanguageDefinition
21 
22 	\see QLanguageDefinition
23 */
24 
25 /*!
26 	\ingroup language
27 	@{
28 
29 	\class QLanguageDefinition
30 	\brief Interface for language definition.
31 
32 	This class is meant to be subclassed, see \see QGenericDefinition for more
33 	informations, and added to a QLanguageFactory.
34 
35 	A language definition is a wrapper that creates interfaces for a given file
36 	extension from internally handled data (XML files in the case of
37 	QGenericDefinition)
38 
39 	\see QLanguageFactory
40 */
41 
42 #include "qdocument.h"
43 #include "qdocumentline.h"
44 #include "qdocumentcursor.h"
45 
46 #include "qlanguagefactory.h"
47 
48 #include <QKeyEvent>
49 
50 /*!
51 	\brief Empty constructor
52 */
QLanguageDefinition()53 QLanguageDefinition::QLanguageDefinition()
54 {
55 }
56 
57 /*!
58 	\brief Empty destructor
59 */
~QLanguageDefinition()60 QLanguageDefinition::~QLanguageDefinition()
61 {
62 }
63 
64 /*!
65 	\fn QLanguageDefinition::language()
66 
67 	\return The language supported by this definition
68 */
69 
70 /*!
71 	\fn QLanguageDefinition::extensions()
72 
73 	\return the file extensions corrseponding to the supported language
74 
75 	\see language()
76 	\see QFileInfo::completeSuffix()
77 */
78 
79 /*!
80 	\brief Entry point for syntax highlighting
81 */
tokenize(QDocument * d,int line,int count)82 int QLanguageDefinition::tokenize(QDocument *d, int line, int count)
83 {
84 	Q_UNUSED(d)
85 	Q_UNUSED(line)
86 
87 	return count;
88 }
89 
90 /*!
91 	\brief Return the string starting a single line comment, if any offered by the language
92 */
singleLineComment() const93 QString QLanguageDefinition::singleLineComment() const
94 {
95 	return QString();
96 }
97 
98 /*!
99 	\brief Let language specify which line mark should be toggled by left clicking a line mark panel
100 */
defaultLineMark() const101 QString QLanguageDefinition::defaultLineMark() const
102 {
103 	return QString();
104 }
105 
106 /*!
107 	\brief Brace matching entry point
108 */
clearMatches(QDocument * d)109 void QLanguageDefinition::clearMatches(QDocument *d)
110 {
111 	Q_UNUSED(d)
112 }
113 
114 /*!
115 	\brief Brace matching entry point
116 */
match(QDocumentCursor & c)117 void QLanguageDefinition::match(QDocumentCursor& c)
118 {
119 	Q_UNUSED(c)
120 }
121 
122 /*!
123 	\brief Return the indent to use when inserting a line at a given cursor position
124 */
indent(const QDocumentCursor & c)125 QString QLanguageDefinition::indent(const QDocumentCursor& c)
126 {
127 	Q_UNUSED(c)
128 
129 	return QString();
130 }
131 
132 /*!
133 	\brief Determines whether the given key event at the given position should cause unindent to happen
134 */
unindent(const QDocumentCursor & c,const QString & ktxt)135 bool QLanguageDefinition::unindent (const QDocumentCursor& c, const QString& ktxt)
136 {
137 	Q_UNUSED(c)
138 	Q_UNUSED(ktxt)
139 
140 	return false;
141 }
142 
143 /*!
144 	\brief Expand a collapsed block at a given line
145 */
expand(QDocument * d,int line)146 void QLanguageDefinition::expand(QDocument *d, int line)
147 {
148 	Q_UNUSED(d)
149 	Q_UNUSED(line)
150 }
151 
152 /*!
153 	\brief Collapse a text block at a given line
154 */
collapse(QDocument * d,int line)155 void QLanguageDefinition::collapse(QDocument *d, int line)
156 {
157 	Q_UNUSED(d)
158 	Q_UNUSED(line)
159 }
160 
161 /*!
162 	\brief Compute the collapse state of a line
163 */
blockFlags(QDocument * d,int line,int depth) const164 int QLanguageDefinition::blockFlags(QDocument *d, int line, int depth) const
165 {
166 	Q_UNUSED(d)
167 	Q_UNUSED(line)
168 	Q_UNUSED(depth)
169 
170 	return 0;
171 }
172 
173 /*! @} */
174