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