@@ -657,8 +657,7 @@ void DirDefImpl::addUsesDependency(DirDef *dir,FileDef *srcFd,
657
657
UsedDir *usedDir = m_usedDirs.find (dir->getOutputFileBase ());
658
658
if (usedDir) // dir dependency already present
659
659
{
660
- const FilePair *usedPair = usedDir->findFilePair (
661
- srcFd->getOutputFileBase ()+dstFd->getOutputFileBase ());
660
+ const FilePair *usedPair = usedDir->findFilePair (FilePair::key (srcFd,dstFd));
662
661
if (usedPair==0 ) // new file dependency
663
662
{
664
663
// printf(" => new file\n");
@@ -756,44 +755,39 @@ bool DirDefImpl::depGraphIsTrivial() const
756
755
return m_usedDirs.empty ();
757
756
}
758
757
759
- // ----------------------------------------------------------------------
760
-
761
- int FilePairDict::compareValues (const FilePair *left,const FilePair *right) const
762
- {
763
- int orderHi = qstricmp (left->source ()->name (),right->source ()->name ());
764
- if (orderHi!=0 ) return orderHi;
765
- int orderLo = qstricmp (left->destination ()->name (),right->destination ()->name ());
766
- return orderLo;
767
- }
768
758
769
759
// ----------------------------------------------------------------------
770
760
771
761
UsedDir::UsedDir (const DirDef *dir,bool inherited) :
772
- m_dir(dir), m_filePairs( 7 ), m_inherited(inherited)
762
+ m_dir(dir), m_inherited(inherited)
773
763
{
774
- m_filePairs.setAutoDelete (TRUE );
775
764
}
776
765
777
766
UsedDir::~UsedDir ()
778
767
{
779
768
}
780
769
781
-
782
770
void UsedDir::addFileDep (FileDef *srcFd,FileDef *dstFd)
783
771
{
784
- m_filePairs.append (srcFd->getOutputFileBase ()+dstFd->getOutputFileBase (),
785
- new FilePair (srcFd,dstFd));
772
+ m_filePairs.add (FilePair::key (srcFd,dstFd),std::make_unique<FilePair>(srcFd,dstFd));
786
773
}
787
774
788
775
void UsedDir::sort ()
789
776
{
790
- m_filePairs.sort ();
777
+ std::sort (m_filePairs.begin (),
778
+ m_filePairs.end (),
779
+ [](const auto &left,const auto &right)
780
+ {
781
+ int orderHi = qstricmp (left->source ()->name (),right->source ()->name ());
782
+ if (orderHi!=0 ) return orderHi<0 ;
783
+ int orderLo = qstricmp (left->destination ()->name (),right->destination ()->name ());
784
+ return orderLo<0 ;
785
+ });
791
786
}
792
787
793
788
FilePair *UsedDir::findFilePair (const char *name)
794
789
{
795
- QCString n=name;
796
- return n.isEmpty () ? 0 : m_filePairs.find (n);
790
+ return m_filePairs.find (name);
797
791
}
798
792
799
793
DirDef *DirDefImpl::createNewDir (const char *path)
@@ -846,6 +840,13 @@ DirDef *DirDefImpl::mergeDirectoryInTree(const QCString &path)
846
840
847
841
// ----------------------------------------------------------------------
848
842
843
+ QCString FilePair::key (const FileDef *srcFd,const FileDef *dstFd)
844
+ {
845
+ return srcFd->getOutputFileBase ()+" ;" +dstFd->getOutputFileBase ();
846
+ }
847
+
848
+ // ----------------------------------------------------------------------
849
+
849
850
static void writePartialDirPath (OutputList &ol,const DirDef *root,const DirDef *target)
850
851
{
851
852
if (target->parent ()!=root)
@@ -909,9 +910,7 @@ void DirRelation::writeDocumentation(OutputList &ol)
909
910
ol.writeString (" </th>" );
910
911
ol.writeString (" </tr>" );
911
912
912
- SDict<FilePair>::Iterator fpi (m_dst->filePairs ());
913
- FilePair *fp;
914
- for (fpi.toFirst ();(fp=fpi.current ());++fpi)
913
+ for (const auto &fp : m_dst->filePairs ())
915
914
{
916
915
ol.writeString (" <tr class=\" dirtab\" >" );
917
916
ol.writeString (" <td class=\" dirtab\" >" );
0 commit comments