diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-08-11 17:57:34 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2019-08-11 17:57:34 (GMT) |
commit | 3e8fe63473b047bf3d48c734750334244e9981a8 (patch) | |
tree | 3d2f224b78898feb3c4b88cc5e904f5da4284f06 /src/outputlist.cpp | |
parent | 09c263e70a2ac9afbe8f7cc7a0a07c5ab069645a (diff) | |
download | Doxygen-3e8fe63473b047bf3d48c734750334244e9981a8.zip Doxygen-3e8fe63473b047bf3d48c734750334244e9981a8.tar.gz Doxygen-3e8fe63473b047bf3d48c734750334244e9981a8.tar.bz2 |
Reduce boilerplate code by using C++11 variadic templates and perfect forwarding
Diffstat (limited to 'src/outputlist.cpp')
-rw-r--r-- | src/outputlist.cpp | 159 |
1 files changed, 0 insertions, 159 deletions
diff --git a/src/outputlist.cpp b/src/outputlist.cpp index daf3270..c47c1c9 100644 --- a/src/outputlist.cpp +++ b/src/outputlist.cpp @@ -196,163 +196,4 @@ void OutputList::parseText(const QCString &textStr) delete root; } - -//-------------------------------------------------------------------------- -// Create some overloaded definitions of the forall function. -// Using template functions here would have made it a little less -// portable (I guess). - -// zero arguments -void OutputList::forall(void (OutputGenerator::*func)()) -{ - QListIterator<OutputGenerator> it(m_outputs); - OutputGenerator *og; - for (it.toFirst();(og=it.current());++it) - { - if (og->isEnabled()) (og->*func)(); - } -} - -// one argument -#define FORALL1(a1,p1) \ -void OutputList::forall(void (OutputGenerator::*func)(a1),a1) \ -{ \ - QListIterator<OutputGenerator> it(m_outputs); \ - OutputGenerator *og; \ - for (it.toFirst();(og=it.current());++it) \ - { \ - if (og->isEnabled()) (og->*func)(p1); \ - } \ -} - -// two arguments -#define FORALL2(a1,a2,p1,p2) \ -void OutputList::forall(void (OutputGenerator::*func)(a1,a2),a1,a2) \ -{ \ - QListIterator<OutputGenerator> it(m_outputs); \ - OutputGenerator *og; \ - for (it.toFirst();(og=it.current());++it) \ - { \ - if (og->isEnabled()) (og->*func)(p1,p2); \ - } \ -} - -// three arguments -#define FORALL3(a1,a2,a3,p1,p2,p3) \ -void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3),a1,a2,a3) \ -{ \ - QListIterator<OutputGenerator> it(m_outputs); \ - OutputGenerator *og; \ - for (it.toFirst();(og=it.current());++it) \ - { \ - if (og->isEnabled()) (og->*func)(p1,p2,p3); \ - } \ -} - -// four arguments -#define FORALL4(a1,a2,a3,a4,p1,p2,p3,p4) \ -void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4),a1,a2,a3,a4) \ -{ \ - QListIterator<OutputGenerator> it(m_outputs); \ - OutputGenerator *og; \ - for (it.toFirst();(og=it.current());++it) \ - { \ - if (og->isEnabled()) (og->*func)(p1,p2,p3,p4); \ - } \ -} - -// five arguments -#define FORALL5(a1,a2,a3,a4,a5,p1,p2,p3,p4,p5) \ -void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5),a1,a2,a3,a4,a5) \ -{ \ - QListIterator<OutputGenerator> it(m_outputs); \ - OutputGenerator *og; \ - for (it.toFirst();(og=it.current());++it) \ - { \ - if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5); \ - } \ -} - -// six arguments -#define FORALL6(a1,a2,a3,a4,a5,a6,p1,p2,p3,p4,p5,p6) \ -void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6),a1,a2,a3,a4,a5,a6) \ -{ \ - QListIterator<OutputGenerator> it(m_outputs); \ - OutputGenerator *og; \ - for (it.toFirst();(og=it.current());++it) \ - { \ - if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6); \ - } \ -} - -// seven arguments -#define FORALL7(a1,a2,a3,a4,a5,a6,a7,p1,p2,p3,p4,p5,p6,p7) \ -void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6,a7),a1,a2,a3,a4,a5,a6,a7) \ -{ \ - QListIterator<OutputGenerator> it(m_outputs); \ - OutputGenerator *og; \ - for (it.toFirst();(og=it.current());++it) \ - { \ - if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6,p7); \ - } \ -} - - -// eight arguments -#define FORALL8(a1,a2,a3,a4,a5,a6,a7,a8,p1,p2,p3,p4,p5,p6,p7,p8) \ -void OutputList::forall(void (OutputGenerator::*func)(a1,a2,a3,a4,a5,a6,a7,a8),a1,a2,a3,a4,a5,a6,a7,a8) \ -{ \ - QListIterator<OutputGenerator> it(m_outputs); \ - OutputGenerator *og; \ - for (it.toFirst();(og=it.current());++it) \ - { \ - if (og->isEnabled()) (og->*func)(p1,p2,p3,p4,p5,p6,p7,p8); \ - } \ -} - -// now instantiate only the ones we need. - -FORALL1(const char *a1,a1) -FORALL1(char a1,a1) -FORALL1(int a1,a1) -FORALL1(DotClassGraph &a1,a1) -FORALL1(DotInclDepGraph &a1,a1) -FORALL1(DotCallGraph &a1,a1) -FORALL1(DotDirDeps &a1,a1) -FORALL1(DotGfxHierarchyTable &a1,a1) -FORALL1(DotGroupCollaboration &a1,a1) -FORALL1(SectionTypes a1,a1) -#if defined(HAS_BOOL_TYPE) || defined(Q_HAS_BOOL_TYPE) -FORALL1(bool a1,a1) -FORALL2(bool a1,int a2,a1,a2) -FORALL2(bool a1,bool a2,a1,a2) -FORALL2(const char *a1,bool a2,a1,a2) -FORALL4(const char *a1,const char *a2,const char *a3,bool a4,a1,a2,a3,a4) -#endif -FORALL2(int a1,bool a2,a1,a2) -FORALL2(bool a1,const char *a2,a1,a2) -FORALL2(ParamListTypes a1,const char *a2,a1,a2) -FORALL1(IndexSections a1,a1) -FORALL2(const char *a1,const char *a2,a1,a2) -FORALL2(const char *a1,int a2,a1,a2) -FORALL2(const char *a1,SectionInfo::SectionType a2,a1,a2) -FORALL3(bool a1,HighlightedItem a2,const char *a3,a1,a2,a3) -FORALL3(bool a1,bool a2,bool a3,a1,a2,a3) -FORALL3(const ClassDiagram &a1,const char *a2,const char *a3,a1,a2,a3) -FORALL3(const char *a1,const char *a2,const char *a3,a1,a2,a3) -FORALL3(const char *a1,const char *a2,bool a3,a1,a2,a3) -FORALL3(const char *a1,int a2,const char *a3,a1,a2,a3) -FORALL3(const char *a1,const char *a2,SectionInfo::SectionType a3,a1,a2,a3) -FORALL3(uchar a1,uchar a2,uchar a3,a1,a2,a3) -FORALL3(const Definition *a1,const char *a2,bool a3,a1,a2,a3) -FORALL4(SectionTypes a1,const char *a2,const char *a3,const char *a4,a1,a2,a3,a4) -FORALL4(const char *a1,const char *a2,const char *a3,const char *a4,a1,a2,a3,a4) -FORALL4(const char *a1,const char *a2,const char *a3,int a4,a1,a2,a3,a4) -FORALL5(const char *a1,const char *a2,const char *a3,const char *a4,const char *a5,a1,a2,a3,a4,a5) -FORALL5(const char *a1,const char *a2,const char *a3,const char *a4,bool a5,a1,a2,a3,a4,a5) -FORALL6(const char *a1,const char *a2,const char *a3,const char *a4,const char *a5,const char *a6,a1,a2,a3,a4,a5,a6) -FORALL6(const char *a1,const DocLinkInfo &a2,const char *a3,const char *a4,const SourceLinkInfo &a5,const SourceLinkInfo &a6,a1,a2,a3,a4,a5,a6) -FORALL7(const char *a1,const char *a2,const char *a3,const char *a4,int a5,int a6,bool a7,a1,a2,a3,a4,a5,a6,a7) - - //-------------------------------------------------------------------------- |