1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: i_module.cxx,v $
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 ************************************************************************/
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>
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
,
76 Module::Add_Name( const String
& i_sName
,
79 pImpl
->Add_Name(i_sName
, i_nCodeEntity
);
83 Module::Search_Name( const String
& i_sName
) const
85 return pImpl
->Search_Name(i_sName
);
89 Module::Get_Names( Dyn_StdConstIterator
<Ce_id
> & o_rResult
) const
91 pImpl
->Get_Names( o_rResult
);
95 Module::do_Accept( csv::ProcessorIfc
& io_processor
) const
97 csv::CheckedCall(io_processor
, *this);
101 Module::get_AryClass() const
107 Module::inq_LocalName() const
109 return pImpl
->Name();
113 Module::inq_NameRoom() const
115 return pImpl
->Parent();
119 Module::inq_Owner() const
121 return pImpl
->Parent();
125 Module::inq_SightLevel() const
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
;
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
)
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();
165 pCe
= &i_pilot
.Find_Ce( (*it
).second
);
166 switch (pCe
->AryClass())
168 case Module::class_id
:
169 o_nestedModules
.push_back(pCe
);
171 case SglIfcService::class_id
:
172 case Service::class_id
:
173 o_services
.push_back(pCe
);
175 case Interface::class_id
:
176 o_interfaces
.push_back(pCe
);
178 case Struct::class_id
:
179 o_structs
.push_back(pCe
);
181 case Exception::class_id
:
182 o_exceptions
.push_back(pCe
);
185 o_enums
.push_back(pCe
);
187 case Typedef::class_id
:
188 o_typedefs
.push_back(pCe
);
190 case ConstantsGroup::class_id
:
191 o_constantGroups
.push_back(pCe
);
193 case SglIfcSingleton::class_id
:
194 case Singleton::class_id
:
195 o_singletons
.push_back(pCe
);
202 } // namespace ifc_module