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 "ia_ce.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 33*cdf0e10cSrcweir #include <algorithm> 34*cdf0e10cSrcweir #include <cosv/tpl/tpltools.hxx> 35*cdf0e10cSrcweir #include <ary/idl/i_attribute.hxx> 36*cdf0e10cSrcweir #include <ary/idl/i_constant.hxx> 37*cdf0e10cSrcweir #include <ary/idl/i_constgroup.hxx> 38*cdf0e10cSrcweir #include <ary/idl/i_enum.hxx> 39*cdf0e10cSrcweir #include <ary/idl/i_enumvalue.hxx> 40*cdf0e10cSrcweir #include <ary/idl/i_exception.hxx> 41*cdf0e10cSrcweir #include <ary/idl/i_function.hxx> 42*cdf0e10cSrcweir #include <ary/idl/i_interface.hxx> 43*cdf0e10cSrcweir #include <ary/idl/i_module.hxx> 44*cdf0e10cSrcweir #include <ary/idl/i_namelookup.hxx> 45*cdf0e10cSrcweir #include <ary/idl/i_property.hxx> 46*cdf0e10cSrcweir #include <ary/idl/i_service.hxx> 47*cdf0e10cSrcweir #include <ary/idl/i_singleton.hxx> 48*cdf0e10cSrcweir #include <ary/idl/i_siservice.hxx> 49*cdf0e10cSrcweir #include <ary/idl/i_sisingleton.hxx> 50*cdf0e10cSrcweir #include <ary/idl/i_struct.hxx> 51*cdf0e10cSrcweir #include <ary/idl/i_structelem.hxx> 52*cdf0e10cSrcweir #include <ary/idl/i_traits.hxx> 53*cdf0e10cSrcweir #include <ary/idl/i_typedef.hxx> 54*cdf0e10cSrcweir #include <idsort.hxx> 55*cdf0e10cSrcweir #include "ia_type.hxx" 56*cdf0e10cSrcweir #include "is_ce.hxx" 57*cdf0e10cSrcweir #include "it_tplparam.hxx" 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir namespace ary 63*cdf0e10cSrcweir { 64*cdf0e10cSrcweir namespace idl 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir inline Module & 68*cdf0e10cSrcweir CeAdmin::lhf_Access_Module( Ce_id i_nId ) 69*cdf0e10cSrcweir { return ary_cast<Module>(Storage()[i_nId]); } 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir inline void 72*cdf0e10cSrcweir CeAdmin::lhf_Put2Storage_and_AssignId( CodeEntity & pass_io_rCe ) 73*cdf0e10cSrcweir { // This also assigns an ID to pass_io_rCe: 74*cdf0e10cSrcweir Storage().Store_Entity(pass_io_rCe); 75*cdf0e10cSrcweir my_NameDictionary().Add_Name( pass_io_rCe.LocalName(), 76*cdf0e10cSrcweir pass_io_rCe.CeId(), 77*cdf0e10cSrcweir pass_io_rCe.AryClass(), 78*cdf0e10cSrcweir pass_io_rCe.Owner() ); 79*cdf0e10cSrcweir } 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir inline void 82*cdf0e10cSrcweir CeAdmin::lhf_Store_NewEntity( DYN CodeEntity & pass_io_rCe, 83*cdf0e10cSrcweir Module & i_rOwner ) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir lhf_Put2Storage_and_AssignId(pass_io_rCe); 86*cdf0e10cSrcweir i_rOwner.Add_Name(pass_io_rCe.LocalName(), pass_io_rCe.CeId()); 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir inline void 90*cdf0e10cSrcweir CeAdmin::lhf_Store_NewEntity( DYN CodeEntity & pass_io_rCe, 91*cdf0e10cSrcweir Ce_id i_nOwnerModule ) 92*cdf0e10cSrcweir { 93*cdf0e10cSrcweir lhf_Store_NewEntity(pass_io_rCe, lhf_Access_Module(i_nOwnerModule)); 94*cdf0e10cSrcweir } 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir CeAdmin::CeAdmin( NameLookup & io_rNameDictionary, 99*cdf0e10cSrcweir TypeAdmin & io_rTypePilot ) 100*cdf0e10cSrcweir : pStorage(new Ce_Storage), 101*cdf0e10cSrcweir pGlobalNamespace(0), 102*cdf0e10cSrcweir pNameDictionary(&io_rNameDictionary), 103*cdf0e10cSrcweir pTypePilot(&io_rTypePilot) 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir Storage().Set_Reserved( 106*cdf0e10cSrcweir predefined::ce_GlobalNamespace, 107*cdf0e10cSrcweir *new Module ); 108*cdf0e10cSrcweir pGlobalNamespace = &lhf_Access_Module(Ce_id(predefined::ce_GlobalNamespace)); 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir CeAdmin::~CeAdmin() 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir Module & 118*cdf0e10cSrcweir CeAdmin::CheckIn_Module( Ce_id i_nParentId, 119*cdf0e10cSrcweir const String & i_sName ) 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir Module & rOwner = lhf_Access_Module(i_nParentId); 122*cdf0e10cSrcweir Ce_id nId = rOwner.Search_Name(i_sName); 123*cdf0e10cSrcweir if (nId.IsValid()) 124*cdf0e10cSrcweir { 125*cdf0e10cSrcweir return lhf_Access_Module(nId); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir Module & ret = *new Module( i_sName, 129*cdf0e10cSrcweir rOwner ); 130*cdf0e10cSrcweir lhf_Store_NewEntity(ret, rOwner); 131*cdf0e10cSrcweir return ret; 132*cdf0e10cSrcweir } 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir Service & 135*cdf0e10cSrcweir CeAdmin::Store_Service( Ce_id i_nOwner, 136*cdf0e10cSrcweir const String & i_sName ) 137*cdf0e10cSrcweir { 138*cdf0e10cSrcweir Service & ret = *new Service( i_sName, 139*cdf0e10cSrcweir i_nOwner ); 140*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 141*cdf0e10cSrcweir return ret; 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir SglIfcService & 145*cdf0e10cSrcweir CeAdmin::Store_SglIfcService( Ce_id i_nOwner, 146*cdf0e10cSrcweir const String & i_sName, 147*cdf0e10cSrcweir Type_id i_nBaseInterface ) 148*cdf0e10cSrcweir { 149*cdf0e10cSrcweir SglIfcService & 150*cdf0e10cSrcweir ret = *new SglIfcService( i_sName, 151*cdf0e10cSrcweir i_nOwner, 152*cdf0e10cSrcweir i_nBaseInterface ); 153*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 154*cdf0e10cSrcweir return ret; 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir Interface & 158*cdf0e10cSrcweir CeAdmin::Store_Interface( Ce_id i_nOwner, 159*cdf0e10cSrcweir const String & i_sName, 160*cdf0e10cSrcweir Type_id i_nBase ) 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir Interface & ret = *new Interface( i_sName, 163*cdf0e10cSrcweir i_nOwner ); 164*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 165*cdf0e10cSrcweir if (i_nBase.IsValid()) 166*cdf0e10cSrcweir ret.Add_Base(i_nBase, 0); 167*cdf0e10cSrcweir return ret; 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir Struct & 171*cdf0e10cSrcweir CeAdmin::Store_Struct( Ce_id i_nOwner, 172*cdf0e10cSrcweir const String & i_sName, 173*cdf0e10cSrcweir Type_id i_nBase, 174*cdf0e10cSrcweir const String & i_sTemplateParam ) 175*cdf0e10cSrcweir { 176*cdf0e10cSrcweir if (NOT i_sTemplateParam.empty()) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir return lhf_Store_TplStruct( i_nOwner, 179*cdf0e10cSrcweir i_sName, 180*cdf0e10cSrcweir i_nBase, 181*cdf0e10cSrcweir i_sTemplateParam ); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir 184*cdf0e10cSrcweir Struct & ret = *new Struct( i_sName, 185*cdf0e10cSrcweir i_nOwner, 186*cdf0e10cSrcweir i_nBase, 187*cdf0e10cSrcweir String::Null_(), 188*cdf0e10cSrcweir Type_id::Null_() ); 189*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir return ret; 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir Exception & 195*cdf0e10cSrcweir CeAdmin::Store_Exception( Ce_id i_nOwner, 196*cdf0e10cSrcweir const String & i_sName, 197*cdf0e10cSrcweir Type_id i_nBase ) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir Exception & ret = *new Exception( i_sName, 200*cdf0e10cSrcweir i_nOwner, 201*cdf0e10cSrcweir i_nBase ); 202*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 203*cdf0e10cSrcweir return ret; 204*cdf0e10cSrcweir } 205*cdf0e10cSrcweir 206*cdf0e10cSrcweir Enum & 207*cdf0e10cSrcweir CeAdmin::Store_Enum( Ce_id i_nOwner, 208*cdf0e10cSrcweir const String & i_sName ) 209*cdf0e10cSrcweir { 210*cdf0e10cSrcweir Enum & ret = *new Enum( i_sName, 211*cdf0e10cSrcweir i_nOwner ); 212*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 213*cdf0e10cSrcweir return ret; 214*cdf0e10cSrcweir } 215*cdf0e10cSrcweir 216*cdf0e10cSrcweir Typedef & 217*cdf0e10cSrcweir CeAdmin::Store_Typedef( Ce_id i_nOwner, 218*cdf0e10cSrcweir const String & i_sName, 219*cdf0e10cSrcweir Type_id i_nDefiningType ) 220*cdf0e10cSrcweir { 221*cdf0e10cSrcweir Typedef & ret = *new Typedef( i_sName, 222*cdf0e10cSrcweir i_nOwner, 223*cdf0e10cSrcweir i_nDefiningType ); 224*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 225*cdf0e10cSrcweir return ret; 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir ConstantsGroup & 230*cdf0e10cSrcweir CeAdmin::Store_ConstantsGroup( Ce_id i_nOwner, 231*cdf0e10cSrcweir const String & i_sName ) 232*cdf0e10cSrcweir { 233*cdf0e10cSrcweir ConstantsGroup & ret = *new ConstantsGroup( i_sName, 234*cdf0e10cSrcweir i_nOwner ); 235*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 236*cdf0e10cSrcweir return ret; 237*cdf0e10cSrcweir } 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir Singleton & 240*cdf0e10cSrcweir CeAdmin::Store_Singleton( Ce_id i_nOwner, 241*cdf0e10cSrcweir const String & i_sName ) 242*cdf0e10cSrcweir { 243*cdf0e10cSrcweir Singleton & ret = *new Singleton( i_sName, 244*cdf0e10cSrcweir i_nOwner ); 245*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 246*cdf0e10cSrcweir return ret; 247*cdf0e10cSrcweir } 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir SglIfcSingleton & 250*cdf0e10cSrcweir CeAdmin::Store_SglIfcSingleton( Ce_id i_nOwner, 251*cdf0e10cSrcweir const String & i_sName, 252*cdf0e10cSrcweir Type_id i_nBaseInterface ) 253*cdf0e10cSrcweir { 254*cdf0e10cSrcweir SglIfcSingleton & 255*cdf0e10cSrcweir ret = *new SglIfcSingleton( i_sName, 256*cdf0e10cSrcweir i_nOwner, 257*cdf0e10cSrcweir i_nBaseInterface ); 258*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 259*cdf0e10cSrcweir return ret; 260*cdf0e10cSrcweir } 261*cdf0e10cSrcweir 262*cdf0e10cSrcweir Constant & 263*cdf0e10cSrcweir CeAdmin::Store_Constant( Ce_id i_nOwner, 264*cdf0e10cSrcweir const String & i_sName, 265*cdf0e10cSrcweir Type_id i_nType, 266*cdf0e10cSrcweir const String & i_sValue ) 267*cdf0e10cSrcweir { 268*cdf0e10cSrcweir ConstantsGroup & 269*cdf0e10cSrcweir rOwner = ary_cast<ConstantsGroup>(Storage()[i_nOwner]); 270*cdf0e10cSrcweir Constant & ret = *new Constant( i_sName, 271*cdf0e10cSrcweir i_nOwner, 272*cdf0e10cSrcweir rOwner.NameRoom(), 273*cdf0e10cSrcweir i_nType, 274*cdf0e10cSrcweir i_sValue ); 275*cdf0e10cSrcweir lhf_Put2Storage_and_AssignId(ret); 276*cdf0e10cSrcweir rOwner.Add_Constant(ret.CeId()); 277*cdf0e10cSrcweir return ret; 278*cdf0e10cSrcweir } 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir Property & 281*cdf0e10cSrcweir CeAdmin::Store_Property( Ce_id i_nOwner, 282*cdf0e10cSrcweir const String & i_sName, 283*cdf0e10cSrcweir Type_id i_nType, 284*cdf0e10cSrcweir Property::Stereotypes i_stereotypes ) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir Service & 287*cdf0e10cSrcweir rOwner = ary_cast<Service>(Storage()[i_nOwner]); 288*cdf0e10cSrcweir Property & ret = *new Property( i_sName, 289*cdf0e10cSrcweir i_nOwner, 290*cdf0e10cSrcweir rOwner.NameRoom(), 291*cdf0e10cSrcweir i_nType, 292*cdf0e10cSrcweir i_stereotypes ); 293*cdf0e10cSrcweir lhf_Put2Storage_and_AssignId(ret); 294*cdf0e10cSrcweir rOwner.Add_Property(ret.CeId()); 295*cdf0e10cSrcweir return ret; 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir Function & 299*cdf0e10cSrcweir CeAdmin::Store_Function( Ce_id i_nOwner, 300*cdf0e10cSrcweir const String & i_sName, 301*cdf0e10cSrcweir Type_id i_nReturnType, 302*cdf0e10cSrcweir bool i_bOneWay ) 303*cdf0e10cSrcweir { 304*cdf0e10cSrcweir Interface & 305*cdf0e10cSrcweir rOwner = ary_cast<Interface>(Storage()[i_nOwner]); 306*cdf0e10cSrcweir Function & ret = *new Function( i_sName, 307*cdf0e10cSrcweir i_nOwner, 308*cdf0e10cSrcweir rOwner.NameRoom(), 309*cdf0e10cSrcweir i_nReturnType, 310*cdf0e10cSrcweir i_bOneWay); 311*cdf0e10cSrcweir lhf_Put2Storage_and_AssignId(ret); 312*cdf0e10cSrcweir rOwner.Add_Function(ret.CeId()); 313*cdf0e10cSrcweir return ret; 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir 316*cdf0e10cSrcweir Function & 317*cdf0e10cSrcweir CeAdmin::Store_ServiceConstructor( Ce_id i_nOwner, 318*cdf0e10cSrcweir const String & i_sName ) 319*cdf0e10cSrcweir { 320*cdf0e10cSrcweir SglIfcService & 321*cdf0e10cSrcweir rOwner = ary_cast<SglIfcService>(Storage()[i_nOwner]); 322*cdf0e10cSrcweir Function & ret = *new Function( i_sName, 323*cdf0e10cSrcweir i_nOwner, 324*cdf0e10cSrcweir rOwner.NameRoom() ); 325*cdf0e10cSrcweir lhf_Put2Storage_and_AssignId(ret); 326*cdf0e10cSrcweir rOwner.Add_Constructor(ret.CeId()); 327*cdf0e10cSrcweir return ret; 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir StructElement & 331*cdf0e10cSrcweir CeAdmin::Store_StructMember( Ce_id i_nOwner, 332*cdf0e10cSrcweir const String & i_sName, 333*cdf0e10cSrcweir Type_id i_nType ) 334*cdf0e10cSrcweir { 335*cdf0e10cSrcweir Struct & 336*cdf0e10cSrcweir rOwner = ary_cast<Struct>(Storage()[i_nOwner]); 337*cdf0e10cSrcweir StructElement & ret = *new StructElement( i_sName, 338*cdf0e10cSrcweir i_nOwner, 339*cdf0e10cSrcweir rOwner.NameRoom(), 340*cdf0e10cSrcweir i_nType ); 341*cdf0e10cSrcweir lhf_Put2Storage_and_AssignId(ret); 342*cdf0e10cSrcweir rOwner.Add_Member(ret.CeId()); 343*cdf0e10cSrcweir return ret; 344*cdf0e10cSrcweir } 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir StructElement & 347*cdf0e10cSrcweir CeAdmin::Store_ExceptionMember( Ce_id i_nOwner, 348*cdf0e10cSrcweir const String & i_sName, 349*cdf0e10cSrcweir Type_id i_nType ) 350*cdf0e10cSrcweir { 351*cdf0e10cSrcweir Exception & 352*cdf0e10cSrcweir rOwner = ary_cast<Exception>(Storage()[i_nOwner]); 353*cdf0e10cSrcweir StructElement & ret = *new StructElement( i_sName, 354*cdf0e10cSrcweir i_nOwner, 355*cdf0e10cSrcweir rOwner.NameRoom(), 356*cdf0e10cSrcweir i_nType ); 357*cdf0e10cSrcweir lhf_Put2Storage_and_AssignId(ret); 358*cdf0e10cSrcweir rOwner.Add_Member(ret.CeId()); 359*cdf0e10cSrcweir return ret; 360*cdf0e10cSrcweir } 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir EnumValue & 363*cdf0e10cSrcweir CeAdmin::Store_EnumValue( Ce_id i_nOwner, 364*cdf0e10cSrcweir const String & i_sName, 365*cdf0e10cSrcweir const String & i_sValue ) 366*cdf0e10cSrcweir { 367*cdf0e10cSrcweir Enum & 368*cdf0e10cSrcweir rOwner = ary_cast<Enum>(Storage()[i_nOwner]); 369*cdf0e10cSrcweir EnumValue & ret = *new EnumValue( i_sName, 370*cdf0e10cSrcweir i_nOwner, 371*cdf0e10cSrcweir rOwner.NameRoom(), 372*cdf0e10cSrcweir i_sValue ); 373*cdf0e10cSrcweir lhf_Put2Storage_and_AssignId(ret); 374*cdf0e10cSrcweir rOwner.Add_Value(ret.CeId()); 375*cdf0e10cSrcweir return ret; 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir 378*cdf0e10cSrcweir Attribute & 379*cdf0e10cSrcweir CeAdmin::Store_Attribute( Ce_id i_nOwner, 380*cdf0e10cSrcweir const String & i_sName, 381*cdf0e10cSrcweir Type_id i_nType, 382*cdf0e10cSrcweir bool i_bReadOnly, 383*cdf0e10cSrcweir bool i_bBound ) 384*cdf0e10cSrcweir { 385*cdf0e10cSrcweir Interface & 386*cdf0e10cSrcweir rOwner = ary_cast<Interface>(Storage()[i_nOwner]); 387*cdf0e10cSrcweir 388*cdf0e10cSrcweir Attribute & ret = *new Attribute ( i_sName, 389*cdf0e10cSrcweir i_nOwner, 390*cdf0e10cSrcweir rOwner.NameRoom(), 391*cdf0e10cSrcweir i_nType, 392*cdf0e10cSrcweir i_bReadOnly, 393*cdf0e10cSrcweir i_bBound ); 394*cdf0e10cSrcweir lhf_Put2Storage_and_AssignId(ret); 395*cdf0e10cSrcweir rOwner.Add_Attribute(ret.CeId()); 396*cdf0e10cSrcweir return ret; 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir const Module & 400*cdf0e10cSrcweir CeAdmin::GlobalNamespace() const 401*cdf0e10cSrcweir { 402*cdf0e10cSrcweir csv_assert(pGlobalNamespace); 403*cdf0e10cSrcweir return *pGlobalNamespace; 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir const CodeEntity & 407*cdf0e10cSrcweir CeAdmin::Find_Ce( Ce_id i_nId ) const 408*cdf0e10cSrcweir { 409*cdf0e10cSrcweir return Storage()[i_nId]; 410*cdf0e10cSrcweir 411*cdf0e10cSrcweir } 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir const Module & 414*cdf0e10cSrcweir CeAdmin::Find_Module( Ce_id i_nId ) const 415*cdf0e10cSrcweir { 416*cdf0e10cSrcweir return ary_cast<Module>(Storage()[i_nId]); 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir const Module * 420*cdf0e10cSrcweir CeAdmin::Search_Module( Ce_id i_nId ) const 421*cdf0e10cSrcweir { 422*cdf0e10cSrcweir if (NOT i_nId.IsValid()) 423*cdf0e10cSrcweir return 0; 424*cdf0e10cSrcweir return ary_cast<Module>( & Storage()[i_nId] ); 425*cdf0e10cSrcweir } 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir const Function & 428*cdf0e10cSrcweir CeAdmin::Find_Function( Ce_id i_nId ) const 429*cdf0e10cSrcweir { 430*cdf0e10cSrcweir return ary_cast<Function>(Storage()[i_nId]); 431*cdf0e10cSrcweir } 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir const Property & 434*cdf0e10cSrcweir CeAdmin::Find_Property( Ce_id i_nId ) const 435*cdf0e10cSrcweir { 436*cdf0e10cSrcweir return ary_cast<Property>(Storage()[i_nId]); 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir const EnumValue & 440*cdf0e10cSrcweir CeAdmin::Find_EnumValue( Ce_id i_nId ) const 441*cdf0e10cSrcweir { 442*cdf0e10cSrcweir return ary_cast<EnumValue>(Storage()[i_nId]); 443*cdf0e10cSrcweir } 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir const Constant & 446*cdf0e10cSrcweir CeAdmin::Find_Constant( Ce_id i_nId ) const 447*cdf0e10cSrcweir { 448*cdf0e10cSrcweir return ary_cast<Constant>(Storage()[i_nId]); 449*cdf0e10cSrcweir } 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir const StructElement & 452*cdf0e10cSrcweir CeAdmin::Find_StructElement( Ce_id i_nId ) const 453*cdf0e10cSrcweir { 454*cdf0e10cSrcweir return ary_cast<StructElement>(Storage()[i_nId]); 455*cdf0e10cSrcweir } 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir void 458*cdf0e10cSrcweir CeAdmin::Get_Text( StringVector & o_module, 459*cdf0e10cSrcweir String & o_ce, 460*cdf0e10cSrcweir String & o_member, 461*cdf0e10cSrcweir const CodeEntity & i_ce ) const 462*cdf0e10cSrcweir { 463*cdf0e10cSrcweir const CodeEntity * pCe = &i_ce; 464*cdf0e10cSrcweir csv::erase_container(o_module); 465*cdf0e10cSrcweir o_ce.clear(); 466*cdf0e10cSrcweir o_member.clear(); 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir switch ( pCe->SightLevel() ) 469*cdf0e10cSrcweir { 470*cdf0e10cSrcweir // Here are intentionally no breaks! 471*cdf0e10cSrcweir case sl_Member: 472*cdf0e10cSrcweir if ( is_type<Function>(*pCe) ) 473*cdf0e10cSrcweir o_member = StreamLock(200)() 474*cdf0e10cSrcweir << pCe->LocalName() 475*cdf0e10cSrcweir << "()" 476*cdf0e10cSrcweir << c_str; 477*cdf0e10cSrcweir else 478*cdf0e10cSrcweir o_member = pCe->LocalName(); 479*cdf0e10cSrcweir pCe = & Storage()[pCe->Owner()]; 480*cdf0e10cSrcweir case sl_File: 481*cdf0e10cSrcweir o_ce = pCe->LocalName(); 482*cdf0e10cSrcweir pCe = & Storage()[pCe->NameRoom()]; 483*cdf0e10cSrcweir case sl_Module: 484*cdf0e10cSrcweir get_ModuleText(o_module,*pCe); 485*cdf0e10cSrcweir break; 486*cdf0e10cSrcweir default: 487*cdf0e10cSrcweir csv_assert(false); 488*cdf0e10cSrcweir } // end switch 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir 491*cdf0e10cSrcweir const NameLookup & 492*cdf0e10cSrcweir CeAdmin::NameDictionary() const 493*cdf0e10cSrcweir { 494*cdf0e10cSrcweir return *pNameDictionary; 495*cdf0e10cSrcweir } 496*cdf0e10cSrcweir 497*cdf0e10cSrcweir 498*cdf0e10cSrcweir void 499*cdf0e10cSrcweir CeAdmin::Get_AlphabeticalIndex( std::vector<Ce_id> & o_rResult, 500*cdf0e10cSrcweir alphabetical_index::E_Letter i_cLetter ) const 501*cdf0e10cSrcweir { 502*cdf0e10cSrcweir const int C_nLowerUpperDiff = 'a'-'A'; 503*cdf0e10cSrcweir 504*cdf0e10cSrcweir // Establishing filter: 505*cdf0e10cSrcweir UINT8 filter[256]; 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir UINT8 nLetter = static_cast<UINT8>(i_cLetter); 508*cdf0e10cSrcweir memset(filter, 0, 256); 509*cdf0e10cSrcweir filter[nLetter] = 1; 510*cdf0e10cSrcweir if ( i_cLetter != alphabetical_index::non_alpha ) 511*cdf0e10cSrcweir filter[nLetter - C_nLowerUpperDiff] = 1; 512*cdf0e10cSrcweir 513*cdf0e10cSrcweir // Gather entities which start with i_cLetter: 514*cdf0e10cSrcweir o_rResult.reserve(1000); 515*cdf0e10cSrcweir idl::Ce_Storage::c_iter 516*cdf0e10cSrcweir itEnd = Storage().End(); 517*cdf0e10cSrcweir for ( idl::Ce_Storage::c_iter it = Storage().BeginUnreserved(); 518*cdf0e10cSrcweir it != itEnd; 519*cdf0e10cSrcweir ++it ) 520*cdf0e10cSrcweir { 521*cdf0e10cSrcweir if ( filter[ static_cast<UINT8>(*(*it).LocalName().c_str()) ] == 1 ) 522*cdf0e10cSrcweir o_rResult.push_back( (*it).CeId() ); 523*cdf0e10cSrcweir } 524*cdf0e10cSrcweir 525*cdf0e10cSrcweir std::sort( o_rResult.begin(), 526*cdf0e10cSrcweir o_rResult.end(), 527*cdf0e10cSrcweir IdSorter<Ce_Compare>() ); 528*cdf0e10cSrcweir } 529*cdf0e10cSrcweir 530*cdf0e10cSrcweir 531*cdf0e10cSrcweir Module & 532*cdf0e10cSrcweir CeAdmin::GlobalNamespace() 533*cdf0e10cSrcweir { 534*cdf0e10cSrcweir csv_assert(pGlobalNamespace); 535*cdf0e10cSrcweir return *pGlobalNamespace; 536*cdf0e10cSrcweir } 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir CodeEntity & 539*cdf0e10cSrcweir CeAdmin::Find_Ce( Ce_id i_nId ) 540*cdf0e10cSrcweir { 541*cdf0e10cSrcweir return Storage()[i_nId]; 542*cdf0e10cSrcweir } 543*cdf0e10cSrcweir 544*cdf0e10cSrcweir void 545*cdf0e10cSrcweir CeAdmin::get_ModuleText( StringVector & o_module, 546*cdf0e10cSrcweir const CodeEntity & i_ce ) const 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir if (i_ce.NameRoom().IsValid()) 549*cdf0e10cSrcweir { 550*cdf0e10cSrcweir const CodeEntity & 551*cdf0e10cSrcweir rParent = Storage()[i_ce.NameRoom()]; 552*cdf0e10cSrcweir get_ModuleText(o_module, rParent); 553*cdf0e10cSrcweir o_module.push_back(i_ce.LocalName()); 554*cdf0e10cSrcweir } 555*cdf0e10cSrcweir } 556*cdf0e10cSrcweir 557*cdf0e10cSrcweir Struct & 558*cdf0e10cSrcweir CeAdmin::lhf_Store_TplStruct( Ce_id i_nOwner, 559*cdf0e10cSrcweir const String & i_sName, 560*cdf0e10cSrcweir Type_id i_nBase, 561*cdf0e10cSrcweir const String & i_sTemplateParam ) 562*cdf0e10cSrcweir { 563*cdf0e10cSrcweir csv_assert(NOT i_sTemplateParam.empty()); 564*cdf0e10cSrcweir 565*cdf0e10cSrcweir TemplateParamType & 566*cdf0e10cSrcweir rTpt = pTypePilot->Store_TemplateParamType(i_sTemplateParam); 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir Struct & ret = *new Struct( i_sName, 569*cdf0e10cSrcweir i_nOwner, 570*cdf0e10cSrcweir i_nBase, 571*cdf0e10cSrcweir i_sTemplateParam, 572*cdf0e10cSrcweir rTpt.TypeId() ); 573*cdf0e10cSrcweir lhf_Store_NewEntity(ret, i_nOwner); 574*cdf0e10cSrcweir rTpt.Set_StructId(ret.CeId()); 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir return ret; 577*cdf0e10cSrcweir } 578*cdf0e10cSrcweir 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir } // namespace idl 581*cdf0e10cSrcweir } // namespace ary 582