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