xref: /aoo41x/main/autodoc/source/ary/idl/i_module.cxx (revision cdf0e10c)
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 #include <precomp.h>
29 #include <ary/idl/i_module.hxx>
30 #include <ary/idl/ik_module.hxx>
31 
32 // NOT FULLY DECLARED SERVICES
33 #include <cosv/tpl/processor.hxx>
34 #include <ary/idl/i_gate.hxx>
35 #include <ary/idl/i_module.hxx>
36 #include <ary/idl/i_service.hxx>
37 #include <ary/idl/i_interface.hxx>
38 #include <ary/idl/i_struct.hxx>
39 #include <ary/idl/i_exception.hxx>
40 #include <ary/idl/i_enum.hxx>
41 #include <ary/idl/i_typedef.hxx>
42 #include <ary/idl/i_constgroup.hxx>
43 #include <ary/idl/i_singleton.hxx>
44 #include <ary/idl/i_siservice.hxx>
45 #include <ary/idl/i_sisingleton.hxx>
46 #include <ary/idl/ip_ce.hxx>
47 #include <nametreenode.hxx>
48 
49 
50 namespace ary
51 {
52 namespace idl
53 {
54 
55 Module::Module()
56     :   pImpl( new NameTreeNode<Ce_id> )
57 {
58 }
59 
60 Module::Module( const String &      i_sName,
61                 const Module &      i_rParent )
62     :   pImpl( new NameTreeNode<Ce_id>( i_sName,
63                                 		*i_rParent.pImpl,
64                                 		i_rParent.CeId() ) )
65 {
66 }
67 
68 Module::~Module()
69 {
70 }
71 
72 void
73 Module::Add_Name( const String &    i_sName,
74                   Ce_id             i_nCodeEntity )
75 {
76     pImpl->Add_Name(i_sName, i_nCodeEntity);
77 }
78 
79 Ce_id
80 Module::Search_Name( const String & i_sName ) const
81 {
82     return pImpl->Search_Name(i_sName);
83 }
84 
85 void
86 Module::Get_Names( Dyn_StdConstIterator<Ce_id> & o_rResult ) const
87 {
88     pImpl->Get_Names( o_rResult );
89 }
90 
91 void
92 Module::do_Accept( csv::ProcessorIfc & io_processor ) const
93 {
94     csv::CheckedCall(io_processor, *this);
95 }
96 
97 ClassId
98 Module::get_AryClass() const
99 {
100     return class_id;
101 }
102 
103 const String &
104 Module::inq_LocalName() const
105 {
106     return pImpl->Name();
107 }
108 
109 Ce_id
110 Module::inq_NameRoom() const
111 {
112     return pImpl->Parent();
113 }
114 
115 Ce_id
116 Module::inq_Owner() const
117 {
118     return pImpl->Parent();
119 }
120 
121 E_SightLevel
122 Module::inq_SightLevel() const
123 {
124     return sl_Module;
125 }
126 
127 
128 namespace ifc_module
129 {
130 
131 inline const Module &
132 module_cast( const CodeEntity &  i_ce )
133 {
134     csv_assert( i_ce.AryClass() == Module::class_id );
135 	return static_cast< const Module& >(i_ce);
136 }
137 
138 typedef NameTreeNode<Ce_id>::Map_LocalNames NameMap;
139 
140 void
141 attr::Get_AllChildrenSeparated( std::vector< const CodeEntity* > & o_nestedModules,
142                                 std::vector< const CodeEntity* > & o_services,
143                                 std::vector< const CodeEntity* > & o_interfaces,
144                                 std::vector< const CodeEntity* > & o_structs,
145                                 std::vector< const CodeEntity* > & o_exceptions,
146                                 std::vector< const CodeEntity* > & o_enums,
147                                 std::vector< const CodeEntity* > & o_typedefs,
148                                 std::vector< const CodeEntity* > & o_constantGroups,
149                                 std::vector< const CodeEntity* > & o_singletons,
150                                 const CePilot &                    i_pilot,
151                                 const CodeEntity &                 i_ce )
152 {
153     const CodeEntity *
154         pCe = 0;
155     NameMap::const_iterator
156         itEnd = module_cast(i_ce).pImpl->LocalNames().end();
157     for ( NameMap::const_iterator
158             it = module_cast(i_ce).pImpl->LocalNames().begin();
159           it != itEnd;
160           ++it )
161     {
162         pCe = &i_pilot.Find_Ce( (*it).second );
163         switch (pCe->AryClass())
164         {
165             case Module::class_id:
166                         o_nestedModules.push_back(pCe);
167                         break;
168             case SglIfcService::class_id:
169             case Service::class_id:
170                         o_services.push_back(pCe);
171                         break;
172             case Interface::class_id:
173                         o_interfaces.push_back(pCe);
174                         break;
175             case Struct::class_id:
176                         o_structs.push_back(pCe);
177                         break;
178             case Exception::class_id:
179                         o_exceptions.push_back(pCe);
180                         break;
181             case Enum::class_id:
182                         o_enums.push_back(pCe);
183                         break;
184             case Typedef::class_id:
185                         o_typedefs.push_back(pCe);
186                         break;
187             case ConstantsGroup::class_id:
188                         o_constantGroups.push_back(pCe);
189                         break;
190             case SglIfcSingleton::class_id:
191             case Singleton::class_id:
192                         o_singletons.push_back(pCe);
193                         break;
194         }
195     }   // end for
196 }
197 
198 
199 } // namespace ifc_module
200 
201 
202 
203 }   //  namespace   idl
204 }   //  namespace   ary
205