xref: /aoo4110/main/autodoc/inc/ary/cpp/c_namesp.hxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ARY_CPP_C_NAMESP_HXX
25 #define ARY_CPP_C_NAMESP_HXX
26 
27 
28 
29 // USED SERVICES
30 	// BASE CLASSES
31 #include <ary/cpp/c_ce.hxx>
32 #include <ary/arygroup.hxx>
33 	// OTHER
34 #include <ary/symtreenode.hxx>
35 #include <ary/cessentl.hxx>
36 #include <ary/cpp/c_types4cpp.hxx>
37 #include <ary/cpp/c_slntry.hxx>
38 
39 namespace ary
40 {
41 namespace cpp
42 {
43     class Gate;
44     class OperationSignature;
45 }
46 }
47 
48 
49 
50 namespace ary
51 {
52 namespace cpp
53 {
54 
55 
56 
57 /** A C++ namespace.
58 */
59 class Namespace : public CodeEntity,
60                   public AryGroup
61 {
62   public:
63     enum E_ClassId { class_id = 1000 };
64 
65     enum E_Slots
66     {
67         SLOT_SubNamespaces = 1,
68         SLOT_Classes,
69         SLOT_Enums,
70         SLOT_Typedefs,
71         SLOT_Operations,
72 		SLOT_Variables,
73 		SLOT_Constants
74 	};
75 
76     typedef ::ary::symtree::Node<CeNode_Traits>    node_t;
77 
78     					Namespace();
79 						Namespace(
80                             const String  &     i_sName,
81                             Namespace &         i_rParent );
82 						~Namespace();
83 	// OPERATIONS
84 	void				Add_LocalNamespace(
85 							Namespace &		    io_rLocalNamespace );
86 	void                Add_LocalClass(
87                             const String  &     i_sLocalName,
88                             Cid                 i_nId );
89 	void                Add_LocalEnum(
90 							const String  &     i_sLocalName,
91 							Cid                 i_nId );
92 	void                Add_LocalTypedef(
93 							const String  &     i_sLocalName,
94 							Cid                 i_nId );
95 	void                Add_LocalOperation(
96 							const String  &     i_sLocalName,
97 							Cid                 i_nId );
98 	void                Add_LocalVariable(
99 							const String  &     i_sLocalName,
100 							Cid                 i_nId );
101 	void                Add_LocalConstant(
102 							const String  &     i_sLocalName,
103 							Cid                 i_nId );
104 
105 	// INQUIRY
106 	virtual uintt		Depth() const;
107 	Namespace *			Parent() const;
108 
109     Ce_id               Search_Child(
110                             const String &      i_key ) const;
111 	Namespace *			Search_LocalNamespace(
112 							const String  &		i_sLocalName ) const;
113 	uintt               Get_SubNamespaces(
114 							std::vector< const Namespace* > &
115 												o_rResultList ) const;
116     Ce_id               Search_LocalClass(
117                             const String &      i_sName ) const;
118     void                Search_LocalOperations(
119                             std::vector<Ce_id> &
120                                                 o_result,
121                             const String &      i_sName ) const;
122     const node_t &      AsNode() const;
123 
124     // ACCESS
125     node_t &            AsNode();
126 
127   private:
128     NON_COPYABLE(Namespace);
129 
130     // Interface csv::ConstProcessorClient
131     virtual void        do_Accept(
132                             csv::ProcessorIfc & io_processor ) const;
133 
134 	// Interface CodeEntity
135 	virtual const String  &
136                         inq_LocalName() const;
137 	virtual Cid         inq_Owner() const;
138 	virtual Lid			inq_Location() const;
139 
140     // Interface ary::cpp::CppEntity
141     virtual ClassId     get_AryClass() const;
142 
143 		// Interface AryGroup
144 	virtual Gid 		inq_Id_Group() const;
145     virtual const cpp::CppEntity &
146 						inq_RE_Group() const;
147 	virtual const ary::group::SlotList &
148                         inq_Slots() const;
149 	virtual DYN Slot *  inq_Create_Slot(
150                             SlotAccessId        i_nSlot ) const;
151 	// Local
152     typedef std::multimap<String, Ce_id>  Map_Operations;
153 
154     // DATA
155 	CeEssentials		aEssentials;
156 	node_t              aAssignedNode;
157 
158     Map_NamespacePtr    aLocalNamespaces;
159     Map_LocalCe         aLocalClasses;
160     Map_LocalCe         aLocalEnums;
161     Map_LocalCe         aLocalTypedefs;
162     Map_Operations      aLocalOperations;
163 	Map_LocalCe         aLocalVariables;
164 	Map_LocalCe         aLocalConstants;
165 
166 	Namespace *			pParent;
167 	uintt				nDepth;
168 };
169 
170 
171 
172 // IMPLEMENTATION
173 inline const Namespace::node_t &
AsNode() const174 Namespace::AsNode() const
175 {
176     return aAssignedNode;
177 }
178 
179 inline Namespace::node_t &
AsNode()180 Namespace::AsNode()
181 {
182     return aAssignedNode;
183 }
184 
185 
186 
187 
188 }   // namespace cpp
189 }   // ary
190 #endif
191