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 INCLUDED_IDLC_INC_IDLC_IDLCTYPES_HXX
20 : #define INCLUDED_IDLC_INC_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 LessString
34 : {
35 1316 : bool operator()(const OString& str1, const OString& str2) const
36 : {
37 1316 : return (str1 < str2);
38 : }
39 : };
40 :
41 : typedef ::std::list< OString > StringList;
42 : typedef ::std::vector< OString > StringVector;
43 : typedef ::std::set< OString, LessString > StringSet;
44 :
45 : class AstDeclaration;
46 :
47 : typedef ::boost::unordered_map< OString, AstDeclaration*, OStringHash > DeclMap;
48 : typedef ::std::list< AstDeclaration* > DeclList;
49 :
50 : class AstScope;
51 : AstDeclaration* SAL_CALL scopeAsDecl(AstScope* pScope);
52 : AstScope* SAL_CALL declAsScope(AstDeclaration* pDecl);
53 :
54 : #ifdef _MSC_VER
55 : #pragma warning( disable : 4541 )
56 : #endif
57 :
58 : // flags used for attributes, properties and services
59 : #define AF_INVALID 0x0000
60 : #define AF_READONLY 0x0001
61 : #define AF_OPTIONAL 0x0002
62 : #define AF_MAYBEVOID 0x0004
63 : #define AF_BOUND 0x0008
64 : #define AF_CONSTRAINED 0x0010
65 : #define AF_TRANSIENT 0x0020
66 : #define AF_MAYBEAMBIGUOUS 0x0040
67 : #define AF_MAYBEDEFAULT 0x0080
68 : #define AF_REMOVABLE 0x0100
69 : #define AF_ATTRIBUTE 0x0200
70 : #define AF_PROPERTY 0x0400
71 :
72 : enum ParseState
73 : {
74 : PS_NoState,
75 : PS_TypeDeclSeen, // Seen complete typedef declaration
76 : PS_ConstantDeclSeen, // Seen complete const declaration
77 : PS_ExceptionDeclSeen, // Seen complete exception declaration
78 : PS_InterfaceDeclSeen, // Seen complete interface declaration
79 : PS_ServiceDeclSeen, // Seen complete service declaration
80 : PS_SingletonDeclSeen, // Seen complete singleton declaration
81 : PS_ModuleDeclSeen, // Seen complete module declaration
82 : PS_AttributeDeclSeen, // Seen complete attribute declaration
83 : PS_PropertyDeclSeen, // Seen complete property declaration
84 : PS_OperationDeclSeen, // Seen complete operation declaration
85 : PS_InterfaceInheritanceDeclSeen, // Seen complete interface inheritance decl
86 : PS_ConstantsDeclSeen, // Seen complete constants declaration
87 :
88 : PS_ServiceSeen, // Seen a SERVICE keyword
89 : PS_ServiceIDSeen, // Seen the service ID
90 : PS_ServiceSqSeen, // '{' seen for service
91 : PS_ServiceQsSeen, // '}' seen for service
92 : PS_ServiceBodySeen, // Seen complete service body
93 : PS_ServiceMemberSeen, // Seen a service member
94 : PS_ServiceIFHeadSeen, // Seen an interface member header
95 : PS_ServiceSHeadSeen, // Seen an service member header
96 :
97 : PS_SingletonSeen, // Seen a SINGLETON keyword
98 : PS_SingletonIDSeen, // Seen the singleton ID
99 : PS_SingletonSqSeen, // '{' seen for singleton
100 : PS_SingletonQsSeen, // '}' seen for singleton
101 : PS_SingletonBodySeen, // Seen complete singleton body
102 : PS_SingletonMemberSeen, // Seen a singleton member
103 :
104 : PS_ModuleSeen, // Seen a MODULE keyword
105 : PS_ModuleIDSeen, // Seen the module ID
106 : PS_ModuleSqSeen, // '{' seen for module
107 : PS_ModuleQsSeen, // '}' seen for module
108 : PS_ModuleBodySeen, // Seen complete module body
109 :
110 : PS_ConstantsSeen, // Seen a CONSTANTS keyword
111 : PS_ConstantsIDSeen, // Seen the constants ID
112 : PS_ConstantsSqSeen, // '{' seen for constants
113 : PS_ConstantsQsSeen, // '}' seen for constants
114 : PS_ConstantsBodySeen, // Seen complete constants body
115 :
116 : PS_InterfaceSeen, // Seen an INTERFACE keyword
117 : PS_InterfaceIDSeen, // Seen the interface ID
118 : PS_InterfaceHeadSeen, // Seen the interface head
119 : PS_InheritSpecSeen, // Seen a complete inheritance spec
120 : PS_ForwardDeclSeen, // Forward interface decl seen
121 : PS_InterfaceSqSeen, // '{' seen for interface
122 : PS_InterfaceQsSeen, // '}' seen for interface
123 : PS_InterfaceBodySeen, // Seen an interface body
124 : PS_InheritColonSeen, // Seen ':' in inheritance list
125 :
126 : PS_SNListCommaSeen, // Seen ',' in list of scoped names
127 : PS_ScopedNameSeen, // Seen a complete scoped name
128 : PS_SN_IDSeen, // Seen an identifier as part of a scoped name
129 : PS_ScopeDelimSeen, // Seen a scope delim as party of a scoped name
130 :
131 : PS_ConstSeen, // Seen a CONST keyword
132 : PS_ConstTypeSeen, // Parsed the type of a constant
133 : PS_ConstIDSeen, // Seen the constant ID
134 : PS_ConstAssignSeen, // Seen the '='
135 : PS_ConstExprSeen, // Seen the constant value expression
136 :
137 : PS_TypedefSeen, // Seen a TYPEDEF keyword
138 : PS_TypeSpecSeen, // Seen a complete type specification
139 : PS_DeclaratorsSeen, // Seen a complete list of declarators
140 :
141 : PS_StructSeen, // Seen a STRUCT keyword
142 : PS_StructHeaderSeen, // Seen struct header
143 : PS_StructIDSeen, // Seen the struct ID
144 : PS_StructSqSeen, // '{' seen for struct
145 : PS_StructQsSeen, // '}' seen for struct
146 : PS_StructBodySeen, // Seen complete body of struct decl
147 :
148 : PS_MemberTypeSeen, // Seen type of struct or except member
149 : PS_MemberDeclsSeen, // Seen decls of struct or except members
150 : PS_MemberDeclsCompleted,// Completed one struct or except member to ';'
151 :
152 : PS_EnumSeen, // Seen an ENUM keyword
153 : PS_EnumIDSeen, // Seen the enum ID
154 : PS_EnumSqSeen, // Seen '{' for enum
155 : PS_EnumQsSeen, // Seen '}' for enum
156 : PS_EnumBodySeen, // Seen complete enum body
157 : PS_EnumCommaSeen, // Seen ',' in list of enumerators
158 :
159 : PS_SequenceSeen, // Seen a SEQUENCE keyword
160 : PS_SequenceSqSeen, // Seen '<' for sequence
161 : PS_SequenceQsSeen, // Seen '>' for sequence
162 : PS_SequenceTypeSeen, // Seen type decl for sequence
163 :
164 : PS_FlagHeaderSeen, // Seen the attribute|property|interface member head
165 : PS_AttrSeen, // Seen ATTRIBUTE keyword
166 : PS_AttrTypeSeen, // Seen type decl for attribute
167 : PS_AttrCompleted, // Seen complete attribute declaration
168 : PS_ReadOnlySeen, // Seen READONLY keyword
169 : PS_OptionalSeen, // Seen OPTIONAL keyword
170 : PS_MayBeVoidSeen, // Seen MAYBEVOID yword
171 : PS_BoundSeen, // Seen BOUND keyword
172 : PS_ConstrainedSeen, // Seen CONSTRAINED keyword
173 : PS_TransientSeen, // Seen TRANSIENT keyword
174 : PS_MayBeAmbigiousSeen, // Seen MAYBEAMBIGIOUS keyword
175 : PS_MayBeDefaultSeen, // Seen MAYBEDEFAULT keyword
176 : PS_RemoveableSeen, // Seen REMOVABLE keyword
177 :
178 : PS_PropertySeen, // Seen PROPERTY keyword
179 : PS_PropertyTypeSeen, // Seen type decl for property
180 : PS_PropertyCompleted, // Seen complete property declaration
181 :
182 : PS_ExceptSeen, // Seen EXCEPTION keyword
183 : PS_ExceptHeaderSeen, // Seen exception header keyword
184 : PS_ExceptIDSeen, // Seen exception identifier
185 : PS_ExceptSqSeen, // Seen '{' for exception
186 : PS_ExceptQsSeen, // Seen '}' for exception
187 : PS_ExceptBodySeen, // Seen complete exception body
188 :
189 : PS_OpTypeSeen, // Seen operation return type
190 : PS_OpIDSeen, // Seen operation ID
191 : PS_OpParsCompleted, // Completed operation param list
192 : PS_OpCompleted, // Completed operation statement
193 : PS_OpSqSeen, // Seen '(' for operation
194 : PS_OpQsSeen, // Seen ')' for operation
195 : PS_OpParCommaSeen, // Seen ',' in list of op params
196 : PS_OpParDirSeen, // Seen parameter direction
197 : PS_OpParTypeSeen, // Seen parameter type
198 : PS_OpParDeclSeen, // Seen parameter declaration
199 :
200 : PS_RaiseSeen, // Seen RAISES keyword
201 : PS_RaiseSqSeen, // Seen '(' for RAISES
202 : PS_RaiseQsSeen, // Seen ')' for RAISES
203 :
204 : PS_DeclsCommaSeen, // Seen ',' in declarators list
205 : PS_DeclsDeclSeen // Seen complete decl in decls list
206 : };
207 :
208 : #endif // INCLUDED_IDLC_INC_IDLC_IDLCTYPES_HXX
209 :
210 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|