From 4aa4e498d10e343b3b2a49e06195f62a49120002 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Fri, 15 Oct 2021 11:15:28 +0900 Subject: Imported Upstream version 1.9.0 --- src/perlmodgen.cpp | 90 ++++++++++++++++++++++-------------------------------- 1 file changed, 37 insertions(+), 53 deletions(-) (limited to 'src/perlmodgen.cpp') diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp index a6e9f22..d84d5e4 100644 --- a/src/perlmodgen.cpp +++ b/src/perlmodgen.cpp @@ -1569,6 +1569,7 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini // (templateArguments(), definitionTemplateParameterLists()) QCString memType; + QCString name; bool isFunc=FALSE; switch (md->memberType()) { @@ -1590,9 +1591,12 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini case MemberType_Dictionary: memType="dictionary"; break; } + name = md->name(); + if (md->isAnonymous()) name = "__unnamed" + name.right(name.length() - 1)+"__"; + m_output.openHash() .addFieldQuotedString("kind", memType) - .addFieldQuotedString("name", md->name()) + .addFieldQuotedString("name", name) .addFieldQuotedString("virtualness", getVirtualnessName(md->virtualness())) .addFieldQuotedString("protection", getProtectionName(md->protection())) .addFieldBoolean("static", md->isStatic()); @@ -1696,14 +1700,12 @@ void PerlModGenerator::generatePerlModForMember(const MemberDef *md,const Defini } } - /* DGA: fix #7495 Perlmod does not generate bitfield */ if (md->memberType() == MemberType_Variable && md->bitfieldString()) { - QCString bitfield = md->bitfieldString(); - if (bitfield.at(0) == ':') bitfield = bitfield.mid(1); - m_output.addFieldQuotedString("bitfield", bitfield); + QCString bitfield = md->bitfieldString(); + if (bitfield.at(0) == ':') bitfield = bitfield.mid(1); + m_output.addFieldQuotedString("bitfield", bitfield); } - /* DGA: end of fix #7495 */ const MemberDef *rmd = md->reimplements(); if (rmd) @@ -1830,42 +1832,40 @@ void PerlModGenerator::generatePerlModForClass(const ClassDef *cd) m_output.openHash() .addFieldQuotedString("name", cd->name()); + /* DGA: fix # #7547 Perlmod does not generate "kind" information to discriminate struct/union */ + m_output.addFieldQuotedString("kind", cd->compoundTypeString()); - if (cd->baseClasses()) + if (!cd->baseClasses().empty()) { m_output.openList("base"); - BaseClassListIterator bcli(*cd->baseClasses()); - BaseClassDef *bcd; - for (bcli.toFirst();(bcd=bcli.current());++bcli) + for (const auto &bcd : cd->baseClasses()) + { m_output.openHash() - .addFieldQuotedString("name", bcd->classDef->displayName()) - .addFieldQuotedString("virtualness", getVirtualnessName(bcd->virt)) - .addFieldQuotedString("protection", getProtectionName(bcd->prot)) + .addFieldQuotedString("name", bcd.classDef->displayName()) + .addFieldQuotedString("virtualness", getVirtualnessName(bcd.virt)) + .addFieldQuotedString("protection", getProtectionName(bcd.prot)) .closeHash(); + } m_output.closeList(); } - if (cd->subClasses()) + if (!cd->subClasses().empty()) { m_output.openList("derived"); - BaseClassListIterator bcli(*cd->subClasses()); - BaseClassDef *bcd; - for (bcli.toFirst();(bcd=bcli.current());++bcli) + for (const auto &bcd : cd->subClasses()) + { m_output.openHash() - .addFieldQuotedString("name", bcd->classDef->displayName()) - .addFieldQuotedString("virtualness", getVirtualnessName(bcd->virt)) - .addFieldQuotedString("protection", getProtectionName(bcd->prot)) + .addFieldQuotedString("name", bcd.classDef->displayName()) + .addFieldQuotedString("virtualness", getVirtualnessName(bcd.virt)) + .addFieldQuotedString("protection", getProtectionName(bcd.prot)) .closeHash(); + } m_output.closeList(); } - ClassSDict *cl = cd->getClassSDict(); - if (cl) { m_output.openList("inner"); - ClassSDict::Iterator cli(*cl); - const ClassDef *icd; - for (cli.toFirst();(icd=cli.current());++cli) + for (const auto &icd : cd->getClasses()) m_output.openHash() .addFieldQuotedString("name", icd->name()) .closeHash(); @@ -1966,26 +1966,20 @@ void PerlModGenerator::generatePerlModForNamespace(const NamespaceDef *nd) m_output.openHash() .addFieldQuotedString("name", nd->name()); - ClassSDict *cl = nd->getClassSDict(); - if (cl) + if (!nd->getClasses().empty()) { m_output.openList("classes"); - ClassSDict::Iterator cli(*cl); - const ClassDef *cd; - for (cli.toFirst();(cd=cli.current());++cli) + for (const auto &cd : nd->getClasses()) m_output.openHash() .addFieldQuotedString("name", cd->name()) .closeHash(); m_output.closeList(); } - const NamespaceSDict *nl = nd->getNamespaceSDict(); - if (nl) + if (!nd->getNamespaces().empty()) { m_output.openList("namespaces"); - NamespaceSDict::Iterator nli(*nl); - const NamespaceDef *ind; - for (nli.toFirst();(ind=nli.current());++nli) + for (const auto &ind : nd->getNamespaces()) m_output.openHash() .addFieldQuotedString("name", ind->name()) .closeHash(); @@ -2112,26 +2106,20 @@ void PerlModGenerator::generatePerlModForGroup(const GroupDef *gd) m_output.closeList(); } - ClassSDict *cl = gd->getClasses(); - if (cl) + if (!gd->getClasses().empty()) { m_output.openList("classes"); - ClassSDict::Iterator cli(*cl); - const ClassDef *cd; - for (cli.toFirst();(cd=cli.current());++cli) + for (const auto &cd : gd->getClasses()) m_output.openHash() .addFieldQuotedString("name", cd->name()) .closeHash(); m_output.closeList(); } - NamespaceSDict *nl = gd->getNamespaces(); - if (nl) + if (!gd->getNamespaces().empty()) { m_output.openList("namespaces"); - NamespaceSDict::Iterator nli(*nl); - const NamespaceDef *nd; - for (nli.toFirst();(nd=nli.current());++nli) + for (const auto &nd : gd->getNamespaces()) m_output.openHash() .addFieldQuotedString("name", nd->name()) .closeHash(); @@ -2210,17 +2198,13 @@ bool PerlModGenerator::generatePerlModOutput() m_output.add("$doxydocs=").openHash(); m_output.openList("classes"); - ClassSDict::Iterator cli(*Doxygen::classSDict); - const ClassDef *cd; - for (cli.toFirst();(cd=cli.current());++cli) - generatePerlModForClass(cd); + for (const auto &cd : *Doxygen::classLinkedMap) + generatePerlModForClass(cd.get()); m_output.closeList(); m_output.openList("namespaces"); - NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); - const NamespaceDef *nd; - for (nli.toFirst();(nd=nli.current());++nli) - generatePerlModForNamespace(nd); + for (const auto &nd : *Doxygen::namespaceLinkedMap) + generatePerlModForNamespace(nd.get()); m_output.closeList(); m_output.openList("files"); -- cgit v1.2.3