00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TBranchBrowsable.h"
00013 #include "TBranchElement.h"
00014 #include "TBranchObject.h"
00015 #include "TMethod.h"
00016 #include "TBrowser.h"
00017 #include "TTree.h"
00018 #include "TLeafObject.h"
00019 #include "TClonesArray.h"
00020 #include "TVirtualPad.h"
00021 #include "TClass.h"
00022 #include "TBaseClass.h"
00023 #include "TDataMember.h"
00024 #include "TStreamerInfo.h"
00025 #include "TStreamerElement.h"
00026 #include "TVirtualCollectionProxy.h"
00027 #include "TRef.h"
00028 #include <algorithm>
00029
00030 R__EXTERN TTree *gTree;
00031
00032 ClassImp(TVirtualBranchBrowsable);
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 std::list<TVirtualBranchBrowsable::MethodCreateListOfBrowsables_t>
00071 TVirtualBranchBrowsable::fgGenerators;
00072 Bool_t TVirtualBranchBrowsable::fgGeneratorsSet=kFALSE;
00073
00074
00075 TVirtualBranchBrowsable::TVirtualBranchBrowsable(const TBranch* branch, TClass* type,
00076 Bool_t typeIsPointer,
00077 const TVirtualBranchBrowsable* parent ):
00078 fBranch(branch), fParent(parent), fLeaves(0), fClass(type), fTypeIsPointer(typeIsPointer)
00079 {
00080
00081 if (!fgGeneratorsSet) RegisterDefaultGenerators();
00082 if (!branch)
00083 Warning("TVirtualBranchBrowsable", "branch is NULL!");
00084 }
00085
00086
00087 TVirtualBranchBrowsable::~TVirtualBranchBrowsable()
00088 {
00089
00090 delete fLeaves;
00091 }
00092
00093
00094 void TVirtualBranchBrowsable::Browse(TBrowser *b)
00095 {
00096
00097
00098
00099 if (!fClass) {
00100 TString name;
00101 GetScope(name);
00102
00103
00104
00105
00106 name.ReplaceAll(".@","@.");
00107 name.ReplaceAll("->@","@->");
00108
00109 TTree* tree=0;
00110 if (!fBranch) {
00111 Warning("Browse", "branch not set - might access wrong tree!");
00112 tree=gTree;
00113 } else tree=fBranch->GetTree();
00114 tree->Draw(name, "", b ? b->GetDrawOption() : "");
00115 if (gPad) gPad->Update();
00116 } else
00117 if (GetLeaves()) GetLeaves()->Browse(b);
00118 }
00119
00120
00121 Int_t TVirtualBranchBrowsable::FillListOfBrowsables(TList& li, const TBranch* branch,
00122 const TVirtualBranchBrowsable* parent )
00123 {
00124
00125
00126
00127
00128
00129 if (!fgGeneratorsSet) RegisterDefaultGenerators();
00130 std::list<MethodCreateListOfBrowsables_t>::iterator iGenerator;
00131 Int_t numCreated=0;
00132 for (iGenerator=fgGenerators.begin(); iGenerator!=fgGenerators.end(); iGenerator++)
00133 numCreated+=(*(*iGenerator))(li, branch, parent);
00134 return numCreated;
00135 }
00136
00137
00138 TClass* TVirtualBranchBrowsable::GetCollectionContainedType(const TBranch* branch,
00139 const TVirtualBranchBrowsable* parent,
00140 TClass* &contained)
00141 {
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151 contained=0;
00152 TClass* type=0;
00153 if (parent)
00154 type=parent->GetClassType();
00155 else if (branch) {
00156 if (branch->IsA()==TBranchElement::Class()) {
00157
00158 TBranchElement* be=(TBranchElement*) branch;
00159
00160
00161 const char* clonesname=be->GetClonesName();
00162 if (clonesname && strlen(clonesname))
00163 contained=TClass::GetClass(clonesname);
00164
00165
00166
00167 ULong_t *elems=0;
00168 TStreamerElement *element=0;
00169 if (be->GetID()>=0 && be->GetInfo()
00170 && (be->GetID() < be->GetInfo()->GetNdata())
00171 && ((elems=be->GetInfo()->GetElems()))
00172 && ((element=(TStreamerElement *)elems[be->GetID()]))) {
00173
00174
00175
00176 if (contained)
00177
00178 return element->GetClassPointer();
00179 else
00180 type=element->GetClassPointer();
00181 } else if (clonesname && strlen(clonesname)) {
00182
00183 contained=TClass::GetClass(clonesname);
00184 return TClass::GetClass(be->GetClassName());
00185 } else
00186 type=TClass::GetClass(be->GetClassName());
00187 } else if (branch->IsA()==TBranchObject::Class()) {
00188
00189 TBranchObject* bo=(TBranchObject*)branch;
00190 const char* clonesname=bo->GetClassName();
00191 contained=0;
00192 if (!clonesname || !strlen(clonesname)) return 0;
00193 type=TClass::GetClass(clonesname);
00194 }
00195 } else {
00196 if (gTree) gTree->Warning("GetCollectionContainedType", "Neither branch nor parent given!");
00197 return 0;
00198 }
00199
00200 if (!type) return 0;
00201
00202 TBranch* branchNonCost=const_cast<TBranch*>(branch);
00203 if (type->InheritsFrom(TClonesArray::Class())
00204 && branch->IsA()==TBranchObject::Class()
00205 && branchNonCost->GetListOfLeaves()
00206 && branchNonCost->GetListOfLeaves()->GetEntriesFast()==1) {
00207
00208
00209
00210
00211
00212 if (branch->GetReadEntry()==-1) branchNonCost->GetEntry(0);
00213
00214 TLeafObject* lo = (TLeafObject*)branchNonCost->GetListOfLeaves()->First();
00215 if (lo) {
00216 TObject* objContainer = lo->GetObject();
00217 if (objContainer && objContainer->IsA()==TClonesArray::Class()) {
00218 contained = ((TClonesArray*)objContainer)->GetClass();
00219 }
00220 }
00221 return type;
00222 } else if (type->InheritsFrom(TClonesArray::Class())
00223 && branch->IsA()==TBranchElement::Class()
00224 && branchNonCost->GetListOfLeaves()
00225 && branchNonCost->GetListOfLeaves()->GetEntriesFast()==1) {
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242 return type;
00243 } else if (type->InheritsFrom(TCollection::Class())) {
00244
00245 return type;
00246 } else if (type->GetCollectionProxy()) {
00247 contained=type->GetCollectionProxy()->GetValueClass();
00248 return type;
00249 } else if (type->InheritsFrom(TRef::Class()))
00250
00251 return 0;
00252 else contained=type;
00253 return 0;
00254 }
00255
00256
00257 TList* TVirtualBranchBrowsable::GetLeaves() const
00258 {
00259
00260 if (!fLeaves) {
00261 TList* leaves=new TList();
00262 leaves->SetOwner();
00263 FillListOfBrowsables(*leaves, GetBranch(), this);
00264 const_cast<TVirtualBranchBrowsable*>(this)->fLeaves=leaves;
00265 }
00266 return fLeaves;
00267 }
00268
00269
00270 std::list<TVirtualBranchBrowsable::MethodCreateListOfBrowsables_t>& TVirtualBranchBrowsable::GetRegisteredGenerators()
00271 {
00272
00273 return fgGenerators;
00274 }
00275
00276
00277 void TVirtualBranchBrowsable::GetScope(TString & scope) const
00278 {
00279
00280
00281
00282
00283
00284 if (fParent)
00285 fParent->GetScope(scope);
00286 else {
00287 scope=fBranch->GetName();
00288 Ssiz_t pos = scope.First('[');
00289 if (pos != kNPOS) {
00290 scope.Remove(pos);
00291 }
00292 if (!scope.EndsWith(".")) scope+=".";
00293 const TBranch* mother=fBranch;
00294 while (mother != mother->GetMother() && (mother=mother->GetMother())) {
00295 TString nameMother(mother->GetName());
00296 if (!nameMother.EndsWith(".")) {
00297 scope.Prepend(".");
00298 scope.Prepend(nameMother);
00299 } else {
00300 if (mother != mother->GetMother()) {
00301
00302
00303
00304 scope.Prepend(nameMother);
00305 }
00306 }
00307 }
00308 }
00309 if (GetName() && GetName()[0]=='.')
00310 scope+=(GetName()+1);
00311 else
00312 scope+=GetName();
00313 if (fClass && !scope.EndsWith(".")) {
00314 if (fTypeIsPointer)
00315 scope+="->";
00316 else scope+=".";
00317 }
00318 }
00319
00320
00321
00322 void TVirtualBranchBrowsable::RegisterDefaultGenerators()
00323 {
00324
00325
00326
00327 if (fgGeneratorsSet) return;
00328
00329 fgGenerators.push_back(&TMethodBrowsable::GetBrowsables);
00330 fgGenerators.push_back(&TNonSplitBrowsable::GetBrowsables);
00331 fgGenerators.push_back(&TCollectionPropertyBrowsable::GetBrowsables);
00332 fgGeneratorsSet=kTRUE;
00333 }
00334
00335 void TVirtualBranchBrowsable::RegisterGenerator(MethodCreateListOfBrowsables_t generator)
00336 {
00337
00338
00339
00340 if (!fgGeneratorsSet) RegisterDefaultGenerators();
00341
00342 fgGenerators.remove(generator);
00343 fgGenerators.push_back(generator);
00344 }
00345
00346 void TVirtualBranchBrowsable::UnregisterGenerator(MethodCreateListOfBrowsables_t generator)
00347 {
00348
00349
00350
00351
00352 if (!fgGeneratorsSet) RegisterDefaultGenerators();
00353 fgGenerators.remove(generator);
00354 }
00355
00356
00357 ClassImp(TMethodBrowsable);
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381 TMethodBrowsable::TMethodBrowsable(const TBranch* branch, TMethod* m,
00382 const TVirtualBranchBrowsable* parent ):
00383 TVirtualBranchBrowsable(branch, 0, kFALSE, parent), fMethod(m)
00384 {
00385
00386
00387
00388
00389
00390
00391 TString name(m->GetName());
00392 name+="()";
00393 if (name.EndsWith(" const")) name.Remove(name.Length()-6);
00394 SetName(name);
00395
00396 name=m->GetPrototype();
00397 if (m->GetCommentString() && strlen(m->GetCommentString()))
00398 name.Append(" // ").Append(m->GetCommentString());
00399 SetTitle(name);
00400
00401 TString plainReturnType(m->GetReturnTypeName());
00402 if (plainReturnType.EndsWith("*")) {
00403 SetTypeIsPointer();
00404 plainReturnType.Remove(plainReturnType.Length()-1);
00405 plainReturnType.Strip();
00406 if(plainReturnType.BeginsWith("const")) {
00407 plainReturnType.Remove(0,5);
00408 plainReturnType.Strip();
00409 }
00410 }
00411 SetType(TClass::GetClass(plainReturnType));
00412 }
00413
00414
00415 void TMethodBrowsable::GetBrowsableMethodsForClass(TClass* cl, TList& li)
00416 {
00417
00418
00419
00420
00421
00422
00423
00424 if (!cl) return;
00425 TList allClasses;
00426 allClasses.Add(cl);
00427
00428 if (cl->IsLoaded()) {
00429 for(TObjLink* lnk=allClasses.FirstLink();
00430 lnk; lnk=lnk->Next()) {
00431 cl=(TClass*)lnk->GetObject();
00432 TList* bases=cl->GetListOfBases();
00433 TBaseClass* base;
00434 TIter iB(bases);
00435 while ((base=(TBaseClass*)iB())) {
00436 TClass* bc=base->GetClassPointer();
00437 if (bc) allClasses.Add(bc);
00438 }
00439 }
00440 } else {
00441 TVirtualStreamerInfo *info = cl->GetStreamerInfo();
00442 for(int el = 0; el < info->GetElements()->GetEntries(); ++el) {
00443 TStreamerElement *element = (TStreamerElement *)info->GetElements()->UncheckedAt(el);
00444 if (element->IsBase()) {
00445 TClass *bc = element->GetClassPointer();
00446 if (bc) allClasses.Add(bc);
00447 }
00448 }
00449 }
00450
00451 TList allMethods;
00452 TIter iC(&allClasses);
00453 while ((cl=(TClass*)iC())) {
00454 TList* methods=cl->GetListOfMethods();
00455 if (!methods) continue;
00456 TMethod* method=0;
00457 TIter iM(methods);
00458 while ((method=(TMethod*)iM()))
00459 if (method && !allMethods.FindObject(method->GetName()))
00460 allMethods.Add(method);
00461 }
00462
00463 TIter iM(&allMethods);
00464 TMethod* m=0;
00465 while ((m=(TMethod*)iM())) {
00466 if (TMethodBrowsable::IsMethodBrowsable(m)) {
00467 li.Add(m);
00468 }
00469 }
00470 }
00471
00472
00473
00474 Int_t TMethodBrowsable::GetBrowsables(TList& li, const TBranch* branch,
00475 const TVirtualBranchBrowsable* parent )
00476 {
00477
00478
00479
00480
00481
00482 TClass* cl;
00483
00484
00485 GetCollectionContainedType(branch, parent, cl);
00486 if (!cl) return 0;
00487
00488 TList listMethods;
00489 GetBrowsableMethodsForClass(cl, listMethods);
00490 TMethod* method=0;
00491 TIter iMethods(&listMethods);
00492 while ((method=(TMethod*)iMethods())) {
00493 li.Add(new TMethodBrowsable(branch, method, parent));
00494 }
00495 return listMethods.GetSize();
00496 }
00497
00498
00499 Bool_t TMethodBrowsable::IsMethodBrowsable(const TMethod* m)
00500 {
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510 if (m->GetNargs()-m->GetNargsOpt()==0
00511 && (m->Property() & kIsConstant
00512 & ~kIsPrivate & ~kIsProtected & ~kIsPureVirtual )
00513 && m->GetReturnTypeName()
00514 && strcmp("void",m->GetReturnTypeName())
00515 && !strstr(m->GetName(),"DeclFile")
00516 && !strstr(m->GetName(),"ImplFile")
00517 && strcmp(m->GetName(),"IsA")
00518 && strcmp(m->GetName(),"Class")
00519 && strcmp(m->GetName(),"CanBypassStreamer")
00520 && strcmp(m->GetName(),"Class_Name")
00521 && strcmp(m->GetName(),"ClassName")
00522 && strcmp(m->GetName(),"Clone")
00523 && strcmp(m->GetName(),"DrawClone")
00524 && strcmp(m->GetName(),"GetName")
00525 && strcmp(m->GetName(),"GetDrawOption")
00526 && strcmp(m->GetName(),"GetIconName")
00527 && strcmp(m->GetName(),"GetOption")
00528 && strcmp(m->GetName(),"GetTitle")
00529 && strcmp(m->GetName(),"GetUniqueID")
00530 && strcmp(m->GetName(),"Hash")
00531 && strcmp(m->GetName(),"IsFolder")
00532 && strcmp(m->GetName(),"IsOnHeap")
00533 && strcmp(m->GetName(),"IsSortable")
00534 && strcmp(m->GetName(),"IsZombie")) {
00535
00536
00537 TClass* cl=m->GetClass();
00538 if (!cl) return kTRUE;
00539 TList* members=cl->GetListOfDataMembers();
00540 if (!members) return kTRUE;
00541 const char* baseName=m->GetName();
00542 if (!strncmp(m->GetName(), "Get", 3) ||
00543 !strncmp(m->GetName(), "get", 3))
00544 baseName+=3;
00545 if (!baseName[0]) return kTRUE;
00546
00547 TObject* mem=0;
00548 const char* arrMemberNames[3]={"f%s","_%s","m%s"};
00549 for (Int_t i=0; !mem && i<3; i++)
00550 mem=members->FindObject(Form(arrMemberNames[i],baseName));
00551 return (!mem ||! ((TDataMember*)mem)->IsPersistent());
00552 };
00553 return kFALSE;
00554 }
00555
00556
00557 void TMethodBrowsable::Register()
00558 {
00559
00560
00561
00562 TVirtualBranchBrowsable::RegisterGenerator(GetBrowsables);
00563 }
00564
00565
00566 void TMethodBrowsable::Unregister()
00567 {
00568
00569
00570
00571 TVirtualBranchBrowsable::UnregisterGenerator(GetBrowsables);
00572 }
00573
00574
00575 ClassImp(TNonSplitBrowsable);
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593 TNonSplitBrowsable::TNonSplitBrowsable(const TStreamerElement* element, const TBranch* branch,
00594 const TVirtualBranchBrowsable* parent ):
00595 TVirtualBranchBrowsable(branch, element->GetClassPointer(),
00596 element->IsaPointer(), parent)
00597 {
00598
00599
00600 SetNameTitle(element->GetName(), element->GetTitle());
00601 }
00602
00603
00604
00605 Int_t TNonSplitBrowsable::GetBrowsables(TList& li, const TBranch* branch,
00606 const TVirtualBranchBrowsable* parent )
00607 {
00608
00609
00610
00611
00612
00613 if (parent==0
00614 && (branch==0 ||
00615 (const_cast<TBranch*>(branch)->GetListOfBranches()
00616 && const_cast<TBranch*>(branch)->GetListOfBranches()->GetEntries()!=0)
00617 )
00618 ) {
00619 return 0;
00620 }
00621
00622
00623
00624 TClass* clContained=0;
00625 GetCollectionContainedType(branch, parent, clContained);
00626 TVirtualStreamerInfo* streamerInfo= clContained?clContained->GetStreamerInfo():0;
00627 if (!streamerInfo
00628 || !streamerInfo->GetElements()
00629 || !streamerInfo->GetElements()->GetSize()) return 0;
00630
00631 if (!branch && parent) branch=parent->GetBranch();
00632
00633
00634 TList myStreamerElementsToCheck;
00635 myStreamerElementsToCheck.AddAll(streamerInfo->GetElements());
00636
00637 Int_t numAdded=0;
00638 TStreamerElement* streamerElement=0;
00639 for (TObjLink *link = myStreamerElementsToCheck.FirstLink();
00640 link;
00641 link = link->Next() ) {
00642 streamerElement = (TStreamerElement*)link->GetObject();
00643 if (streamerElement->IsBase()) {
00644
00645
00646 TClass* base=streamerElement->GetClassPointer();
00647 if (!base || !base->GetStreamerInfo()) continue;
00648
00649
00650
00651
00652 TObjArray* baseElements=base->GetStreamerInfo()->GetElements();
00653 if (!baseElements) continue;
00654 TIter iBaseSE(baseElements);
00655 TStreamerElement* baseSE=0;
00656 while ((baseSE=(TStreamerElement*)iBaseSE()))
00657
00658 myStreamerElementsToCheck.Add(baseSE);
00659 } else if (!strcmp(streamerElement->GetName(),"This")
00660 && !strcmp(clContained->GetName(), streamerElement->GetTypeName())) {
00661
00662
00663 TClass* clElements=streamerElement->GetClassPointer();
00664 TVirtualCollectionProxy* collProxy=clElements?clElements->GetCollectionProxy():0;
00665 clElements=collProxy?collProxy->GetValueClass():0;
00666 if (!clElements) continue;
00667
00668
00669 streamerInfo= clElements->GetStreamerInfo();
00670 TIter iElem(streamerInfo->GetElements());
00671 TStreamerElement* elem=0;
00672 while ((elem=(TStreamerElement*)iElem())) {
00673 TNonSplitBrowsable* nsb=new TNonSplitBrowsable(elem, branch, parent);
00674 li.Add(nsb);
00675 numAdded++;
00676 }
00677 } else {
00678
00679 TNonSplitBrowsable* nsb=new TNonSplitBrowsable(streamerElement, branch, parent);
00680 li.Add(nsb);
00681 numAdded++;
00682 }
00683 }
00684 return numAdded;
00685 }
00686
00687
00688 void TNonSplitBrowsable::Register()
00689 {
00690
00691
00692
00693 TVirtualBranchBrowsable::RegisterGenerator(GetBrowsables);
00694 }
00695
00696
00697 void TNonSplitBrowsable::Unregister()
00698 {
00699
00700
00701
00702 TVirtualBranchBrowsable::UnregisterGenerator(GetBrowsables);
00703 }
00704
00705
00706 ClassImp(TCollectionPropertyBrowsable);
00707
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726 void TCollectionPropertyBrowsable::Browse(TBrowser *b)
00727 {
00728
00729
00730 GetBranch()->GetTree()->Draw(GetDraw(), "", b ? b->GetDrawOption() : "");
00731 if (gPad) gPad->Update();
00732 }
00733
00734
00735 Int_t TCollectionPropertyBrowsable::GetBrowsables(TList& li, const TBranch* branch,
00736 const TVirtualBranchBrowsable* parent )
00737 {
00738
00739
00740
00741
00742
00743
00744
00745 TClass* clContained=0;
00746 TClass* clCollection=GetCollectionContainedType(branch, parent, clContained);
00747 if (!clCollection || !clContained) return 0;
00748
00749
00750 TString scope;
00751 if (parent) {
00752 parent->GetScope(scope);
00753 branch=parent->GetBranch();
00754 } else if (branch){
00755 scope=branch->GetName();
00756 scope+=".";
00757 const TBranch* mother=branch;
00758 while (mother != mother->GetMother() && (mother=mother->GetMother())) {
00759 TString nameMother(mother->GetName());
00760 if (!nameMother.EndsWith(".")) {
00761 scope.Prepend(".");
00762 scope.Prepend(nameMother);
00763 } else {
00764 if (mother != mother->GetMother()) {
00765
00766
00767
00768 scope.Prepend(nameMother);
00769 }
00770 }
00771 }
00772 } else {
00773 if (gTree)
00774 gTree->Warning("GetBrowsables", "Neither branch nor parent is set!");
00775 return 0;
00776 }
00777
00778
00779 if (scope.EndsWith(".")) scope.Remove(scope.Length()-1, 1);
00780 else if (scope.EndsWith("->")) scope.Remove(scope.Length()-2, 2);
00781
00782
00783
00784 Ssiz_t lastDot=scope.Last('.');
00785 Ssiz_t lastArrow=scope.Last('>');
00786 Ssiz_t lastPart=lastDot;
00787 if (lastPart==kNPOS || (lastArrow!=kNPOS && lastPart<lastArrow))
00788 lastPart=lastArrow;
00789 if (lastPart==kNPOS) lastPart=0;
00790 else lastPart++;
00791
00792 TString size_title("size of ");
00793 size_title += clCollection->GetName();
00794 if (clContained) {
00795 size_title += " of ";
00796 size_title += clContained->GetName();
00797 }
00798
00799 if (clCollection->GetCollectionProxy() || clCollection==TClonesArray::Class()) {
00800
00801
00802 TCollectionPropertyBrowsable* cpb;
00803 if ( clCollection->GetCollectionProxy() &&
00804 ( (clCollection->GetCollectionProxy()->GetValueClass()==0)
00805 ||(clCollection->GetCollectionProxy()->GetValueClass()->GetCollectionProxy()!=0
00806 && clCollection->GetCollectionProxy()->GetValueClass()->GetCollectionProxy()->GetValueClass()==0)
00807 )) {
00808
00809 cpb = new TCollectionPropertyBrowsable("values", "values in the container",
00810 scope, branch, parent);
00811 li.Add(cpb);
00812 }
00813 scope.Insert(lastPart, "@");
00814 cpb = new TCollectionPropertyBrowsable("@size", size_title,
00815 scope+".size()", branch, parent);
00816 li.Add(cpb);
00817 return 1;
00818 }
00819 else if (clCollection->InheritsFrom(TCollection::Class())) {
00820
00821
00822 if (clCollection->InheritsFrom(TObjArray::Class()))
00823 scope+="@.GetEntries()";
00824 else scope+="@.GetSize()";
00825 TCollectionPropertyBrowsable* cpb=
00826 new TCollectionPropertyBrowsable("@size", size_title, scope, branch, parent);
00827 li.Add(cpb);
00828 return 1;
00829 }
00830 return 0;
00831 }
00832
00833
00834 void TCollectionPropertyBrowsable::Register()
00835 {
00836
00837
00838
00839 TVirtualBranchBrowsable::RegisterGenerator(GetBrowsables);
00840 }
00841
00842
00843 void TCollectionPropertyBrowsable::Unregister()
00844 {
00845
00846
00847
00848 TVirtualBranchBrowsable::UnregisterGenerator(GetBrowsables);
00849 }
00850
00851
00852 ClassImp(TCollectionMethodBrowsable);
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873 TCollectionMethodBrowsable::TCollectionMethodBrowsable(const TBranch* branch, TMethod* m,
00874 const TVirtualBranchBrowsable* parent ):
00875 TMethodBrowsable(branch, m, parent)
00876 {
00877
00878
00879 SetName(TString("@")+GetName());
00880 }
00881
00882
00883 Int_t TCollectionMethodBrowsable::GetBrowsables(TList& li, const TBranch* branch,
00884 const TVirtualBranchBrowsable* parent )
00885 {
00886
00887
00888
00889
00890
00891 TClass* clContained=0;
00892
00893 TClass* clContainer=GetCollectionContainedType(branch, parent, clContained);
00894 if (!clContainer || !clContained) return 0;
00895
00896 TList listMethods;
00897 GetBrowsableMethodsForClass(clContainer, listMethods);
00898 TMethod* method=0;
00899 TIter iMethods(&listMethods);
00900 while ((method=(TMethod*)iMethods()))
00901 li.Add(new TCollectionMethodBrowsable(branch, method, parent));
00902
00903
00904
00905
00906
00907 if (!listMethods.GetSize() && clContainer->GetCollectionProxy()) {
00908 std::list<MethodCreateListOfBrowsables_t>& listGenerators=GetRegisteredGenerators();
00909 std::list<MethodCreateListOfBrowsables_t>::iterator iIsRegistered
00910 = std::find(listGenerators.begin(), listGenerators.end(), &TCollectionPropertyBrowsable::GetBrowsables);
00911 if (iIsRegistered==listGenerators.end()) {
00912 TCollectionPropertyBrowsable::GetBrowsables(li, branch, parent);
00913 return 1;
00914 }
00915 }
00916 return listMethods.GetSize();
00917 }
00918
00919
00920 void TCollectionMethodBrowsable::Register()
00921 {
00922
00923
00924
00925 TVirtualBranchBrowsable::RegisterGenerator(GetBrowsables);
00926 }
00927
00928
00929 void TCollectionMethodBrowsable::Unregister()
00930 {
00931
00932
00933
00934 TVirtualBranchBrowsable::UnregisterGenerator(GetBrowsables);
00935 }