Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef _IDLC_IDLCTYPES_HXX_
20 : #define _IDLC_IDLCTYPES_HXX_
21 :
22 : #include <stdio.h>
23 :
24 : #include <boost/unordered_map.hpp>
25 : #include <list>
26 : #include <vector>
27 : #include <string>
28 : #include <set>
29 :
30 : #include <sal/types.h>
31 : #include <rtl/ustring.hxx>
32 :
33 : struct EqualString
34 : {
35 987 : bool operator()(const OString& str1, const OString& str2) const
36 : {
37 987 : return (str1 == str2);
38 : }
39 : };
40 :
41 : struct HashString
42 : {
43 3617 : sal_Int32 operator()(const OString& str) const
44 : {
45 3617 : return str.hashCode();
46 : }
47 : };
48 :
49 : struct LessString
50 : {
51 658 : bool operator()(const OString& str1, const OString& str2) const
52 : {
53 658 : return (str1 < str2);
54 : }
55 : };
56 :
57 : typedef ::std::list< OString > StringList;
58 : typedef ::std::vector< OString > StringVector;
59 : typedef ::std::set< OString, LessString > StringSet;
60 :
61 : class AstDeclaration;
62 :
63 : typedef ::boost::unordered_map< OString, AstDeclaration*, HashString, EqualString > DeclMap;
64 : typedef ::std::list< AstDeclaration* > DeclList;
65 :
66 : class AstScope;
67 : AstDeclaration* SAL_CALL scopeAsDecl(AstScope* pScope);
68 : AstScope* SAL_CALL declAsScope(AstDeclaration* pDecl);
69 :
70 : #ifdef _MSC_VER
71 : #pragma warning( disable : 4541 )
72 : #endif
73 :
74 : // flags used for attributes, properties and services
75 : #define AF_INVALID 0x0000
76 : #define AF_READONLY 0x0001
77 : #define AF_OPTIONAL 0x0002
78 : #define AF_MAYBEVOID 0x0004
79 : #define AF_BOUND 0x0008
80 : #define AF_CONSTRAINED 0x0010
81 : #define AF_TRANSIENT 0x0020
82 : #define AF_MAYBEAMBIGUOUS 0x0040
83 : #define AF_MAYBEDEFAULT 0x0080
84 : #define AF_REMOVABLE 0x0100
85 : #define AF_ATTRIBUTE 0x0200
86 : #define AF_PROPERTY 0x0400
87 :
88 : enum ParseState
89 : {
90 : PS_NoState,
91 : PS_TypeDeclSeen, // Seen complete typedef declaration
92 : PS_ConstantDeclSeen, // Seen complete const declaration
93 : PS_ExceptionDeclSeen, // Seen complete exception declaration
94 : PS_InterfaceDeclSeen, // Seen complete interface declaration
95 : PS_ServiceDeclSeen, // Seen complete service declaration
96 : PS_SingletonDeclSeen, // Seen complete singleton declaration
97 : PS_ModuleDeclSeen, // Seen complete module declaration
98 : PS_AttributeDeclSeen, // Seen complete attribute declaration
99 : PS_PropertyDeclSeen, // Seen complete property declaration
100 : PS_OperationDeclSeen, // Seen complete operation declaration
101 : PS_InterfaceInheritanceDeclSeen, // Seen complete interface inheritance decl
102 : PS_ConstantsDeclSeen, // Seen complete constants declaration
103 :
104 : PS_ServiceSeen, // Seen a SERVICE keyword
105 : PS_ServiceIDSeen, // Seen the service ID
106 : PS_ServiceSqSeen, // '{' seen for service
107 : PS_ServiceQsSeen, // '}' seen for service
108 : PS_ServiceBodySeen, // Seen complete service body
109 : PS_ServiceMemberSeen, // Seen a service member
110 : PS_ServiceIFHeadSeen, // Seen an interface member header
111 : PS_ServiceSHeadSeen, // Seen an service member header
112 :
113 : PS_SingletonSeen, // Seen a SINGLETON keyword
114 : PS_SingletonIDSeen, // Seen the singleton ID
115 : PS_SingletonSqSeen, // '{' seen for singleton
116 : PS_SingletonQsSeen, // '}' seen for singleton
117 : PS_SingletonBodySeen, // Seen complete singleton body
118 : PS_SingletonMemberSeen, // Seen a singleton member
119 :
120 : PS_ModuleSeen, // Seen a MODULE keyword
121 : PS_ModuleIDSeen, // Seen the module ID
122 : PS_ModuleSqSeen, // '{' seen for module
123 : PS_ModuleQsSeen, // '}' seen for module
124 : PS_ModuleBodySeen, // Seen complete module body
125 :
126 : PS_ConstantsSeen, // Seen a CONSTANTS keyword
127 : PS_ConstantsIDSeen, // Seen the constants ID
128 : PS_ConstantsSqSeen, // '{' seen for constants
129 : PS_ConstantsQsSeen, // '}' seen for constants
130 : PS_ConstantsBodySeen, // Seen complete constants body
131 :
132 : PS_InterfaceSeen, // Seen an INTERFACE keyword
133 : PS_InterfaceIDSeen, // Seen the interface ID
134 : PS_InterfaceHeadSeen, // Seen the interface head
135 : PS_InheritSpecSeen, // Seen a complete inheritance spec
136 : PS_ForwardDeclSeen, // Forward interface decl seen
137 : PS_InterfaceSqSeen, // '{' seen for interface
138 : PS_InterfaceQsSeen, // '}' seen for interface
139 : PS_InterfaceBodySeen, // Seen an interface body
140 : PS_InheritColonSeen, // Seen ':' in inheritance list
141 :
142 : PS_SNListCommaSeen, // Seen ',' in list of scoped names
143 : PS_ScopedNameSeen, // Seen a complete scoped name
144 : PS_SN_IDSeen, // Seen an identifier as part of a scoped name
145 : PS_ScopeDelimSeen, // Seen a scope delim as party of a scoped name
146 :
147 : PS_ConstSeen, // Seen a CONST keyword
148 : PS_ConstTypeSeen, // Parsed the type of a constant
149 : PS_ConstIDSeen, // Seen the constant ID
150 : PS_ConstAssignSeen, // Seen the '='
151 : PS_ConstExprSeen, // Seen the constant value expression
152 :
153 : PS_TypedefSeen, // Seen a TYPEDEF keyword
154 : PS_TypeSpecSeen, // Seen a complete type specification
155 : PS_DeclaratorsSeen, // Seen a complete list of declarators
156 :
157 : PS_StructSeen, // Seen a STRUCT keyword
158 : PS_StructHeaderSeen, // Seen struct header
159 : PS_StructIDSeen, // Seen the struct ID
160 : PS_StructSqSeen, // '{' seen for struct
161 : PS_StructQsSeen, // '}' seen for struct
162 : PS_StructBodySeen, // Seen complete body of struct decl
163 :
164 : PS_MemberTypeSeen, // Seen type of struct or except member
165 : PS_MemberDeclsSeen, // Seen decls of struct or except members
166 : PS_MemberDeclsCompleted,// Completed one struct or except member to ';'
167 :
168 : PS_EnumSeen, // Seen an ENUM keyword
169 : PS_EnumIDSeen, // Seen the enum ID
170 : PS_EnumSqSeen, // Seen '{' for enum
171 : PS_EnumQsSeen, // Seen '}' for enum
172 : PS_EnumBodySeen, // Seen complete enum body
173 : PS_EnumCommaSeen, // Seen ',' in list of enumerators
174 :
175 : PS_SequenceSeen, // Seen a SEQUENCE keyword
176 : PS_SequenceSqSeen, // Seen '<' for sequence
177 : PS_SequenceQsSeen, // Seen '>' for sequence
178 : PS_SequenceTypeSeen, // Seen type decl for sequence
179 :
180 : PS_FlagHeaderSeen, // Seen the attribute|property|interface member head
181 : PS_AttrSeen, // Seen ATTRIBUTE keyword
182 : PS_AttrTypeSeen, // Seen type decl for attribute
183 : PS_AttrCompleted, // Seen complete attribute declaration
184 : PS_ReadOnlySeen, // Seen READONLY keyword
185 : PS_OptionalSeen, // Seen OPTIONAL keyword
186 : PS_MayBeVoidSeen, // Seen MAYBEVOID yword
187 : PS_BoundSeen, // Seen BOUND keyword
188 : PS_ConstrainedSeen, // Seen CONSTRAINED keyword
189 : PS_TransientSeen, // Seen TRANSIENT keyword
190 : PS_MayBeAmbigiousSeen, // Seen MAYBEAMBIGIOUS keyword
191 : PS_MayBeDefaultSeen, // Seen MAYBEDEFAULT keyword
192 : PS_RemoveableSeen, // Seen REMOVABLE keyword
193 :
194 : PS_PropertySeen, // Seen PROPERTY keyword
195 : PS_PropertyTypeSeen, // Seen type decl for property
196 : PS_PropertyCompleted, // Seen complete property declaration
197 :
198 : PS_ExceptSeen, // Seen EXCEPTION keyword
199 : PS_ExceptHeaderSeen, // Seen exception header keyword
200 : PS_ExceptIDSeen, // Seen exception identifier
201 : PS_ExceptSqSeen, // Seen '{' for exception
202 : PS_ExceptQsSeen, // Seen '}' for exception
203 : PS_ExceptBodySeen, // Seen complete exception body
204 :
205 : PS_OpTypeSeen, // Seen operation return type
206 : PS_OpIDSeen, // Seen operation ID
207 : PS_OpParsCompleted, // Completed operation param list
208 : PS_OpCompleted, // Completed operation statement
209 : PS_OpSqSeen, // Seen '(' for operation
210 : PS_OpQsSeen, // Seen ')' for operation
211 : PS_OpParCommaSeen, // Seen ',' in list of op params
212 : PS_OpParDirSeen, // Seen parameter direction
213 : PS_OpParTypeSeen, // Seen parameter type
214 : PS_OpParDeclSeen, // Seen parameter declaration
215 :
216 : PS_RaiseSeen, // Seen RAISES keyword
217 : PS_RaiseSqSeen, // Seen '(' for RAISES
218 : PS_RaiseQsSeen, // Seen ')' for RAISES
219 :
220 : PS_DeclsCommaSeen, // Seen ',' in declarators list
221 : PS_DeclsDeclSeen // Seen complete decl in decls list
222 : };
223 :
224 : #endif // _IDLC_IDLCTYPES_HXX_
225 :
226 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|