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 "c_reposypart.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES 33*cdf0e10cSrcweir #include <ary/getncast.hxx> 34*cdf0e10cSrcweir #include <ary/namesort.hxx> 35*cdf0e10cSrcweir #include <ary/cpp/c_builtintype.hxx> 36*cdf0e10cSrcweir #include <ary/cpp/c_class.hxx> 37*cdf0e10cSrcweir #include <ary/cpp/c_cppentity.hxx> 38*cdf0e10cSrcweir #include <ary/cpp/c_define.hxx> 39*cdf0e10cSrcweir #include <ary/cpp/c_enum.hxx> 40*cdf0e10cSrcweir #include <ary/cpp/c_enuval.hxx> 41*cdf0e10cSrcweir #include <ary/cpp/c_funct.hxx> 42*cdf0e10cSrcweir #include <ary/cpp/c_macro.hxx> 43*cdf0e10cSrcweir #include <ary/cpp/c_namesp.hxx> 44*cdf0e10cSrcweir #include <ary/cpp/c_tydef.hxx> 45*cdf0e10cSrcweir #include <ary/cpp/c_type.hxx> 46*cdf0e10cSrcweir #include <ary/cpp/usedtype.hxx> 47*cdf0e10cSrcweir #include <ary/cpp/c_vari.hxx> 48*cdf0e10cSrcweir #include <ary/loc/locp_le.hxx> 49*cdf0e10cSrcweir #include <ary/getncast.hxx> 50*cdf0e10cSrcweir #include <loc_internalgate.hxx> 51*cdf0e10cSrcweir #include <reposy.hxx> 52*cdf0e10cSrcweir #include "ca_ce.hxx" 53*cdf0e10cSrcweir #include "ca_def.hxx" 54*cdf0e10cSrcweir #include "ca_type.hxx" 55*cdf0e10cSrcweir #include "cs_ce.hxx" 56*cdf0e10cSrcweir #include "cs_def.hxx" 57*cdf0e10cSrcweir #include "cs_type.hxx" 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir namespace 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir using ::ary::GlobalId; 65*cdf0e10cSrcweir using ::ary::Rid; 66*cdf0e10cSrcweir using namespace ::ary::cpp; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir inline bool 70*cdf0e10cSrcweir IsDefine( const GlobalId & i_id ) 71*cdf0e10cSrcweir { 72*cdf0e10cSrcweir return i_id.Class() == Define::class_id 73*cdf0e10cSrcweir OR 74*cdf0e10cSrcweir i_id.Class() == Macro::class_id; 75*cdf0e10cSrcweir } 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir /// Find Ces 79*cdf0e10cSrcweir class TypeConnector 80*cdf0e10cSrcweir { 81*cdf0e10cSrcweir public: 82*cdf0e10cSrcweir TypeConnector( 83*cdf0e10cSrcweir Gate & i_gate ) 84*cdf0e10cSrcweir : pGate(&i_gate) {} 85*cdf0e10cSrcweir ~TypeConnector() {} 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir void operator()( 88*cdf0e10cSrcweir Type & io_rType ) const; 89*cdf0e10cSrcweir private: 90*cdf0e10cSrcweir // DATA 91*cdf0e10cSrcweir Gate * pGate; 92*cdf0e10cSrcweir }; 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir /// Find Ces only known from base class name scope. 95*cdf0e10cSrcweir class TypeConnector2ndTry 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir public: 98*cdf0e10cSrcweir TypeConnector2ndTry( 99*cdf0e10cSrcweir Gate & i_gate ) 100*cdf0e10cSrcweir : pGate(&i_gate) {} 101*cdf0e10cSrcweir ~TypeConnector2ndTry() {} 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir void operator()( 104*cdf0e10cSrcweir Type & io_rType ) const; 105*cdf0e10cSrcweir private: 106*cdf0e10cSrcweir // DATA 107*cdf0e10cSrcweir Gate * pGate; 108*cdf0e10cSrcweir }; 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir /// Reconnect (in both directions) base-derived relations of classes. 111*cdf0e10cSrcweir class HierarchyLinker 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir public: 114*cdf0e10cSrcweir HierarchyLinker( 115*cdf0e10cSrcweir Gate & i_gate ) 116*cdf0e10cSrcweir : pGate(&i_gate) {} 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir ~HierarchyLinker() {} 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir void operator()( 121*cdf0e10cSrcweir Class & io_rCe ) const; 122*cdf0e10cSrcweir private: 123*cdf0e10cSrcweir // DATA 124*cdf0e10cSrcweir Gate * pGate; 125*cdf0e10cSrcweir }; 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir /// Helper functor for ->RepositoryPartition::Get_AlphabeticalList(). 130*cdf0e10cSrcweir template <class TRAITS> 131*cdf0e10cSrcweir struct MakeGlobalId 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir GlobalId operator()( 134*cdf0e10cSrcweir typename TRAITS::id_type 135*cdf0e10cSrcweir i_id ) const 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir return GlobalId( TRAITS::EntityOf_(i_id).AryClass(), 138*cdf0e10cSrcweir i_id.Value() ); 139*cdf0e10cSrcweir } 140*cdf0e10cSrcweir }; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir /** Compare two {->GlobalId}s. 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir @todo Move this up to the definition of GlobalId<>. 149*cdf0e10cSrcweir */ 150*cdf0e10cSrcweir struct LesserGlobal 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir LesserGlobal( 153*cdf0e10cSrcweir const Ce_Storage & i_ces, 154*cdf0e10cSrcweir const Def_Storage & i_des ) 155*cdf0e10cSrcweir : rCes(i_ces), rDes(i_des) {} 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir bool operator()( 158*cdf0e10cSrcweir GlobalId i_1, 159*cdf0e10cSrcweir GlobalId i_2 ) const; 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir private: 162*cdf0e10cSrcweir const String & NameOf( 163*cdf0e10cSrcweir GlobalId i_id ) const; 164*cdf0e10cSrcweir // DATA 165*cdf0e10cSrcweir const Ce_Storage & rCes; 166*cdf0e10cSrcweir const Def_Storage & rDes; 167*cdf0e10cSrcweir ::ary::LesserName aLess; 168*cdf0e10cSrcweir }; 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir bool 172*cdf0e10cSrcweir LesserGlobal::operator()( GlobalId i_1, 173*cdf0e10cSrcweir GlobalId i_2 ) const 174*cdf0e10cSrcweir { 175*cdf0e10cSrcweir String s1 = NameOf(i_1); 176*cdf0e10cSrcweir String s2 = NameOf(i_2); 177*cdf0e10cSrcweir 178*cdf0e10cSrcweir if (s1 != s2) 179*cdf0e10cSrcweir return aLess(s1, s2); 180*cdf0e10cSrcweir 181*cdf0e10cSrcweir if ( IsDefine(i_1) != IsDefine(i_2) ) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir return NOT IsDefine(i_2); 184*cdf0e10cSrcweir } 185*cdf0e10cSrcweir else if (IsDefine(i_1)) 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir return i_1.Class() < i_2.Class(); 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir 190*cdf0e10cSrcweir return Ce_GlobalCompare::Lesser_( 191*cdf0e10cSrcweir rCes[i_1.Id()], 192*cdf0e10cSrcweir rCes[i_2.Id()] ); 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir } // namespace anonymous 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir 203*cdf0e10cSrcweir namespace ary 204*cdf0e10cSrcweir { 205*cdf0e10cSrcweir namespace cpp 206*cdf0e10cSrcweir { 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir DYN InternalGate & 209*cdf0e10cSrcweir InternalGate::Create_Partition_(RepositoryCenter & i_center) 210*cdf0e10cSrcweir { 211*cdf0e10cSrcweir return *new RepositoryPartition(i_center); 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir RepositoryPartition::RepositoryPartition(RepositoryCenter & i_center) 216*cdf0e10cSrcweir : pRepositoryCenter(&i_center), 217*cdf0e10cSrcweir pCes(0), 218*cdf0e10cSrcweir pTypes(0), 219*cdf0e10cSrcweir pDefs(0), 220*cdf0e10cSrcweir pLocations(& loc::InternalGate::Create_Locations_()) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir pCes = new CeAdmin(*this); 223*cdf0e10cSrcweir pTypes = new TypeAdmin(*this); 224*cdf0e10cSrcweir pDefs = new DefAdmin(*this); 225*cdf0e10cSrcweir pCes->Set_Related(*pTypes); 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir 228*cdf0e10cSrcweir RepositoryPartition::~RepositoryPartition() 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir } 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir void 233*cdf0e10cSrcweir RepositoryPartition::Calculate_AllSecondaryInformation() 234*cdf0e10cSrcweir // const ::autodoc::Options & ) 235*cdf0e10cSrcweir { 236*cdf0e10cSrcweir // KORR_FUTURE 237*cdf0e10cSrcweir // Forward the options from here. 238*cdf0e10cSrcweir 239*cdf0e10cSrcweir Connect_AllTypes_2_TheirRelated_CodeEntites(); 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir const String & 243*cdf0e10cSrcweir RepositoryPartition::RepositoryTitle() const 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir return static_cast< ary::Repository* >(pRepositoryCenter)->Title(); 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir const CodeEntity * 249*cdf0e10cSrcweir RepositoryPartition::Search_RelatedCe(Type_id i_type) const 250*cdf0e10cSrcweir { 251*cdf0e10cSrcweir if (NOT i_type.IsValid()) 252*cdf0e10cSrcweir return 0; 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir Ce_id 255*cdf0e10cSrcweir ce_id = pTypes->Find_Type(i_type).RelatedCe(); 256*cdf0e10cSrcweir return ce_id.IsValid() 257*cdf0e10cSrcweir ? & pCes->Find_Ce(ce_id) 258*cdf0e10cSrcweir : (CodeEntity*)(0); 259*cdf0e10cSrcweir } 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir const ::ary::cpp::CppEntity * 262*cdf0e10cSrcweir RepositoryPartition::Search_Entity(GlobalId i_id) const 263*cdf0e10cSrcweir { 264*cdf0e10cSrcweir if (i_id.Id() == 0) 265*cdf0e10cSrcweir return 0; 266*cdf0e10cSrcweir 267*cdf0e10cSrcweir if ( NOT IsDefine(i_id) ) 268*cdf0e10cSrcweir { 269*cdf0e10cSrcweir // Shall make sure this is a C++ CodeEntity: 270*cdf0e10cSrcweir csv_assert( i_id.Class() >= Namespace::class_id 271*cdf0e10cSrcweir AND 272*cdf0e10cSrcweir i_id.Class() < BuiltInType::class_id 273*cdf0e10cSrcweir && "Unexpected entity type in cpp::RepositoryPartition" 274*cdf0e10cSrcweir "::Search_Entity()." ); 275*cdf0e10cSrcweir return & Ces().Find_Ce( Ce_id(i_id.Id()) ); 276*cdf0e10cSrcweir } 277*cdf0e10cSrcweir else 278*cdf0e10cSrcweir { 279*cdf0e10cSrcweir return & Defs().Find_Def( De_id(i_id.Id()) ); 280*cdf0e10cSrcweir } 281*cdf0e10cSrcweir } 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir const CePilot & 285*cdf0e10cSrcweir RepositoryPartition::Ces() const 286*cdf0e10cSrcweir { 287*cdf0e10cSrcweir csv_assert(pCes != 0); 288*cdf0e10cSrcweir return *pCes; 289*cdf0e10cSrcweir } 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir const DefPilot & 292*cdf0e10cSrcweir RepositoryPartition::Defs() const 293*cdf0e10cSrcweir { 294*cdf0e10cSrcweir csv_assert(pDefs != 0); 295*cdf0e10cSrcweir return *pDefs; 296*cdf0e10cSrcweir } 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir const TypePilot & 299*cdf0e10cSrcweir RepositoryPartition::Types() const 300*cdf0e10cSrcweir { 301*cdf0e10cSrcweir csv_assert(pTypes != 0); 302*cdf0e10cSrcweir return *pTypes; 303*cdf0e10cSrcweir } 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir const loc::LocationPilot & 306*cdf0e10cSrcweir RepositoryPartition::Locations() const 307*cdf0e10cSrcweir { 308*cdf0e10cSrcweir csv_assert(pLocations != 0); 309*cdf0e10cSrcweir return *pLocations; 310*cdf0e10cSrcweir } 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir CePilot & 313*cdf0e10cSrcweir RepositoryPartition::Ces() 314*cdf0e10cSrcweir { 315*cdf0e10cSrcweir csv_assert(pCes != 0); 316*cdf0e10cSrcweir return *pCes; 317*cdf0e10cSrcweir } 318*cdf0e10cSrcweir 319*cdf0e10cSrcweir DefPilot & 320*cdf0e10cSrcweir RepositoryPartition::Defs() 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir csv_assert(pDefs != 0); 323*cdf0e10cSrcweir return *pDefs; 324*cdf0e10cSrcweir } 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir TypePilot & 327*cdf0e10cSrcweir RepositoryPartition::Types() 328*cdf0e10cSrcweir { 329*cdf0e10cSrcweir csv_assert(pTypes != 0); 330*cdf0e10cSrcweir return *pTypes; 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir loc::LocationPilot & 334*cdf0e10cSrcweir RepositoryPartition::Locations() 335*cdf0e10cSrcweir { 336*cdf0e10cSrcweir csv_assert(pLocations != 0); 337*cdf0e10cSrcweir return *pLocations; 338*cdf0e10cSrcweir } 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir 341*cdf0e10cSrcweir void 342*cdf0e10cSrcweir RepositoryPartition::Connect_AllTypes_2_TheirRelated_CodeEntites() 343*cdf0e10cSrcweir { 344*cdf0e10cSrcweir TypeConnector 345*cdf0e10cSrcweir aConnector(*this); 346*cdf0e10cSrcweir std::for_each( pTypes->Storage().BeginUnreserved(), 347*cdf0e10cSrcweir pTypes->Storage().End(), 348*cdf0e10cSrcweir aConnector ); 349*cdf0e10cSrcweir 350*cdf0e10cSrcweir typedef ::ary::stg::filter_iterator<CodeEntity,Class> 351*cdf0e10cSrcweir filter_class_iter; 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir HierarchyLinker 354*cdf0e10cSrcweir aHierarchyLinker(*this); 355*cdf0e10cSrcweir filter_class_iter itEnd( pCes->Storage().End() ); 356*cdf0e10cSrcweir for ( filter_class_iter it( pCes->Storage().BeginUnreserved() ); 357*cdf0e10cSrcweir it != itEnd; 358*cdf0e10cSrcweir ++it ) 359*cdf0e10cSrcweir { 360*cdf0e10cSrcweir if (NOT it.IsValid()) 361*cdf0e10cSrcweir continue; 362*cdf0e10cSrcweir 363*cdf0e10cSrcweir if (is_type<Class>(*it)) 364*cdf0e10cSrcweir aHierarchyLinker(ary_cast<Class>(*it)); 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir 367*cdf0e10cSrcweir TypeConnector2ndTry 368*cdf0e10cSrcweir aConnector2ndTry(*this); 369*cdf0e10cSrcweir std::for_each( pTypes->Storage().BeginUnreserved(), 370*cdf0e10cSrcweir pTypes->Storage().End(), 371*cdf0e10cSrcweir aConnector2ndTry ); 372*cdf0e10cSrcweir } 373*cdf0e10cSrcweir 374*cdf0e10cSrcweir template <class COMPARE> 375*cdf0e10cSrcweir void Add2Result( 376*cdf0e10cSrcweir List_GlobalIds & o_result, 377*cdf0e10cSrcweir const SortedIds<COMPARE> & 378*cdf0e10cSrcweir i_data, 379*cdf0e10cSrcweir const char * i_begin, 380*cdf0e10cSrcweir const char * i_end ); 381*cdf0e10cSrcweir template <class COMPARE> 382*cdf0e10cSrcweir void 383*cdf0e10cSrcweir Add2Result( List_GlobalIds & o_result, 384*cdf0e10cSrcweir const SortedIds<COMPARE> & i_data, 385*cdf0e10cSrcweir const char * i_begin, 386*cdf0e10cSrcweir const char * i_end ) 387*cdf0e10cSrcweir { 388*cdf0e10cSrcweir const size_t 389*cdf0e10cSrcweir previous_size = o_result.size(); 390*cdf0e10cSrcweir typename std::vector<typename COMPARE::id_type>::const_iterator 391*cdf0e10cSrcweir it_beg = i_data.LowerBound(i_begin); 392*cdf0e10cSrcweir typename std::vector<typename COMPARE::id_type>::const_iterator 393*cdf0e10cSrcweir it_end = i_data.LowerBound(i_end); 394*cdf0e10cSrcweir size_t 395*cdf0e10cSrcweir count_added = static_cast<size_t>( std::distance(it_beg,it_end) ); 396*cdf0e10cSrcweir o_result.insert( o_result.end(), 397*cdf0e10cSrcweir count_added, 398*cdf0e10cSrcweir GlobalId() ); 399*cdf0e10cSrcweir List_GlobalIds::iterator 400*cdf0e10cSrcweir it_out = o_result.begin() + previous_size; 401*cdf0e10cSrcweir std::transform( it_beg, it_end, 402*cdf0e10cSrcweir it_out, 403*cdf0e10cSrcweir MakeGlobalId<COMPARE>() ); 404*cdf0e10cSrcweir } 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir 407*cdf0e10cSrcweir uintt 408*cdf0e10cSrcweir RepositoryPartition::Get_AlphabeticalList( List_GlobalIds & o_result, 409*cdf0e10cSrcweir const char * i_begin, 410*cdf0e10cSrcweir const char * i_end ) const 411*cdf0e10cSrcweir { 412*cdf0e10cSrcweir size_t 413*cdf0e10cSrcweir ret = o_result.size(); 414*cdf0e10cSrcweir 415*cdf0e10cSrcweir const Ce_Storage & 416*cdf0e10cSrcweir ce_storage = pCes->Storage(); 417*cdf0e10cSrcweir const Def_Storage & 418*cdf0e10cSrcweir def_storage = pDefs->Storage(); 419*cdf0e10cSrcweir 420*cdf0e10cSrcweir Add2Result( o_result, 421*cdf0e10cSrcweir ce_storage.TypeIndex(), 422*cdf0e10cSrcweir i_begin, i_end ); 423*cdf0e10cSrcweir Add2Result( o_result, 424*cdf0e10cSrcweir ce_storage.OperationIndex(), 425*cdf0e10cSrcweir i_begin, i_end ); 426*cdf0e10cSrcweir Add2Result( o_result, 427*cdf0e10cSrcweir ce_storage.DataIndex(), 428*cdf0e10cSrcweir i_begin, i_end ); 429*cdf0e10cSrcweir Add2Result( o_result, 430*cdf0e10cSrcweir def_storage.DefineIndex(), 431*cdf0e10cSrcweir i_begin, i_end ); 432*cdf0e10cSrcweir Add2Result( o_result, 433*cdf0e10cSrcweir def_storage.MacroIndex(), 434*cdf0e10cSrcweir i_begin, i_end ); 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir LesserGlobal 437*cdf0e10cSrcweir aLess(ce_storage, def_storage); 438*cdf0e10cSrcweir 439*cdf0e10cSrcweir std::sort(o_result.begin(), o_result.end(), aLess); 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir return o_result.size() - ret; 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir 445*cdf0e10cSrcweir 446*cdf0e10cSrcweir 447*cdf0e10cSrcweir } // namespace cpp 448*cdf0e10cSrcweir } // namespace ary 449*cdf0e10cSrcweir 450*cdf0e10cSrcweir 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir namespace 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir 457*cdf0e10cSrcweir 458*cdf0e10cSrcweir void 459*cdf0e10cSrcweir TypeConnector::operator()( Type & io_rType ) const 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir csv_assert(pGate != 0); 462*cdf0e10cSrcweir UsedType * 463*cdf0e10cSrcweir pt = ::ary::ary_cast<UsedType>(&io_rType); 464*cdf0e10cSrcweir if (pt != 0) 465*cdf0e10cSrcweir pt->Connect2Ce(pGate->Ces()); 466*cdf0e10cSrcweir } 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir void 469*cdf0e10cSrcweir TypeConnector2ndTry::operator()( Type & io_rType ) const 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir csv_assert(pGate != 0); 472*cdf0e10cSrcweir UsedType * 473*cdf0e10cSrcweir pt = ::ary::ary_cast<UsedType>(&io_rType); 474*cdf0e10cSrcweir if (pt != 0) 475*cdf0e10cSrcweir pt->Connect2CeOnlyKnownViaBaseClass(*pGate); 476*cdf0e10cSrcweir } 477*cdf0e10cSrcweir 478*cdf0e10cSrcweir void 479*cdf0e10cSrcweir HierarchyLinker::operator()( Class & io_rCe ) const 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir csv_assert( ::ary::is_type<Class>(io_rCe) ); 482*cdf0e10cSrcweir Class & 483*cdf0e10cSrcweir rClass = io_rCe; 484*cdf0e10cSrcweir 485*cdf0e10cSrcweir for ( List_Bases::const_iterator it = rClass.BaseClasses().begin(); 486*cdf0e10cSrcweir it != rClass.BaseClasses().end(); 487*cdf0e10cSrcweir ++it ) 488*cdf0e10cSrcweir { 489*cdf0e10cSrcweir const CodeEntity * 490*cdf0e10cSrcweir pCe = 0; 491*cdf0e10cSrcweir Type_id 492*cdf0e10cSrcweir nTid = (*it).nId; 493*cdf0e10cSrcweir for ( pCe = pGate->Search_RelatedCe(nTid); 494*cdf0e10cSrcweir ary::ary_cast<Typedef>(pCe) != 0; 495*cdf0e10cSrcweir pCe = pGate->Search_RelatedCe(nTid) ) 496*cdf0e10cSrcweir { 497*cdf0e10cSrcweir nTid = static_cast< const Typedef* >(pCe)->DescribingType(); 498*cdf0e10cSrcweir } 499*cdf0e10cSrcweir const Class * 500*cdf0e10cSrcweir pClass = ary::ary_cast<Class>(pCe); 501*cdf0e10cSrcweir if (pClass == 0) 502*cdf0e10cSrcweir return; 503*cdf0e10cSrcweir // KORR_FUTURE: we need a non const Find_Class() 504*cdf0e10cSrcweir const_cast< Class* >(pClass)->Add_KnownDerivative( io_rCe.CeId() ); 505*cdf0e10cSrcweir } 506*cdf0e10cSrcweir } 507*cdf0e10cSrcweir 508*cdf0e10cSrcweir const String & 509*cdf0e10cSrcweir LesserGlobal::NameOf(GlobalId i_id) const 510*cdf0e10cSrcweir { 511*cdf0e10cSrcweir if ( NOT IsDefine(i_id) ) 512*cdf0e10cSrcweir { 513*cdf0e10cSrcweir return rCes[i_id.Id()].LocalName(); 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir else 516*cdf0e10cSrcweir { 517*cdf0e10cSrcweir return rDes[i_id.Id()].LocalName(); 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir } 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir 522*cdf0e10cSrcweir 523*cdf0e10cSrcweir } // namespace anonymous 524