summaryrefslogtreecommitdiffstats
path: root/languages/cpp/cppcodecompletionconfig.h
blob: 13b23ccf8d6d39e2565697ea22fc7ea40c943537 (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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
//
//
// C++ Interface: $MODULE$
//
// Description:
//
//
// Author: Roberto Raggi <robertol@kdevelop.org>, (C) 2003
//
// Copyright: See COPYING file that comes with this distribution
//
//
#ifndef CPPCODECOMPLETIONCONFIG_H
#define CPPCODECOMPLETIONCONFIG_H

#include <qobject.h>

class CppSupportPart;
class QDomDocument;


/**
@author Roberto Raggi
*/
class CppCodeCompletionConfig : public QObject
{
	Q_OBJECT
public:
	CppCodeCompletionConfig( CppSupportPart* part, QDomDocument* dom );
	virtual ~CppCodeCompletionConfig();

// 	bool includeGlobalFunctions() const
// 	{
// 		return m_includeGlobalFunctions;
// 	}
// 
// 	void setIncludeGlobalFunctions( bool b );
// 
// 	bool includeTypes() const
// 	{
// 		return m_includeTypes;
// 	}
// 
// 	void setIncludeTypes( bool b );
// 
// 	bool includeEnums() const
// 	{
// 		return m_includeEnums;
// 	}
// 
// 	void setIncludeEnums( bool b );
// 
// 	bool includeTypedefs() const
// 	{
// 		return m_includeTypedefs;
// 	}
// 
// 	void setIncludeTypedefs( bool b );

	enum CompletionBoxItemOrder {
		ByAccessLevel,
		ByClass,
		ByAlphabet
	};

    ///Whether the completion-cache should be kept alive as long as the context does not change
    bool usePermanentCaching() const {
        return m_usePermanentCaching;
    }
    
    void setUsePermanentCaching(bool b)  {
        m_usePermanentCaching = b;
    }
    
	///Whether higher namespaces(like the global one) should be included while computing the
	///completion-list when using automatic code-completion. Should get an option in the interface(slows down the completion).
    bool alwaysIncludeNamespaces() const {
        return m_alwaysIncludeNamespaces;
    }

    void setAlwaysIncludeNamespaces(bool b) {
        m_alwaysIncludeNamespaces = b;
    }
    
    ///Whether all included headers should be processed by the preprocessor(makes macros work across header-files)
    void setPreProcessAllHeaders(bool b) {
        m_preProcessAllHeaders = b;
    }

    ///Whether headers that were found and were not yet parsed in their active state should be parsed into the code-model
    void setParseMissingHeaders(bool b) {
        m_parseMissingHeaders = b;
    }

    ///Additional include-paths defined by the user
    void  setCustomIncludePaths(QString str) {
        m_includePaths = str;
    }

    ///Whether we should try to automatically find out the used include-path from Makefiles etc.
    void setResolveIncludePaths(bool b) {
        m_resolveIncludePaths = b;
    }
    
	///Whether higher namespaces(like the global one) should be included while computing the
	///completion-list when using automatic code-completion. Should get an option in the interface(slows down the completion).
    
    ///Whether all included headers should be processed by the preprocessor(makes macros work across header-files)
    bool preProcessAllHeaders() const {
        return m_preProcessAllHeaders;
    }
    
    ///Whether headers that were found and were not yet parsed in their active state should be parsed into the code-model
    bool parseMissingHeaders() const {
        return m_parseMissingHeaders;
    }
    
    ///Additional include-paths defined by the user
    QString customIncludePaths() const {
        return m_includePaths;
    }
    
    ///Whether we should try to automatically find out the used include-path from Makefiles etc.
    bool resolveIncludePaths() const {
        return m_resolveIncludePaths;
    }
    
    bool alwaysParseInBackground() const {
        return m_alwaysParseInBackground;
    }
    
    void setAlwaysParseInBackground(bool b)  {
        m_alwaysParseInBackground = b;
    }

	bool showNamespaceAppearances() const;

	bool showOnlyAccessibleItems() const {
		///not yet used
		return m_showOnlyAccessibleItems;
	}

	CompletionBoxItemOrder completionBoxItemOrder() const {
		///not yet used
		return m_completionBoxItemOrder;
	}

	bool showEvaluationContextMenu() const {
		///used
		return m_showEvaluationContextMenu;
	}

	bool showCommentWithArgumentHint() const {
		///used
		return m_showCommentWithArgumentHint;
	}

	bool statusBarTypeEvaluation() const {
		///used
		return m_statusBarTypeEvaluation;
	}

	QString namespaceAliases() const {
		///used
		return m_namespaceAliases;
	}

	bool processPrimaryTypes() const { ///The "do complete return-type-evaluation" entry. However it should be renamed, because it also covers Variable-types and typedefs!
		///used
		return m_processPrimaryTypes;
	}

	bool processFunctionArguments() const { ///The "do complete argument-type-evaluation" entry
		///used
		return m_processFunctionArguments;
	}


	void setShowOnlyAccessibleItems( bool b ) {
		///not yet used
		m_showOnlyAccessibleItems = b;
	}
	
	void setCompletionBoxItemOrder( CompletionBoxItemOrder b ) {
		///not yet used
		m_completionBoxItemOrder = b;
	}
	
	void setShowEvaluationContextMenu( bool b ) {
		///used
		m_showEvaluationContextMenu = b;
	}
	
	void setShowCommentWithArgumentHint( bool b ) {
		///used
		m_showCommentWithArgumentHint = b;
	}
	
	void setStatusBarTypeEvaluation( bool b ) {
		///used
		m_statusBarTypeEvaluation = b;
	}
	
	void setNamespaceAliases( QString n ) {
		///used
		m_namespaceAliases = n;
	}
	
	void setProcessPrimaryTypes( bool b ) { ///The "do complete return-type-evaluation" entry. However it should be renamed, because it also covers Variable-types and typedefs!
		///used
		m_processPrimaryTypes = b;
	}
	
	void setProcessFunctionArguments( bool b ) { ///The "do complete argument-type-evaluation" entry
		///used
		m_processFunctionArguments = b;
	}

	bool automaticCodeCompletion() const {
		return m_automaticCodeCompletion;
	}
	
	
	void setAutomaticCodeCompletion( bool b );

	bool automaticArgumentsHint() const
	{
		///used
		return m_automaticArgumentsHint;
	}

	void setAutomaticArgumentsHint( bool b );

	bool automaticHeaderCompletion() const
	{
		///used
		return m_automaticHeaderCompletion;
	}

	void setAutomaticHeaderCompletion( bool b );

	int codeCompletionDelay() const
	{
		///used
		return m_codeCompletionDelay;
	}

	void setCodeCompletionDelay( int delay );

	int argumentsHintDelay() const
	{
		///used
		return m_argumentsHintDelay;
	}

	void setArgumentsHintDelay( int delay );

	int headerCompletionDelay() const
	{
		///used
		return m_headerCompletionDelay;
	}

	void setHeaderCompletionDelay( int delay );

public slots:
	void store();

signals:
	void stored();

private:
	void init();

private:
	CppSupportPart* m_part;
	QDomDocument* m_dom;
/*	bool m_includeGlobalFunctions;
	bool m_includeTypes;
	bool m_includeEnums;
	bool m_includeTypedefs;*/
	bool m_automaticCodeCompletion;
	bool m_automaticArgumentsHint;
	bool m_automaticHeaderCompletion;
	int m_codeCompletionDelay;
	int m_argumentsHintDelay;
	int m_headerCompletionDelay;

    bool m_preProcessAllHeaders;
    bool m_parseMissingHeaders;
    bool m_resolveIncludePaths;
    bool m_alwaysIncludeNamespaces;
    bool m_alwaysParseInBackground;
    bool m_usePermanentCaching;
    QString m_includePaths;
    
	bool m_showOnlyAccessibleItems;
	CompletionBoxItemOrder m_completionBoxItemOrder;
	bool m_showEvaluationContextMenu;
	bool m_showCommentWithArgumentHint;
	bool m_statusBarTypeEvaluation;
	QString m_namespaceAliases;
	bool m_processPrimaryTypes;
	bool m_processFunctionArguments;

	static QString defaultPath;
};

#endif 
// kate: indent-mode csands; tab-width 4;