xref: /aoo4110/main/idlc/inc/idlc/astscope.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 #ifndef _IDLC_ASTSCOPE_HXX_
24 #define _IDLC_ASTSCOPE_HXX_
25 
26 #include <idlc/idlc.hxx>
27 
28 class AstExpression;
29 #include <idlc/astdeclaration.hxx>
30 #include <idlc/astexpression.hxx>
31 
32 class AstScope
33 {
34 public:
35 	AstScope(NodeType nodeType);
36 	virtual ~AstScope();
37 
getScopeNodeType() const38 	NodeType getScopeNodeType() const
39 		{ return m_nodeType; }
40 
41 	virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl);
42 
nMembers() const43 	sal_uInt32 nMembers() const
44 		{ return (sal_uInt32)(m_declarations.size()); }
getIteratorBegin() const45 	DeclList::const_iterator getIteratorBegin() const
46 		{ return m_declarations.begin(); }
getIteratorEnd() const47 	DeclList::const_iterator getIteratorEnd() const
48 		{ return m_declarations.end(); }
49 	sal_uInt16 getNodeCount(NodeType nType);
50 
51 	// Name look up mechanism
52 	AstDeclaration* lookupByName(const ::rtl::OString& scopedName);
53 	// Look up the identifier 'name' specified only in the local scope
54 	AstDeclaration* lookupByNameLocal(const ::rtl::OString& name) const;
55 
56 	AstDeclaration* lookupInForwarded(const ::rtl::OString& scopedName);
57 	AstDeclaration* lookupInInherited(const ::rtl::OString& scopedName) const;
58 
59 	// Look up a predefined type by its ExprType
60 	AstDeclaration* lookupPrimitiveType(ExprType type);
61 
62 	AstDeclaration* lookupForAdd(AstDeclaration* pDecl);
63 
64 protected:
getLast() const65     inline AstDeclaration const * getLast() const
66     { return m_declarations.back(); }
67 
68 private:
69 	DeclList	m_declarations;
70 	NodeType 	m_nodeType;
71 };
72 
73 #endif // _IDLC_ASTSCOPE_HXX_
74 
75