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_ASTDECLARATION_HXX
20 : #define INCLUDED_IDLC_INC_IDLC_ASTDECLARATION_HXX
21 :
22 : #include <idlc/idlc.hxx>
23 : #include <registry/registry.hxx>
24 :
25 : class AstScope;
26 :
27 : // Enum defining the different kinds of Ast nodes
28 : enum NodeType
29 : {
30 : NT_object, // Denotes an object
31 : NT_service, // Denotes an servcie
32 : NT_interface_member, // Denotes an interface which is exported from object
33 : NT_service_member, // Denotes an service which is exported from object
34 : NT_observes, // Denotes an observed interface
35 : NT_needs, // Denotes an needed service
36 : NT_module, // Denotes a module
37 : NT_root, // Denotes the root of AST
38 : NT_interface, // Denotes an interface
39 : NT_constants, // Denotes a constant group
40 : NT_const, // Denotes a constant
41 : NT_exception, // Denotes an exception
42 : NT_attribute, // Denotes an attribute
43 : NT_property, // Denotes an property
44 : NT_operation, // Denotes an operation
45 : NT_parameter, // Denotes an op. parameter
46 : NT_struct, // Denotes either a plain struct type, or a
47 : // polymorphic struct type template
48 : NT_type_parameter, // Denotes a type parameter of a polymorphic struct
49 : // type template
50 : NT_instantiated_struct, // Denotes an instantiated polymorphic struct type
51 : NT_member, // Denotes a member in structure, exception
52 : NT_enum, // Denotes an enumeration
53 : NT_enum_val, // Denotes an enum. value
54 : NT_sequence, // Denotes an IDL sequence
55 : NT_typedef, // Denotes a typedef
56 : NT_predefined, // Denotes a predefined type
57 : NT_singleton // Denotes a singleton
58 : };
59 :
60 3 : class AstDeclaration
61 : {
62 : public:
63 : // Constructors
64 : AstDeclaration(NodeType type, const OString& name, AstScope* pScope);
65 : virtual ~AstDeclaration();
66 :
67 : // Data access
68 138734 : const OString& getLocalName() const
69 138734 : { return m_localName; }
70 15851 : const OString& getScopedName() const
71 15851 : { return m_scopedName; }
72 393 : const OString& getFullName()
73 393 : { return m_fullName; }
74 875 : virtual const sal_Char* getRelativName() const
75 875 : { return m_fullName.getStr()+1; }
76 2554 : AstScope* getScope()
77 2554 : { return m_pScope; }
78 0 : const AstScope* getScope() const
79 0 : { return m_pScope; }
80 : void setScope(AstScope* pSc)
81 : { m_pScope = pSc; }
82 11681 : NodeType getNodeType() const
83 11681 : { return m_nodeType; }
84 2859 : bool isInMainfile() const
85 2859 : { return m_bInMainFile; }
86 110 : void setInMainfile(bool bInMainfile)
87 110 : { m_bInMainFile = bInMainfile; }
88 3 : bool isImported() const
89 3 : { return m_bImported; }
90 3 : void setImported(bool bImported)
91 3 : { m_bImported = bImported; }
92 3 : sal_Int32 getLineNumber() const
93 3 : { return m_lineNumber; }
94 3 : void setLineNumber(sal_Int32 lineNumber)
95 3 : { m_lineNumber = lineNumber; }
96 110 : const OString& getFileName() const
97 110 : { return m_fileName; }
98 110 : void setFileName(const OString& rFileName)
99 110 : { m_fileName = rFileName; }
100 973 : const OUString& getDocumentation() const
101 973 : { return m_documentation; }
102 3 : void setDocumentation(const OUString& rDocumentation)
103 3 : { m_documentation = rDocumentation; }
104 : bool isAdded()
105 : { return m_bIsAdded; }
106 : void markAsAdded()
107 : { m_bIsAdded = true; }
108 :
109 : virtual bool isType() const;
110 :
111 : bool hasAncestor(AstDeclaration* pDecl);
112 :
113 329 : void setPublished() { m_bPublished = true; }
114 112 : bool isPublished() const { return m_bPublished; }
115 :
116 : virtual bool dump(RegistryKey& rKey);
117 :
118 110 : bool isPredefined() { return m_bPredefined; }
119 : void setPredefined(bool bPredefined);
120 :
121 : protected:
122 : OString m_localName;
123 : OString m_scopedName; // full qualified name
124 : OString m_fullName; // full qualified name with '/' as separator
125 : AstScope* m_pScope;
126 : NodeType m_nodeType;
127 : bool m_bImported; // imported ?
128 : bool m_bIsAdded; // mark declaration as added in scope
129 : bool m_bInMainFile; // defined in main file
130 : bool m_bPublished;
131 : bool m_bPredefined;
132 : sal_Int32 m_lineNumber; // line number defined in
133 : OString m_fileName; // fileName defined in
134 : OUString m_documentation; // fileName defined in
135 : };
136 :
137 : #endif // INCLUDED_IDLC_INC_IDLC_ASTDECLARATION_HXX
138 :
139 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|