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_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 0 : class AstDeclaration
61 : {
62 : public:
63 : // Constructors
64 : AstDeclaration(NodeType type, const OString& name, AstScope* pScope);
65 : virtual ~AstDeclaration();
66 :
67 : // Data access
68 0 : const OString& getLocalName() const
69 0 : { return m_localName; }
70 0 : const OString& getScopedName() const
71 0 : { return m_scopedName; }
72 0 : const OString& getFullName()
73 0 : { return m_fullName; }
74 0 : virtual const sal_Char* getRelativName() const
75 0 : { return m_fullName.getStr()+1; }
76 0 : AstScope* getScope()
77 0 : { return m_pScope; }
78 : void setScope(AstScope* pSc)
79 : { m_pScope = pSc; }
80 0 : NodeType getNodeType() const
81 0 : { return m_nodeType; }
82 0 : bool isInMainfile() const
83 0 : { return m_bInMainFile; }
84 0 : void setInMainfile(bool bInMainfile)
85 0 : { m_bInMainFile = bInMainfile; }
86 0 : bool isImported() const
87 0 : { return m_bImported; }
88 0 : void setImported(bool bImported)
89 0 : { m_bImported = bImported; }
90 0 : sal_Int32 getLineNumber() const
91 0 : { return m_lineNumber; }
92 0 : void setLineNumber(sal_Int32 lineNumber)
93 0 : { m_lineNumber = lineNumber; }
94 0 : const OString& getFileName() const
95 0 : { return m_fileName; }
96 0 : void setFileName(const OString& rFileName)
97 0 : { m_fileName = rFileName; }
98 0 : const OUString& getDocumentation() const
99 0 : { return m_documentation; }
100 0 : void setDocumentation(const OUString& rDocumentation)
101 0 : { m_documentation = rDocumentation; }
102 : bool isAdded()
103 : { return m_bIsAdded; }
104 : void markAsAdded()
105 : { m_bIsAdded = true; }
106 :
107 : virtual bool isType() const;
108 :
109 : bool hasAncestor(AstDeclaration* pDecl);
110 :
111 0 : void setPublished() { m_bPublished = true; }
112 0 : bool isPublished() const { return m_bPublished; }
113 :
114 : virtual bool dump(RegistryKey& rKey);
115 :
116 0 : bool isPredefined() { return m_bPredefined; }
117 : void setPredefined(bool bPredefined);
118 :
119 : protected:
120 : OString m_localName;
121 : OString m_scopedName; // full qualified name
122 : OString m_fullName; // full qualified name with '/' as separator
123 : AstScope* m_pScope;
124 : NodeType m_nodeType;
125 : bool m_bImported; // imported ?
126 : bool m_bIsAdded; // mark declaration as added in scope
127 : bool m_bInMainFile; // defined in main file
128 : bool m_bPublished;
129 : bool m_bPredefined;
130 : sal_Int32 m_lineNumber; // line number defined in
131 : OString m_fileName; // fileName defined in
132 : OUString m_documentation; // fileName defined in
133 : };
134 :
135 : #endif // _IDLC_ASTDECLARATION_HXX_
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|