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_ASTDECLARATION_HXX_
20 : #define _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_union, // Denotes a union
47 : NT_union_branch, // Denotes a union branch
48 : NT_struct, // Denotes either a plain struct type, or a
49 : // polymorphic struct type template
50 : NT_type_parameter, // Denotes a type parameter of a polymorphic struct
51 : // type template
52 : NT_instantiated_struct, // Denotes an instantiated polymorphic struct type
53 : NT_member, // Denotes a member in structure, exception
54 : NT_enum, // Denotes an enumeration
55 : NT_enum_val, // Denotes an enum. value
56 : NT_array, // Denotes an IDL array
57 : NT_sequence, // Denotes an IDL sequence
58 : NT_typedef, // Denotes a typedef
59 : NT_predefined, // Denotes a predefined type
60 : NT_singleton // Denotes a singleton
61 : };
62 :
63 96 : class AstDeclaration
64 : {
65 : public:
66 : // Constructors
67 : AstDeclaration(NodeType type, const ::rtl::OString& name, AstScope* pScope);
68 : virtual ~AstDeclaration();
69 :
70 : // Data access
71 : void setName(const ::rtl::OString& name);
72 15030713 : const ::rtl::OString& getLocalName() const
73 15030713 : { return m_localName; }
74 902603 : const ::rtl::OString& getScopedName() const
75 902603 : { return m_scopedName; }
76 26122 : const ::rtl::OString& getFullName()
77 26122 : { return m_fullName; }
78 59403 : virtual const sal_Char* getRelativName() const
79 59403 : { return m_fullName.getStr()+1; }
80 1005133 : AstScope* getScope()
81 1005133 : { return m_pScope; }
82 : void setScope(AstScope* pSc)
83 : { m_pScope = pSc; }
84 1833195 : NodeType getNodeType() const
85 1833195 : { return m_nodeType; }
86 162870 : sal_Bool isInMainfile() const
87 162870 : { return m_bInMainFile; }
88 209916 : void setInMainfile(sal_Bool bInMainfile)
89 209916 : { m_bInMainFile = bInMainfile; }
90 880 : sal_Bool isImported() const
91 880 : { return m_bImported; }
92 880 : void setImported(sal_Bool bImported)
93 880 : { m_bImported = bImported; }
94 880 : sal_Int32 getLineNumber() const
95 880 : { return m_lineNumber; }
96 880 : void setLineNumber(sal_Int32 lineNumber)
97 880 : { m_lineNumber = lineNumber; }
98 209916 : const ::rtl::OString& getFileName() const
99 209916 : { return m_fileName; }
100 209916 : void setFileName(const ::rtl::OString& rFileName)
101 209916 : { m_fileName = rFileName; }
102 61344 : const ::rtl::OUString& getDocumentation() const
103 61344 : { return m_documentation; }
104 880 : void setDocumentation(const ::rtl::OUString& rDocumentation)
105 880 : { m_documentation = rDocumentation; }
106 : sal_Bool isAdded()
107 : { return m_bIsAdded; }
108 : void markAsAdded()
109 : { m_bIsAdded = sal_True; }
110 :
111 : virtual bool isType() const;
112 :
113 : sal_Bool hasAncestor(AstDeclaration* pDecl);
114 :
115 138 : void setPublished() { m_bPublished = true; }
116 138960 : bool isPublished() const { return m_bPublished; }
117 :
118 : virtual sal_Bool dump(RegistryKey& rKey);
119 :
120 209132 : bool isPredefined() { return m_bPredefined; }
121 : void setPredefined(bool bPredefined);
122 :
123 : protected:
124 : ::rtl::OString m_localName;
125 : ::rtl::OString m_scopedName; // full qualified name
126 : ::rtl::OString m_fullName; // full qualified name with '/' as seperator
127 : AstScope* m_pScope;
128 : NodeType m_nodeType;
129 : sal_Bool m_bImported; // imported ?
130 : sal_Bool m_bIsAdded; // mark declaration as added in scope
131 : sal_Bool m_bInMainFile; // defined in main file
132 : bool m_bPublished;
133 : bool m_bPredefined;
134 : sal_Int32 m_lineNumber; // line number defined in
135 : ::rtl::OString m_fileName; // fileName defined in
136 : ::rtl::OUString m_documentation; // fileName defined in
137 : };
138 :
139 : #endif // _IDLC_ASTDECLARATION_HXX_
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|