From 5fa507c8cadd72e5b9765167897baf00f48ac7ea Mon Sep 17 00:00:00 2001
From: Francesco Montorsi <f18m_cpp217828@yahoo.it>
Date: Sat, 10 Jan 2009 22:07:05 +0000
Subject: [PATCH] fix an important bug: ifacecheck was parsing only
 <sectiondef> with kind==public-func or kind==protected-func; it was ignoring
 kind==user-defined and in any case the access specifier must be taken from
 the 'prot' attribute of <memberdef> nodes instead

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57990 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 utils/ifacecheck/src/ifacecheck.cpp |  4 ----
 utils/ifacecheck/src/xmlparser.cpp  | 25 +++++++++++++++----------
 2 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/utils/ifacecheck/src/ifacecheck.cpp b/utils/ifacecheck/src/ifacecheck.cpp
index e2db707144..19a0971e9f 100644
--- a/utils/ifacecheck/src/ifacecheck.cpp
+++ b/utils/ifacecheck/src/ifacecheck.cpp
@@ -156,16 +156,12 @@ int IfaceCheckApp::OnRun()
             // in any case set basic std preprocessor #defines:
             m_doxyInterface.AddPreprocessorValue("NULL", "0");
 
-            //g_bLogEnabled = false;
-
             // parse the two XML files which contain the real and the doxygen interfaces
             // for wxWidgets API:
             if (!m_gccInterface.Parse(parser.GetParam(0)) ||
                 !m_doxyInterface.Parse(parser.GetParam(1)))
                 return 1;
 
-//            g_bLogEnabled = true;
-
             if (parser.Found(DUMP_SWITCH))
             {
                 wxLogMessage("Dumping real API to '%s'...", API_DUMP_FILE);
diff --git a/utils/ifacecheck/src/xmlparser.cpp b/utils/ifacecheck/src/xmlparser.cpp
index 825d3fdddf..aed036afb3 100644
--- a/utils/ifacecheck/src/xmlparser.cpp
+++ b/utils/ifacecheck/src/xmlparser.cpp
@@ -1495,18 +1495,23 @@ bool wxXmlDoxygenInterface::ParseCompoundDefinition(const wxString& filename)
             wxXmlNode *subchild = child->GetChildren();
             while (subchild)
             {
-                wxString kind = subchild->GetAttribute("kind");
-
-                // parse only public&protected functions:
-                if (subchild->GetName() == "sectiondef" &&
-                    (kind == "public-func" || kind == "protected-func"))
+                // NOTE: when documenting functions using the //@{ and //@}
+                //       tags to create function groups, doxygen puts the
+                //       contained methods into a "user-defined" section
+                //       so we _must_ use the "prot" attribute to distinguish
+                //       public/protected methods from private ones and cannot
+                //       rely on the kind="public" attribute of <sectiondef>
+                if (subchild->GetName() == "sectiondef")
                 {
-
                     wxXmlNode *membernode = subchild->GetChildren();
                     while (membernode)
                     {
+                        const wxString& accessSpec = membernode->GetAttribute("prot");
+
+                        // parse only public&protected functions:
                         if (membernode->GetName() == "memberdef" &&
-                            membernode->GetAttribute("kind") == "function")
+                            membernode->GetAttribute("kind") == "function" &&
+                            (accessSpec == "public" || accessSpec == "protected"))
                         {
 
                             wxMethod m;
@@ -1516,11 +1521,11 @@ bool wxXmlDoxygenInterface::ParseCompoundDefinition(const wxString& filename)
                                 return false;
                             }
 
-                            if (kind == "public-func")
+                            if (accessSpec == "public")
                                 m.SetAccessSpecifier(wxMAS_PUBLIC);
-                            else if (kind == "protected-func")
+                            else if (accessSpec == "protected")
                                 m.SetAccessSpecifier(wxMAS_PROTECTED);
-                            else if (kind == "private-func")
+                            else if (accessSpec == "private")
                                 m.SetAccessSpecifier(wxMAS_PRIVATE);
 
                             if (absoluteFile.IsEmpty())
-- 
2.45.2