xref: /AOO41X/main/autodoc/inc/ary/cpp/c_namesp.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef ARY_CPP_C_NAMESP_HXX
29 #define ARY_CPP_C_NAMESP_HXX
30 
31 
32 
33 // USED SERVICES
34 	// BASE CLASSES
35 #include <ary/cpp/c_ce.hxx>
36 #include <ary/arygroup.hxx>
37 	// OTHER
38 #include <ary/symtreenode.hxx>
39 #include <ary/cessentl.hxx>
40 #include <ary/cpp/c_types4cpp.hxx>
41 #include <ary/cpp/c_slntry.hxx>
42 
43 namespace ary
44 {
45 namespace cpp
46 {
47     class Gate;
48     class OperationSignature;
49 }
50 }
51 
52 
53 
54 namespace ary
55 {
56 namespace cpp
57 {
58 
59 
60 
61 /** A C++ namespace.
62 */
63 class Namespace : public CodeEntity,
64                   public AryGroup
65 {
66   public:
67     enum E_ClassId { class_id = 1000 };
68 
69     enum E_Slots
70     {
71         SLOT_SubNamespaces = 1,
72         SLOT_Classes,
73         SLOT_Enums,
74         SLOT_Typedefs,
75         SLOT_Operations,
76 		SLOT_Variables,
77 		SLOT_Constants
78 	};
79 
80     typedef ::ary::symtree::Node<CeNode_Traits>    node_t;
81 
82     					Namespace();
83 						Namespace(
84                             const String  &     i_sName,
85                             Namespace &         i_rParent );
86 						~Namespace();
87 	// OPERATIONS
88 	void				Add_LocalNamespace(
89 							Namespace &		    io_rLocalNamespace );
90 	void                Add_LocalClass(
91                             const String  &     i_sLocalName,
92                             Cid                 i_nId );
93 	void                Add_LocalEnum(
94 							const String  &     i_sLocalName,
95 							Cid                 i_nId );
96 	void                Add_LocalTypedef(
97 							const String  &     i_sLocalName,
98 							Cid                 i_nId );
99 	void                Add_LocalOperation(
100 							const String  &     i_sLocalName,
101 							Cid                 i_nId );
102 	void                Add_LocalVariable(
103 							const String  &     i_sLocalName,
104 							Cid                 i_nId );
105 	void                Add_LocalConstant(
106 							const String  &     i_sLocalName,
107 							Cid                 i_nId );
108 
109 	// INQUIRY
110 	virtual uintt		Depth() const;
111 	Namespace *			Parent() const;
112 
113     Ce_id               Search_Child(
114                             const String &      i_key ) const;
115 	Namespace *			Search_LocalNamespace(
116 							const String  &		i_sLocalName ) const;
117 	uintt               Get_SubNamespaces(
118 							std::vector< const Namespace* > &
119 												o_rResultList ) const;
120     Ce_id               Search_LocalClass(
121                             const String &      i_sName ) const;
122     void                Search_LocalOperations(
123                             std::vector<Ce_id> &
124                                                 o_result,
125                             const String &      i_sName ) const;
126     const node_t &      AsNode() const;
127 
128     // ACCESS
129     node_t &            AsNode();
130 
131   private:
132     NON_COPYABLE(Namespace);
133 
134     // Interface csv::ConstProcessorClient
135     virtual void        do_Accept(
136                             csv::ProcessorIfc & io_processor ) const;
137 
138 	// Interface CodeEntity
139 	virtual const String  &
140                         inq_LocalName() const;
141 	virtual Cid         inq_Owner() const;
142 	virtual Lid			inq_Location() const;
143 
144     // Interface ary::cpp::CppEntity
145     virtual ClassId     get_AryClass() const;
146 
147 		// Interface AryGroup
148 	virtual Gid 		inq_Id_Group() const;
149     virtual const cpp::CppEntity &
150 						inq_RE_Group() const;
151 	virtual const ary::group::SlotList &
152                         inq_Slots() const;
153 	virtual DYN Slot *  inq_Create_Slot(
154                             SlotAccessId        i_nSlot ) const;
155 	// Local
156     typedef std::multimap<String, Ce_id>  Map_Operations;
157 
158     // DATA
159 	CeEssentials		aEssentials;
160 	node_t              aAssignedNode;
161 
162     Map_NamespacePtr    aLocalNamespaces;
163     Map_LocalCe         aLocalClasses;
164     Map_LocalCe         aLocalEnums;
165     Map_LocalCe         aLocalTypedefs;
166     Map_Operations      aLocalOperations;
167 	Map_LocalCe         aLocalVariables;
168 	Map_LocalCe         aLocalConstants;
169 
170 	Namespace *			pParent;
171 	uintt				nDepth;
172 };
173 
174 
175 
176 // IMPLEMENTATION
177 inline const Namespace::node_t &
178 Namespace::AsNode() const
179 {
180     return aAssignedNode;
181 }
182 
183 inline Namespace::node_t &
184 Namespace::AsNode()
185 {
186     return aAssignedNode;
187 }
188 
189 
190 
191 
192 }   // namespace cpp
193 }   // ary
194 #endif
195