Update ooo320-m1
[ooovba.git] / autodoc / source / ary / idl / i_module.cxx
blob65f479ad81bffd3f1c5843d83c759918ec31275a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: i_module.cxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <precomp.h>
32 #include <ary/idl/i_module.hxx>
33 #include <ary/idl/ik_module.hxx>
35 // NOT FULLY DECLARED SERVICES
36 #include <cosv/tpl/processor.hxx>
37 #include <ary/idl/i_gate.hxx>
38 #include <ary/idl/i_module.hxx>
39 #include <ary/idl/i_service.hxx>
40 #include <ary/idl/i_interface.hxx>
41 #include <ary/idl/i_struct.hxx>
42 #include <ary/idl/i_exception.hxx>
43 #include <ary/idl/i_enum.hxx>
44 #include <ary/idl/i_typedef.hxx>
45 #include <ary/idl/i_constgroup.hxx>
46 #include <ary/idl/i_singleton.hxx>
47 #include <ary/idl/i_siservice.hxx>
48 #include <ary/idl/i_sisingleton.hxx>
49 #include <ary/idl/ip_ce.hxx>
50 #include <nametreenode.hxx>
53 namespace ary
55 namespace idl
58 Module::Module()
59 : pImpl( new NameTreeNode<Ce_id> )
63 Module::Module( const String & i_sName,
64 const Module & i_rParent )
65 : pImpl( new NameTreeNode<Ce_id>( i_sName,
66 *i_rParent.pImpl,
67 i_rParent.CeId() ) )
71 Module::~Module()
75 void
76 Module::Add_Name( const String & i_sName,
77 Ce_id i_nCodeEntity )
79 pImpl->Add_Name(i_sName, i_nCodeEntity);
82 Ce_id
83 Module::Search_Name( const String & i_sName ) const
85 return pImpl->Search_Name(i_sName);
88 void
89 Module::Get_Names( Dyn_StdConstIterator<Ce_id> & o_rResult ) const
91 pImpl->Get_Names( o_rResult );
94 void
95 Module::do_Accept( csv::ProcessorIfc & io_processor ) const
97 csv::CheckedCall(io_processor, *this);
100 ClassId
101 Module::get_AryClass() const
103 return class_id;
106 const String &
107 Module::inq_LocalName() const
109 return pImpl->Name();
112 Ce_id
113 Module::inq_NameRoom() const
115 return pImpl->Parent();
118 Ce_id
119 Module::inq_Owner() const
121 return pImpl->Parent();
124 E_SightLevel
125 Module::inq_SightLevel() const
127 return sl_Module;
131 namespace ifc_module
134 inline const Module &
135 module_cast( const CodeEntity & i_ce )
137 csv_assert( i_ce.AryClass() == Module::class_id );
138 return static_cast< const Module& >(i_ce);
141 typedef NameTreeNode<Ce_id>::Map_LocalNames NameMap;
143 void
144 attr::Get_AllChildrenSeparated( std::vector< const CodeEntity* > & o_nestedModules,
145 std::vector< const CodeEntity* > & o_services,
146 std::vector< const CodeEntity* > & o_interfaces,
147 std::vector< const CodeEntity* > & o_structs,
148 std::vector< const CodeEntity* > & o_exceptions,
149 std::vector< const CodeEntity* > & o_enums,
150 std::vector< const CodeEntity* > & o_typedefs,
151 std::vector< const CodeEntity* > & o_constantGroups,
152 std::vector< const CodeEntity* > & o_singletons,
153 const CePilot & i_pilot,
154 const CodeEntity & i_ce )
156 const CodeEntity *
157 pCe = 0;
158 NameMap::const_iterator
159 itEnd = module_cast(i_ce).pImpl->LocalNames().end();
160 for ( NameMap::const_iterator
161 it = module_cast(i_ce).pImpl->LocalNames().begin();
162 it != itEnd;
163 ++it )
165 pCe = &i_pilot.Find_Ce( (*it).second );
166 switch (pCe->AryClass())
168 case Module::class_id:
169 o_nestedModules.push_back(pCe);
170 break;
171 case SglIfcService::class_id:
172 case Service::class_id:
173 o_services.push_back(pCe);
174 break;
175 case Interface::class_id:
176 o_interfaces.push_back(pCe);
177 break;
178 case Struct::class_id:
179 o_structs.push_back(pCe);
180 break;
181 case Exception::class_id:
182 o_exceptions.push_back(pCe);
183 break;
184 case Enum::class_id:
185 o_enums.push_back(pCe);
186 break;
187 case Typedef::class_id:
188 o_typedefs.push_back(pCe);
189 break;
190 case ConstantsGroup::class_id:
191 o_constantGroups.push_back(pCe);
192 break;
193 case SglIfcSingleton::class_id:
194 case Singleton::class_id:
195 o_singletons.push_back(pCe);
196 break;
198 } // end for
202 } // namespace ifc_module
206 } // namespace idl
207 } // namespace ary