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_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 : 116 : 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 : 17422431 : const ::rtl::OString& getLocalName() const
73 : 17422431 : { return m_localName; }
74 : 1047865 : const ::rtl::OString& getScopedName() const
75 : 1047865 : { return m_scopedName; }
76 : 30290 : const ::rtl::OString& getFullName()
77 : 30290 : { return m_fullName; }
78 : 69338 : virtual const sal_Char* getRelativName() const
79 : 69338 : { return m_fullName.getStr()+1; }
80 : 1154520 : AstScope* getScope()
81 : 1154520 : { return m_pScope; }
82 : : void setScope(AstScope* pSc)
83 : : { m_pScope = pSc; }
84 : 2200120 : NodeType getNodeType() const
85 : 2200120 : { return m_nodeType; }
86 : 185881 : sal_Bool isInMainfile() const
87 : 185881 : { return m_bInMainFile; }
88 : 239941 : void setInMainfile(sal_Bool bInMainfile)
89 : 239941 : { m_bInMainFile = bInMainfile; }
90 : 938 : sal_Bool isImported() const
91 : 938 : { return m_bImported; }
92 : 938 : void setImported(sal_Bool bImported)
93 : 938 : { m_bImported = bImported; }
94 : 938 : sal_Int32 getLineNumber() const
95 : 938 : { return m_lineNumber; }
96 : 938 : void setLineNumber(sal_Int32 lineNumber)
97 : 938 : { m_lineNumber = lineNumber; }
98 : 239941 : const ::rtl::OString& getFileName() const
99 : 239941 : { return m_fileName; }
100 : 239941 : void setFileName(const ::rtl::OString& rFileName)
101 : 239941 : { m_fileName = rFileName; }
102 : 70807 : const ::rtl::OUString& getDocumentation() const
103 : 70807 : { return m_documentation; }
104 : 938 : void setDocumentation(const ::rtl::OUString& rDocumentation)
105 : 938 : { 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 : 166 : void setPublished() { m_bPublished = true; }
116 : 160502 : bool isPublished() const { return m_bPublished; }
117 : :
118 : : virtual sal_Bool dump(RegistryKey& rKey);
119 : :
120 : 239119 : 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: */
|