Branch data 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_ASTSCOPE_HXX_
20 : : #define _IDLC_ASTSCOPE_HXX_
21 : :
22 : : #include <idlc/idlc.hxx>
23 : :
24 : : class AstExpression;
25 : : #include <idlc/astdeclaration.hxx>
26 : : #include <idlc/astexpression.hxx>
27 : :
28 : 116 : class AstScope
29 : : {
30 : : public:
31 : : AstScope(NodeType nodeType);
32 : : virtual ~AstScope();
33 : :
34 : 2566837 : NodeType getScopeNodeType() const
35 : 2566837 : { return m_nodeType; }
36 : :
37 : : virtual AstDeclaration* addDeclaration(AstDeclaration* pDecl);
38 : :
39 : 123 : sal_uInt32 nMembers() const
40 : 123 : { return (sal_uInt32)(m_declarations.size()); }
41 : 303004 : DeclList::const_iterator getIteratorBegin() const
42 : 303004 : { return m_declarations.begin(); }
43 : 466416 : DeclList::const_iterator getIteratorEnd() const
44 : 466416 : { return m_declarations.end(); }
45 : : sal_uInt16 getNodeCount(NodeType nType);
46 : :
47 : : // Name look up mechanism
48 : : AstDeclaration* lookupByName(const ::rtl::OString& scopedName);
49 : : // Look up the identifier 'name' specified only in the local scope
50 : : AstDeclaration* lookupByNameLocal(const ::rtl::OString& name) const;
51 : :
52 : : AstDeclaration* lookupInForwarded(const ::rtl::OString& scopedName);
53 : : AstDeclaration* lookupInInherited(const ::rtl::OString& scopedName) const;
54 : :
55 : : // Look up a predefined type by its ExprType
56 : : AstDeclaration* lookupPrimitiveType(ExprType type);
57 : :
58 : : AstDeclaration* lookupForAdd(AstDeclaration* pDecl);
59 : :
60 : : protected:
61 : 250 : inline AstDeclaration const * getLast() const
62 : 250 : { return m_declarations.back(); }
63 : :
64 : : private:
65 : : DeclList m_declarations;
66 : : NodeType m_nodeType;
67 : : };
68 : :
69 : : #endif // _IDLC_ASTSCOPE_HXX_
70 : :
71 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|