1
/****************************************************************************
3
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
** All rights reserved.
5
** Contact: Nokia Corporation (qt-info@nokia.com)
7
** This file is part of the Qt Mobility Components.
9
** $QT_BEGIN_LICENSE:LGPL$
11
** Licensees holding valid Qt Commercial licenses may use this file in
12
** accordance with the Qt Solutions Commercial License Agreement provided
13
** with the Software or, alternatively, in accordance with the terms
14
** contained in a written agreement between you and Nokia.
16
** GNU Lesser General Public License Usage
17
** Alternatively, this file may be used under the terms of the GNU Lesser
18
** General Public License version 2.1 as published by the Free Software
19
** Foundation and appearing in the file LICENSE.LGPL included in the
20
** packaging of this file. Please review the following information to
21
** ensure the GNU Lesser General Public License version 2.1 requirements
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
** In addition, as a special exception, Nokia gives you certain additional
25
** rights. These rights are described in the Nokia Qt LGPL Exception
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
** GNU General Public License Usage
29
** Alternatively, this file may be used under the terms of the GNU
30
** General Public License version 3.0 as published by the Free Software
31
** Foundation and appearing in the file LICENSE.GPL included in the
32
** packaging of this file. Please review the following information to
33
** ensure the GNU General Public License version 3.0 requirements will be
34
** met: http://www.gnu.org/copyleft/gpl.html.
36
** Please note Third Party Software included with Qt Solutions may impose
37
** additional restrictions and it is the user's responsibility to ensure
38
** that they have met the licensing requirements of the GPL, LGPL, or Qt
39
** Solutions Commercial license and the relevant license of the Third
40
** Party Software they are using.
42
** If you are unsure which license is appropriate for your use, please
43
** contact the sales department at qt-sales@nokia.com.
46
****************************************************************************/
47
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
49
// Permission is hereby granted, free of charge, to any person obtaining a copy
50
// of this software and associated documentation files (the "Software"), to deal
51
// in the Software without restriction, including without limitation the rights
52
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
// copies of the Software, and to permit persons to whom the Software is
54
// furnished to do so, subject to the following conditions:
56
// The above copyright notice and this permission notice shall be included in
57
// all copies or substantial portions of the Software.
59
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
67
#ifndef CPLUSPLUS_CONTROL_H
68
#define CPLUSPLUS_CONTROL_H
70
#include "CPlusPlusForwardDeclarations.h"
74
class CPLUSPLUS_EXPORT Control
80
TranslationUnit *translationUnit() const;
81
TranslationUnit *switchTranslationUnit(TranslationUnit *unit);
83
DiagnosticClient *diagnosticClient() const;
84
void setDiagnosticClient(DiagnosticClient *diagnosticClient);
86
/// Returns the canonical name id.
87
const NameId *nameId(const Identifier *id);
89
/// Returns the canonical template name id.
90
const TemplateNameId *templateNameId(const Identifier *id,
91
const FullySpecifiedType *const args = 0,
94
/// Returns the canonical destructor name id.
95
const DestructorNameId *destructorNameId(const Identifier *id);
97
/// Returns the canonical operator name id.
98
const OperatorNameId *operatorNameId(int operatorId);
100
/// Returns the canonical conversion name id.
101
const ConversionNameId *conversionNameId(const FullySpecifiedType &type);
103
/// Returns the canonical qualified name id.
104
const QualifiedNameId *qualifiedNameId(const Name *const *names,
106
bool isGlobal = false);
108
const SelectorNameId *selectorNameId(const Name *const *names,
112
/// Returns a Type object of type VoidType.
113
VoidType *voidType();
115
/// Returns a Type object of type IntegerType.
116
IntegerType *integerType(int integerId);
118
/// Returns a Type object of type FloatType.
119
FloatType *floatType(int floatId);
121
/// Returns a Type object of type PointertoMemberType.
122
PointerToMemberType *pointerToMemberType(const Name *memberName,
123
const FullySpecifiedType &elementType);
125
/// Returns a Type object of type PointerType.
126
PointerType *pointerType(const FullySpecifiedType &elementType);
128
/// Returns a Type object of type ReferenceType.
129
ReferenceType *referenceType(const FullySpecifiedType &elementType);
131
/// Retruns a Type object of type ArrayType.
132
ArrayType *arrayType(const FullySpecifiedType &elementType, unsigned size = 0);
134
/// Returns a Type object of type NamedType.
135
NamedType *namedType(const Name *name);
137
/// Creates a new Declaration symbol.
138
Declaration *newDeclaration(unsigned sourceLocation, const Name *name);
140
/// Creates a new Argument symbol.
141
Argument *newArgument(unsigned sourceLocation, const Name *name = 0);
143
/// Creates a new Argument symbol.
144
TypenameArgument *newTypenameArgument(unsigned sourceLocation, const Name *name = 0);
146
/// Creates a new Function symbol.
147
Function *newFunction(unsigned sourceLocation, const Name *name = 0);
149
/// Creates a new Namespace symbol.
150
Namespace *newNamespace(unsigned sourceLocation, const Name *name = 0);
152
/// Creates a new BaseClass symbol.
153
BaseClass *newBaseClass(unsigned sourceLocation, const Name *name = 0);
155
/// Creates a new Class symbol.
156
Class *newClass(unsigned sourceLocation, const Name *name = 0);
158
/// Creates a new Enum symbol.
159
Enum *newEnum(unsigned sourceLocation, const Name *name = 0);
161
/// Creates a new Block symbol.
162
Block *newBlock(unsigned sourceLocation);
164
/// Creates a new UsingNamespaceDirective symbol.
165
UsingNamespaceDirective *newUsingNamespaceDirective(unsigned sourceLocation, const Name *name = 0);
167
/// Creates a new UsingDeclaration symbol.
168
UsingDeclaration *newUsingDeclaration(unsigned sourceLocation, const Name *name = 0);
170
/// Creates a new ForwardClassDeclaration symbol.
171
ForwardClassDeclaration *newForwardClassDeclaration(unsigned sourceLocation, const Name *name = 0);
173
ObjCBaseClass *newObjCBaseClass(unsigned sourceLocation, const Name *name);
174
ObjCBaseProtocol *newObjCBaseProtocol(unsigned sourceLocation, const Name *name);
176
/// Creates a new Objective-C class symbol.
177
ObjCClass *newObjCClass(unsigned sourceLocation, const Name *name = 0);
179
/// Creates a new Objective-C class forward declaration symbol.
180
ObjCForwardClassDeclaration *newObjCForwardClassDeclaration(unsigned sourceLocation, const Name *name = 0);
182
/// Creates a new Objective-C protocol symbol.
183
ObjCProtocol *newObjCProtocol(unsigned sourceLocation, const Name *name = 0);
185
/// Creates a new Objective-C protocol forward declaration symbol.
186
ObjCForwardProtocolDeclaration *newObjCForwardProtocolDeclaration(unsigned sourceLocation, const Name *name = 0);
188
/// Creates a new Objective-C method symbol.
189
ObjCMethod *newObjCMethod(unsigned sourceLocation, const Name *name = 0);
191
/// Creates a new Objective-C @property declaration symbol.
192
ObjCPropertyDeclaration *newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name);
194
// Objective-C specific context keywords.
195
const Identifier *objcGetterId() const;
196
const Identifier *objcSetterId() const;
197
const Identifier *objcReadwriteId() const;
198
const Identifier *objcReadonlyId() const;
199
const Identifier *objcAssignId() const;
200
const Identifier *objcRetainId() const;
201
const Identifier *objcCopyId() const;
202
const Identifier *objcNonatomicId() const;
204
const Identifier *findIdentifier(const char *chars, unsigned size) const;
205
const Identifier *findOrInsertIdentifier(const char *chars, unsigned size);
206
const Identifier *findOrInsertIdentifier(const char *chars);
208
typedef const Identifier *const *IdentifierIterator;
209
typedef const StringLiteral *const *StringLiteralIterator;
210
typedef const NumericLiteral *const *NumericLiteralIterator;
212
IdentifierIterator firstIdentifier() const;
213
IdentifierIterator lastIdentifier() const;
215
StringLiteralIterator firstStringLiteral() const;
216
StringLiteralIterator lastStringLiteral() const;
218
NumericLiteralIterator firstNumericLiteral() const;
219
NumericLiteralIterator lastNumericLiteral() const;
221
const StringLiteral *findOrInsertStringLiteral(const char *chars, unsigned size);
222
const StringLiteral *findOrInsertStringLiteral(const char *chars);
224
const NumericLiteral *findOrInsertNumericLiteral(const char *chars, unsigned size);
225
const NumericLiteral *findOrInsertNumericLiteral(const char *chars);
233
} // end of namespace CPlusPlus
236
#endif // CPLUSPLUS_CONTROL_H