~ubuntu-branches/ubuntu/quantal/qtmobility/quantal

« back to all changes in this revision

Viewing changes to tools/icheck/parser/src/shared/cplusplus/Control.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-11-16 16:18:07 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20101116161807-k2dzt2nyse975r3l
Tags: 1.1.0-0ubuntu1
* New upstream release
* Syncronise with Debian, no remaining changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************
2
 
**
3
 
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
 
** All rights reserved.
5
 
** Contact: Nokia Corporation (qt-info@nokia.com)
6
 
**
7
 
** This file is part of the Qt Mobility Components.
8
 
**
9
 
** $QT_BEGIN_LICENSE:LGPL$
10
 
** Commercial Usage
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.
15
 
**
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.
23
 
**
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.
27
 
**
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.
35
 
**
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.
41
 
**
42
 
** If you are unsure which license is appropriate for your use, please
43
 
** contact the sales department at qt-sales@nokia.com.
44
 
** $QT_END_LICENSE$
45
 
**
46
 
****************************************************************************/
47
 
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com>
48
 
//
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:
55
 
//
56
 
// The above copyright notice and this permission notice shall be included in
57
 
// all copies or substantial portions of the Software.
58
 
//
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
65
 
// THE SOFTWARE.
66
 
 
67
 
#ifndef CPLUSPLUS_CONTROL_H
68
 
#define CPLUSPLUS_CONTROL_H
69
 
 
70
 
#include "CPlusPlusForwardDeclarations.h"
71
 
 
72
 
namespace CPlusPlus {
73
 
 
74
 
class CPLUSPLUS_EXPORT Control
75
 
{
76
 
public:
77
 
    Control();
78
 
    ~Control();
79
 
 
80
 
    TranslationUnit *translationUnit() const;
81
 
    TranslationUnit *switchTranslationUnit(TranslationUnit *unit);
82
 
 
83
 
    DiagnosticClient *diagnosticClient() const;
84
 
    void setDiagnosticClient(DiagnosticClient *diagnosticClient);
85
 
 
86
 
    /// Returns the canonical name id.
87
 
    const NameId *nameId(const Identifier *id);
88
 
 
89
 
    /// Returns the canonical template name id.
90
 
    const TemplateNameId *templateNameId(const Identifier *id,
91
 
                                         const FullySpecifiedType *const args = 0,
92
 
                                         unsigned argc = 0);
93
 
 
94
 
    /// Returns the canonical destructor name id.
95
 
    const DestructorNameId *destructorNameId(const Identifier *id);
96
 
 
97
 
    /// Returns the canonical operator name id.
98
 
    const OperatorNameId *operatorNameId(int operatorId);
99
 
 
100
 
    /// Returns the canonical conversion name id.
101
 
    const ConversionNameId *conversionNameId(const FullySpecifiedType &type);
102
 
 
103
 
    /// Returns the canonical qualified name id.
104
 
    const QualifiedNameId *qualifiedNameId(const Name *const *names,
105
 
                                           unsigned nameCount,
106
 
                                           bool isGlobal = false);
107
 
 
108
 
    const SelectorNameId *selectorNameId(const Name *const *names,
109
 
                                         unsigned nameCount,
110
 
                                         bool hasArguments);
111
 
 
112
 
    /// Returns a Type object of type VoidType.
113
 
    VoidType *voidType();
114
 
 
115
 
    /// Returns a Type object of type IntegerType.
116
 
    IntegerType *integerType(int integerId);
117
 
 
118
 
    /// Returns a Type object of type FloatType.
119
 
    FloatType *floatType(int floatId);
120
 
 
121
 
    /// Returns a Type object of type PointertoMemberType.
122
 
    PointerToMemberType *pointerToMemberType(const Name *memberName,
123
 
                                             const FullySpecifiedType &elementType);
124
 
 
125
 
    /// Returns a Type object of type PointerType.
126
 
    PointerType *pointerType(const FullySpecifiedType &elementType);
127
 
 
128
 
    /// Returns a Type object of type ReferenceType.
129
 
    ReferenceType *referenceType(const FullySpecifiedType &elementType);
130
 
 
131
 
    /// Retruns a Type object of type ArrayType.
132
 
    ArrayType *arrayType(const FullySpecifiedType &elementType, unsigned size = 0);
133
 
 
134
 
    /// Returns a Type object of type NamedType.
135
 
    NamedType *namedType(const Name *name);
136
 
 
137
 
    /// Creates a new Declaration symbol.
138
 
    Declaration *newDeclaration(unsigned sourceLocation, const Name *name);
139
 
 
140
 
    /// Creates a new Argument symbol.
141
 
    Argument *newArgument(unsigned sourceLocation, const Name *name = 0);
142
 
 
143
 
    /// Creates a new Argument symbol.
144
 
    TypenameArgument *newTypenameArgument(unsigned sourceLocation, const Name *name = 0);
145
 
 
146
 
    /// Creates a new Function symbol.
147
 
    Function *newFunction(unsigned sourceLocation, const Name *name = 0);
148
 
 
149
 
    /// Creates a new Namespace symbol.
150
 
    Namespace *newNamespace(unsigned sourceLocation, const Name *name = 0);
151
 
 
152
 
    /// Creates a new BaseClass symbol.
153
 
    BaseClass *newBaseClass(unsigned sourceLocation, const Name *name = 0);
154
 
 
155
 
    /// Creates a new Class symbol.
156
 
    Class *newClass(unsigned sourceLocation, const Name *name = 0);
157
 
 
158
 
    /// Creates a new Enum symbol.
159
 
    Enum *newEnum(unsigned sourceLocation, const Name *name = 0);
160
 
 
161
 
    /// Creates a new Block symbol.
162
 
    Block *newBlock(unsigned sourceLocation);
163
 
 
164
 
    /// Creates a new UsingNamespaceDirective symbol.
165
 
    UsingNamespaceDirective *newUsingNamespaceDirective(unsigned sourceLocation, const Name *name = 0);
166
 
 
167
 
    /// Creates a new UsingDeclaration symbol.
168
 
    UsingDeclaration *newUsingDeclaration(unsigned sourceLocation, const Name *name = 0);
169
 
 
170
 
    /// Creates a new ForwardClassDeclaration symbol.
171
 
    ForwardClassDeclaration *newForwardClassDeclaration(unsigned sourceLocation, const Name *name = 0);
172
 
 
173
 
    ObjCBaseClass *newObjCBaseClass(unsigned sourceLocation, const Name *name);
174
 
    ObjCBaseProtocol *newObjCBaseProtocol(unsigned sourceLocation, const Name *name);
175
 
 
176
 
    /// Creates a new Objective-C class symbol.
177
 
    ObjCClass *newObjCClass(unsigned sourceLocation, const Name *name = 0);
178
 
 
179
 
    /// Creates a new Objective-C class forward declaration symbol.
180
 
    ObjCForwardClassDeclaration *newObjCForwardClassDeclaration(unsigned sourceLocation, const Name *name = 0);
181
 
 
182
 
    /// Creates a new Objective-C protocol symbol.
183
 
    ObjCProtocol *newObjCProtocol(unsigned sourceLocation, const Name *name = 0);
184
 
 
185
 
    /// Creates a new Objective-C protocol forward declaration symbol.
186
 
    ObjCForwardProtocolDeclaration *newObjCForwardProtocolDeclaration(unsigned sourceLocation, const Name *name = 0);
187
 
 
188
 
    /// Creates a new Objective-C method symbol.
189
 
    ObjCMethod *newObjCMethod(unsigned sourceLocation, const Name *name = 0);
190
 
 
191
 
    /// Creates a new Objective-C @property declaration symbol.
192
 
    ObjCPropertyDeclaration *newObjCPropertyDeclaration(unsigned sourceLocation, const Name *name);
193
 
 
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;
203
 
 
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);
207
 
 
208
 
    typedef const Identifier *const *IdentifierIterator;
209
 
    typedef const StringLiteral *const *StringLiteralIterator;
210
 
    typedef const NumericLiteral *const *NumericLiteralIterator;
211
 
 
212
 
    IdentifierIterator firstIdentifier() const;
213
 
    IdentifierIterator lastIdentifier() const;
214
 
 
215
 
    StringLiteralIterator firstStringLiteral() const;
216
 
    StringLiteralIterator lastStringLiteral() const;
217
 
 
218
 
    NumericLiteralIterator firstNumericLiteral() const;
219
 
    NumericLiteralIterator lastNumericLiteral() const;
220
 
 
221
 
    const StringLiteral *findOrInsertStringLiteral(const char *chars, unsigned size);
222
 
    const StringLiteral *findOrInsertStringLiteral(const char *chars);
223
 
 
224
 
    const NumericLiteral *findOrInsertNumericLiteral(const char *chars, unsigned size);
225
 
    const NumericLiteral *findOrInsertNumericLiteral(const char *chars);
226
 
 
227
 
private:
228
 
    class Data;
229
 
    friend class Data;
230
 
    Data *d;
231
 
};
232
 
 
233
 
} // end of namespace CPlusPlus
234
 
 
235
 
 
236
 
#endif // CPLUSPLUS_CONTROL_H