From d5978709f37fefe927e08fe00752818abadf397e Mon Sep 17 00:00:00 2001 From: Francesco Montorsi Date: Mon, 24 Mar 2008 23:22:39 +0000 Subject: [PATCH] added the process-only option git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52774 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- utils/ifacecheck/src/ifacecheck.cpp | 46 ++++++++++++++++++++++++----- utils/ifacecheck/src/xmlparser.cpp | 2 ++ utils/ifacecheck/src/xmlparser.h | 5 +++- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/utils/ifacecheck/src/ifacecheck.cpp b/utils/ifacecheck/src/ifacecheck.cpp index 8e4f593ce5..1e2c5848a1 100644 --- a/utils/ifacecheck/src/ifacecheck.cpp +++ b/utils/ifacecheck/src/ifacecheck.cpp @@ -22,6 +22,7 @@ #include "wx/cmdline.h" #include "wx/textfile.h" +#include "wx/filename.h" #include "wx/stopwatch.h" // for wxGetLocalTime #include "xmlparser.h" @@ -37,17 +38,21 @@ bool g_verbose = false; #define API_DUMP_FILE "dump.api.txt" #define INTERFACE_DUMP_FILE "dump.interface.txt" +#define PROCESS_ONLY_SWITCH "p" #define MODIFY_SWITCH "m" -#define DUMP_SWITCH "dump" +#define DUMP_SWITCH "d" #define HELP_SWITCH "h" #define VERBOSE_SWITCH "v" static const wxCmdLineEntryDesc g_cmdLineDesc[] = { + { wxCMD_LINE_OPTION, PROCESS_ONLY_SWITCH, "process-only", + "processes only header files matching the given wildcard", + wxCMD_LINE_VAL_STRING, wxCMD_LINE_NEEDS_SEPARATOR }, { wxCMD_LINE_SWITCH, MODIFY_SWITCH, "modify", "modify the interface headers to match the real ones" }, - { wxCMD_LINE_SWITCH, "", DUMP_SWITCH, - "dump both interface and API to plain text" }, + { wxCMD_LINE_SWITCH, DUMP_SWITCH, "dump", + "dump both interface and API to plain text dump.*.txt files" }, { wxCMD_LINE_SWITCH, HELP_SWITCH, "help", "show help message", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP }, { wxCMD_LINE_SWITCH, VERBOSE_SWITCH, "verbose", @@ -73,12 +78,23 @@ public: void ShowProgress(); void PrintStatistics(long secs); + bool IsToProcess(const wxString& headername) const + { + if (m_strToMatch.IsEmpty()) + return true; + return wxMatchWild(m_strToMatch, headername, false); + } + protected: wxXmlGccInterface m_api; // "real" headers API wxXmlDoxygenInterface m_interface; // doxygen-commented headers API // was the MODIFY_SWITCH passed? bool m_modify; + + // if non-empty, then PROCESS_ONLY_SWITCH was passed and this is the + // wildcard expression to match + wxString m_strToMatch; }; IMPLEMENT_APP_CONSOLE(IfaceCheckApp) @@ -117,6 +133,15 @@ int IfaceCheckApp::OnRun() if (parser.Found(MODIFY_SWITCH)) m_modify = true; + if (parser.Found(PROCESS_ONLY_SWITCH, &m_strToMatch)) + { + size_t len = m_strToMatch.Len(); + if (m_strToMatch.StartsWith("\"") && + m_strToMatch.EndsWith("\"") && + len > 2) + m_strToMatch = m_strToMatch.Mid(1, len-2); + } + ok = Compare(); } @@ -143,8 +168,18 @@ bool IfaceCheckApp::Compare() LogMessage("Comparing the interface API to the real API (%d classes to compare)...", interface.GetCount()); + if (!m_strToMatch.IsEmpty()) + LogMessage("Processing only header files matching '%s' expression.", m_strToMatch); + for (unsigned int i=0; iGetHeader().AfterLast('/'); + wxString header = wxFileName(iface->GetHeader()).GetFullName(); for (unsigned int i=0; iGetMethodCount(); i++) { diff --git a/utils/ifacecheck/src/xmlparser.cpp b/utils/ifacecheck/src/xmlparser.cpp index 728629371c..35c9e008a3 100644 --- a/utils/ifacecheck/src/xmlparser.cpp +++ b/utils/ifacecheck/src/xmlparser.cpp @@ -170,6 +170,8 @@ bool wxMethod::IsOk() const return false; } + wxASSERT((m_bVirtual && m_bPureVirtual) || !m_bVirtual); + for (unsigned int i=0; i virtual + } void SetDeprecated(bool c = true) { m_bDeprecated=c; } void SetLocation(int lineNumber) -- 2.45.2