|
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 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
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 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 /* |
|
42 Copyright 2005 Roberto Raggi <roberto@kdevelop.org> |
|
43 |
|
44 Permission to use, copy, modify, distribute, and sell this software and its |
|
45 documentation for any purpose is hereby granted without fee, provided that |
|
46 the above copyright notice appear in all copies and that both that |
|
47 copyright notice and this permission notice appear in supporting |
|
48 documentation. |
|
49 |
|
50 The above copyright notice and this permission notice shall be included in |
|
51 all copies or substantial portions of the Software. |
|
52 |
|
53 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
54 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
55 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
56 KDEVELOP TEAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
|
57 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
|
58 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
59 */ |
|
60 |
|
61 #ifndef PP_MACRO_H |
|
62 #define PP_MACRO_H |
|
63 |
|
64 #include <CPlusPlusForwardDeclarations.h> |
|
65 |
|
66 #include <QByteArray> |
|
67 #include <QVector> |
|
68 #include <QString> |
|
69 |
|
70 namespace CPlusPlus { |
|
71 |
|
72 class CPLUSPLUS_EXPORT Macro |
|
73 { |
|
74 public: |
|
75 Macro(); |
|
76 |
|
77 QByteArray name() const |
|
78 { return _name; } |
|
79 |
|
80 void setName(const QByteArray &name) |
|
81 { _name = name; } |
|
82 |
|
83 QByteArray definition() const |
|
84 { return _definition; } |
|
85 |
|
86 void setDefinition(const QByteArray &definition) |
|
87 { _definition = definition; } |
|
88 |
|
89 QVector<QByteArray> formals() const |
|
90 { return _formals; } |
|
91 |
|
92 void addFormal(const QByteArray &formal) |
|
93 { _formals.append(formal); } |
|
94 |
|
95 QString fileName() const |
|
96 { return _fileName; } |
|
97 |
|
98 void setFileName(const QString &fileName) |
|
99 { _fileName = fileName; } |
|
100 |
|
101 unsigned line() const |
|
102 { return _line; } |
|
103 |
|
104 void setLine(unsigned line) |
|
105 { _line = line; } |
|
106 |
|
107 unsigned offset() const |
|
108 { return _offset; } |
|
109 |
|
110 void setOffset(unsigned offset) |
|
111 { _offset = offset; } |
|
112 |
|
113 unsigned length() const |
|
114 { return _length; } |
|
115 |
|
116 void setLength(unsigned length) |
|
117 { _length = length; } |
|
118 |
|
119 bool isHidden() const |
|
120 { return f._hidden; } |
|
121 |
|
122 void setHidden(bool isHidden) |
|
123 { f._hidden = isHidden; } |
|
124 |
|
125 bool isFunctionLike() const |
|
126 { return f._functionLike; } |
|
127 |
|
128 void setFunctionLike(bool isFunctionLike) |
|
129 { f._functionLike = isFunctionLike; } |
|
130 |
|
131 bool isVariadic() const |
|
132 { return f._variadic; } |
|
133 |
|
134 void setVariadic(bool isVariadic) |
|
135 { f._variadic = isVariadic; } |
|
136 |
|
137 QString toString() const; |
|
138 |
|
139 // ### private |
|
140 Macro *_next; |
|
141 unsigned _hashcode; |
|
142 |
|
143 private: |
|
144 struct Flags |
|
145 { |
|
146 unsigned _hidden: 1; |
|
147 unsigned _functionLike: 1; |
|
148 unsigned _variadic: 1; |
|
149 }; |
|
150 |
|
151 QByteArray _name; |
|
152 QByteArray _definition; |
|
153 QVector<QByteArray> _formals; |
|
154 QString _fileName; |
|
155 unsigned _line; |
|
156 unsigned _offset; |
|
157 unsigned _length; |
|
158 |
|
159 union |
|
160 { |
|
161 unsigned _state; |
|
162 Flags f; |
|
163 }; |
|
164 }; |
|
165 |
|
166 } // namespace CPlusPlus |
|
167 |
|
168 #endif // PP_MACRO_H |