@@ -147,9 +147,9 @@ class GenericNodeListContext : public TemplateListIntf
147
147
}
148
148
return result;
149
149
}
150
- TemplateListIntf::ConstIterator * createIterator () const
150
+ TemplateListIntf::ConstIteratorPtr createIterator () const
151
151
{
152
- return new GenericConstIterator (m_children);
152
+ return std::make_unique< GenericConstIterator> (m_children);
153
153
}
154
154
155
155
void append (const TemplateVariant &ctn)
@@ -1798,7 +1798,7 @@ TemplateVariant IncludeInfoListContext::at(uint index) const
1798
1798
return p->at (index);
1799
1799
}
1800
1800
1801
- TemplateListIntf::ConstIterator * IncludeInfoListContext::createIterator () const
1801
+ TemplateListIntf::ConstIteratorPtr IncludeInfoListContext::createIterator () const
1802
1802
{
1803
1803
return p->createIterator ();
1804
1804
}
@@ -5948,7 +5948,7 @@ TemplateVariant ClassListContext::at(uint index) const
5948
5948
return p->at (index);
5949
5949
}
5950
5950
5951
- TemplateListIntf::ConstIterator * ClassListContext::createIterator () const
5951
+ TemplateListIntf::ConstIteratorPtr ClassListContext::createIterator () const
5952
5952
{
5953
5953
return p->createIterator ();
5954
5954
}
@@ -6077,7 +6077,7 @@ static int computeMaxDepth(const TemplateListIntfPtr list)
6077
6077
int maxDepth=0 ;
6078
6078
if (list)
6079
6079
{
6080
- TemplateListIntf::ConstIterator * it = list->createIterator ();
6080
+ TemplateListIntf::ConstIteratorPtr it = list->createIterator ();
6081
6081
TemplateVariant v;
6082
6082
for (it->toFirst ();it->current (v);it->toNext ())
6083
6083
{
@@ -6086,7 +6086,6 @@ static int computeMaxDepth(const TemplateListIntfPtr list)
6086
6086
int d = computeMaxDepth (child.toList ())+1 ;
6087
6087
if (d>maxDepth) maxDepth=d;
6088
6088
}
6089
- delete it;
6090
6089
}
6091
6090
return maxDepth;
6092
6091
}
@@ -6100,13 +6099,12 @@ static int computeNumNodesAtLevel(const TemplateStructIntfPtr s,int level,int ma
6100
6099
TemplateVariant child = s->get (" children" );
6101
6100
if (child.toList ())
6102
6101
{
6103
- TemplateListIntf::ConstIterator * it = child.toList ()->createIterator ();
6102
+ TemplateListIntf::ConstIteratorPtr it = child.toList ()->createIterator ();
6104
6103
TemplateVariant v;
6105
6104
for (it->toFirst ();it->current (v);it->toNext ())
6106
6105
{
6107
6106
num+=computeNumNodesAtLevel (v.toStruct (),level+1 ,maxLevel);
6108
6107
}
6109
- delete it;
6110
6108
}
6111
6109
}
6112
6110
return num;
@@ -6122,13 +6120,12 @@ static int computePreferredDepth(const TemplateListIntfPtr list,int maxDepth)
6122
6120
for (int i=1 ;i<=depth;i++)
6123
6121
{
6124
6122
int num=0 ;
6125
- TemplateListIntf::ConstIterator * it = list->createIterator ();
6123
+ TemplateListIntf::ConstIteratorPtr it = list->createIterator ();
6126
6124
TemplateVariant v;
6127
6125
for (it->toFirst ();it->current (v);it->toNext ())
6128
6126
{
6129
6127
num+=computeNumNodesAtLevel (v.toStruct (),0 ,i);
6130
6128
}
6131
- delete it;
6132
6129
if (num<=preferredNumEntries)
6133
6130
{
6134
6131
preferredDepth=i;
@@ -7083,7 +7080,7 @@ TemplateVariant NestingContext::at(uint index) const
7083
7080
return p->at (index);
7084
7081
}
7085
7082
7086
- TemplateListIntf::ConstIterator * NestingContext::createIterator () const
7083
+ TemplateListIntf::ConstIteratorPtr NestingContext::createIterator () const
7087
7084
{
7088
7085
return p->createIterator ();
7089
7086
}
@@ -7340,7 +7337,7 @@ TemplateVariant ConceptListContext::at(uint index) const
7340
7337
return p->at (index);
7341
7338
}
7342
7339
7343
- TemplateListIntf::ConstIterator * ConceptListContext::createIterator () const
7340
+ TemplateListIntf::ConstIteratorPtr ConceptListContext::createIterator () const
7344
7341
{
7345
7342
return p->createIterator ();
7346
7343
}
@@ -7383,7 +7380,7 @@ TemplateVariant NamespaceListContext::at(uint index) const
7383
7380
return p->at (index);
7384
7381
}
7385
7382
7386
- TemplateListIntf::ConstIterator * NamespaceListContext::createIterator () const
7383
+ TemplateListIntf::ConstIteratorPtr NamespaceListContext::createIterator () const
7387
7384
{
7388
7385
return p->createIterator ();
7389
7386
}
@@ -7563,7 +7560,7 @@ TemplateVariant FileListContext::at(uint index) const
7563
7560
return p->at (index);
7564
7561
}
7565
7562
7566
- TemplateListIntf::ConstIterator * FileListContext::createIterator () const
7563
+ TemplateListIntf::ConstIteratorPtr FileListContext::createIterator () const
7567
7564
{
7568
7565
return p->createIterator ();
7569
7566
}
@@ -7602,7 +7599,7 @@ TemplateVariant DirListContext::at(uint index) const
7602
7599
return p->at (index);
7603
7600
}
7604
7601
7605
- TemplateListIntf::ConstIterator * DirListContext::createIterator () const
7602
+ TemplateListIntf::ConstIteratorPtr DirListContext::createIterator () const
7606
7603
{
7607
7604
return p->createIterator ();
7608
7605
}
@@ -7646,7 +7643,7 @@ TemplateVariant UsedFilesContext::at(uint index) const
7646
7643
return p->at (index);
7647
7644
}
7648
7645
7649
- TemplateListIntf::ConstIterator * UsedFilesContext::createIterator () const
7646
+ TemplateListIntf::ConstIteratorPtr UsedFilesContext::createIterator () const
7650
7647
{
7651
7648
return p->createIterator ();
7652
7649
}
@@ -7929,7 +7926,7 @@ TemplateVariant PageListContext::at(uint index) const
7929
7926
return p->at (index);
7930
7927
}
7931
7928
7932
- TemplateListIntf::ConstIterator * PageListContext::createIterator () const
7929
+ TemplateListIntf::ConstIteratorPtr PageListContext::createIterator () const
7933
7930
{
7934
7931
return p->createIterator ();
7935
7932
}
@@ -7971,7 +7968,7 @@ TemplateVariant ExampleListContext::at(uint index) const
7971
7968
return p->at (index);
7972
7969
}
7973
7970
7974
- TemplateListIntf::ConstIterator * ExampleListContext::createIterator () const
7971
+ TemplateListIntf::ConstIteratorPtr ExampleListContext::createIterator () const
7975
7972
{
7976
7973
return p->createIterator ();
7977
7974
}
@@ -8014,7 +8011,7 @@ TemplateVariant ModuleListContext::at(uint index) const
8014
8011
return p->at (index);
8015
8012
}
8016
8013
8017
- TemplateListIntf::ConstIterator * ModuleListContext::createIterator () const
8014
+ TemplateListIntf::ConstIteratorPtr ModuleListContext::createIterator () const
8018
8015
{
8019
8016
return p->createIterator ();
8020
8017
}
@@ -9129,7 +9126,7 @@ TemplateVariant InheritanceListContext::at(uint index) const
9129
9126
return p->at (index);
9130
9127
}
9131
9128
9132
- TemplateListIntf::ConstIterator * InheritanceListContext::createIterator () const
9129
+ TemplateListIntf::ConstIteratorPtr InheritanceListContext::createIterator () const
9133
9130
{
9134
9131
return p->createIterator ();
9135
9132
}
@@ -9190,7 +9187,7 @@ TemplateVariant MemberListContext::at(uint index) const
9190
9187
return p->at (index);
9191
9188
}
9192
9189
9193
- TemplateListIntf::ConstIterator * MemberListContext::createIterator () const
9190
+ TemplateListIntf::ConstIteratorPtr MemberListContext::createIterator () const
9194
9191
{
9195
9192
return p->createIterator ();
9196
9193
}
@@ -9343,7 +9340,7 @@ TemplateVariant AllMembersListContext::at(uint index) const
9343
9340
return p->at (index);
9344
9341
}
9345
9342
9346
- TemplateListIntf::ConstIterator * AllMembersListContext::createIterator () const
9343
+ TemplateListIntf::ConstIteratorPtr AllMembersListContext::createIterator () const
9347
9344
{
9348
9345
return p->createIterator ();
9349
9346
}
@@ -9518,7 +9515,7 @@ TemplateVariant MemberGroupListContext::at(uint index) const
9518
9515
return p->at (index);
9519
9516
}
9520
9517
9521
- TemplateListIntf::ConstIterator * MemberGroupListContext::createIterator () const
9518
+ TemplateListIntf::ConstIteratorPtr MemberGroupListContext::createIterator () const
9522
9519
{
9523
9520
return p->createIterator ();
9524
9521
}
@@ -9650,8 +9647,8 @@ StringVector MemberListInfoContext::fields() const
9650
9647
class InheritedMemberInfoContext ::Private
9651
9648
{
9652
9649
public:
9653
- Private (const ClassDef *cd,const MemberList * ml,const QCString &title)
9654
- : m_class(cd), m_memberList(ml ), m_title(title)
9650
+ Private (const ClassDef *cd,std::unique_ptr< MemberList> && ml,const QCString &title)
9651
+ : m_class(cd), m_memberList(std::move(ml) ), m_title(title)
9655
9652
{
9656
9653
static bool init=FALSE ;
9657
9654
if (!init)
@@ -9672,10 +9669,6 @@ class InheritedMemberInfoContext::Private
9672
9669
{
9673
9670
return s_inst.fields ();
9674
9671
}
9675
- virtual ~Private ()
9676
- {
9677
- delete m_memberList;
9678
- }
9679
9672
TemplateVariant getClass () const
9680
9673
{
9681
9674
if (!m_classCtx)
@@ -9692,7 +9685,7 @@ class InheritedMemberInfoContext::Private
9692
9685
{
9693
9686
if (!m_memberListCtx)
9694
9687
{
9695
- m_memberListCtx = MemberListContext::alloc (m_memberList);
9688
+ m_memberListCtx = MemberListContext::alloc (m_memberList. get () );
9696
9689
}
9697
9690
return TemplateVariant (m_memberListCtx);
9698
9691
}
@@ -9714,7 +9707,7 @@ class InheritedMemberInfoContext::Private
9714
9707
9715
9708
private:
9716
9709
const ClassDef * m_class;
9717
- const MemberList * m_memberList;
9710
+ std::unique_ptr< const MemberList> m_memberList;
9718
9711
QCString m_title;
9719
9712
mutable TemplateStructIntfPtr m_classCtx;
9720
9713
mutable TemplateListIntfPtr m_memberListCtx;
@@ -9725,8 +9718,8 @@ class InheritedMemberInfoContext::Private
9725
9718
9726
9719
PropertyMapper<InheritedMemberInfoContext::Private> InheritedMemberInfoContext::Private::s_inst;
9727
9720
9728
- InheritedMemberInfoContext::InheritedMemberInfoContext (const ClassDef *cd,const MemberList * ml,
9729
- const QCString &title) : p(std::make_unique<Private>(cd,ml ,title))
9721
+ InheritedMemberInfoContext::InheritedMemberInfoContext (const ClassDef *cd,std::unique_ptr< MemberList> && ml,const QCString &title)
9722
+ : p(std::make_unique<Private>(cd,std::move(ml) ,title))
9730
9723
{
9731
9724
}
9732
9725
@@ -9801,12 +9794,12 @@ class InheritedMemberInfoListContext::Private : public GenericNodeListContext
9801
9794
{
9802
9795
const MemberList *ml = cd->getMemberList (lt1);
9803
9796
const MemberList *ml2 = lt2!=-1 ? cd->getMemberList ((MemberListType)lt2) : 0 ;
9804
- MemberList * combinedList = new MemberList (lt,MemberListContainer::Class);
9805
- addMemberListIncludingGrouped (inheritedFrom,ml,combinedList);
9806
- addMemberListIncludingGrouped (inheritedFrom,ml2,combinedList);
9807
- addMemberGroupsOfClass (inheritedFrom,cd,lt,combinedList);
9808
- if (lt2!=-1 ) addMemberGroupsOfClass (inheritedFrom,cd,(MemberListType)lt2,combinedList);
9809
- append (InheritedMemberInfoContext::alloc (cd,combinedList,title));
9797
+ std::unique_ptr< MemberList> combinedList = std::make_unique< MemberList> (lt,MemberListContainer::Class);
9798
+ addMemberListIncludingGrouped (inheritedFrom,ml,combinedList. get () );
9799
+ addMemberListIncludingGrouped (inheritedFrom,ml2,combinedList. get () );
9800
+ addMemberGroupsOfClass (inheritedFrom,cd,lt,combinedList. get () );
9801
+ if (lt2!=-1 ) addMemberGroupsOfClass (inheritedFrom,cd,(MemberListType)lt2,combinedList. get () );
9802
+ append (InheritedMemberInfoContext::alloc (cd,std::move ( combinedList) ,title));
9810
9803
}
9811
9804
}
9812
9805
void findInheritedMembers (const ClassDef *inheritedFrom,const ClassDef *cd,MemberListType lt,
@@ -9873,7 +9866,7 @@ TemplateVariant InheritedMemberInfoListContext::at(uint index) const
9873
9866
return p->at (index);
9874
9867
}
9875
9868
9876
- TemplateListIntf::ConstIterator * InheritedMemberInfoListContext::createIterator () const
9869
+ TemplateListIntf::ConstIteratorPtr InheritedMemberInfoListContext::createIterator () const
9877
9870
{
9878
9871
return p->createIterator ();
9879
9872
}
@@ -10030,7 +10023,7 @@ TemplateVariant ArgumentListContext::at(uint index) const
10030
10023
return p->at (index);
10031
10024
}
10032
10025
10033
- TemplateListIntf::ConstIterator * ArgumentListContext::createIterator () const
10026
+ TemplateListIntf::ConstIteratorPtr ArgumentListContext::createIterator () const
10034
10027
{
10035
10028
return p->createIterator ();
10036
10029
}
@@ -10249,7 +10242,7 @@ TemplateVariant SymbolListContext::at(uint index) const
10249
10242
return p->at (index);
10250
10243
}
10251
10244
10252
- TemplateListIntf::ConstIterator * SymbolListContext::createIterator () const
10245
+ TemplateListIntf::ConstIteratorPtr SymbolListContext::createIterator () const
10253
10246
{
10254
10247
return p->createIterator ();
10255
10248
}
@@ -10381,7 +10374,7 @@ TemplateVariant SymbolGroupListContext::at(uint index) const
10381
10374
return p->at (index);
10382
10375
}
10383
10376
10384
- TemplateListIntf::ConstIterator * SymbolGroupListContext::createIterator () const
10377
+ TemplateListIntf::ConstIteratorPtr SymbolGroupListContext::createIterator () const
10385
10378
{
10386
10379
return p->createIterator ();
10387
10380
}
@@ -10498,7 +10491,7 @@ TemplateVariant SymbolIndicesContext::at(uint index) const
10498
10491
return p->at (index);
10499
10492
}
10500
10493
10501
- TemplateListIntf::ConstIterator * SymbolIndicesContext::createIterator () const
10494
+ TemplateListIntf::ConstIteratorPtr SymbolIndicesContext::createIterator () const
10502
10495
{
10503
10496
return p->createIterator ();
10504
10497
}
@@ -10611,7 +10604,7 @@ TemplateVariant SearchIndicesContext::at(uint index) const
10611
10604
return p->at (index);
10612
10605
}
10613
10606
10614
- TemplateListIntf::ConstIterator * SearchIndicesContext::createIterator () const
10607
+ TemplateListIntf::ConstIteratorPtr SearchIndicesContext::createIterator () const
10615
10608
{
10616
10609
return p->createIterator ();
10617
10610
}
@@ -10756,7 +10749,7 @@ void generateOutputViaTemplate()
10756
10749
msg (" Generating output via template engine...\n " );
10757
10750
{
10758
10751
TemplateEngine e;
10759
- TemplateContext * ctx = e.createContext ();
10752
+ auto ctx = e.createContext ();
10760
10753
if (ctx)
10761
10754
{
10762
10755
TemplateStructIntfPtr doxygen (DoxygenContext::alloc ());
@@ -10866,7 +10859,7 @@ void generateOutputViaTemplate()
10866
10859
ctx->setSpacelessIntf (&spl);
10867
10860
ctx->setOutputDirectory (g_globals.outputDir );
10868
10861
TextStream ts;
10869
- tpl->render (ts,ctx);
10862
+ tpl->render (ts,ctx. get () );
10870
10863
e.unload (tpl);
10871
10864
}
10872
10865
}
@@ -10891,7 +10884,7 @@ void generateOutputViaTemplate()
10891
10884
ctx->setSpacelessIntf (&spl);
10892
10885
ctx->setOutputDirectory (g_globals.outputDir );
10893
10886
TextStream ts;
10894
- tpl->render (ts,ctx);
10887
+ tpl->render (ts,ctx. get () );
10895
10888
e.unload (tpl);
10896
10889
}
10897
10890
}
@@ -10901,8 +10894,6 @@ void generateOutputViaTemplate()
10901
10894
{
10902
10895
kv.second ->setCookie (0 );
10903
10896
}
10904
-
10905
- e.destroyContext (ctx);
10906
10897
}
10907
10898
}
10908
10899
}
0 commit comments