git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52774
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#include "wx/cmdline.h"
#include "wx/textfile.h"
#include "wx/cmdline.h"
#include "wx/textfile.h"
+#include "wx/filename.h"
#include "wx/stopwatch.h" // for wxGetLocalTime
#include "xmlparser.h"
#include "wx/stopwatch.h" // for wxGetLocalTime
#include "xmlparser.h"
#define API_DUMP_FILE "dump.api.txt"
#define INTERFACE_DUMP_FILE "dump.interface.txt"
#define API_DUMP_FILE "dump.api.txt"
#define INTERFACE_DUMP_FILE "dump.interface.txt"
+#define PROCESS_ONLY_SWITCH "p"
#define MODIFY_SWITCH "m"
#define MODIFY_SWITCH "m"
-#define DUMP_SWITCH "dump"
#define HELP_SWITCH "h"
#define VERBOSE_SWITCH "v"
static const wxCmdLineEntryDesc g_cmdLineDesc[] =
{
#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, 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",
{ wxCMD_LINE_SWITCH, HELP_SWITCH, "help",
"show help message", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
{ wxCMD_LINE_SWITCH, VERBOSE_SWITCH, "verbose",
void ShowProgress();
void PrintStatistics(long secs);
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;
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)
};
IMPLEMENT_APP_CONSOLE(IfaceCheckApp)
if (parser.Found(MODIFY_SWITCH))
m_modify = true;
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);
+ }
+
LogMessage("Comparing the interface API to the real API (%d classes to compare)...",
interface.GetCount());
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; i<interface.GetCount(); i++)
{
for (unsigned int i=0; i<interface.GetCount(); i++)
{
+ // shorten the name of the header so the log file is more readable
+ // and also for calling IsToProcess() against it
+ wxString header = wxFileName(interface[i].GetHeader()).GetFullName();
+
+ if (!IsToProcess(header))
+ continue; // skip this one
+
wxString cname = interface[i].GetName();
api.Empty();
wxString cname = interface[i].GetName();
api.Empty();
- // shorten the name of the header so the log file is more readable
- wxString header = interface[i].GetHeader().AfterLast('/');
-
LogMessage("%s: couldn't find the real interface for the '%s' class",
header, cname);
ccount++;
LogMessage("%s: couldn't find the real interface for the '%s' class",
header, cname);
ccount++;
searchedclasses.Remove(0, 1);
// shorten the name of the header so the log file is more readable
searchedclasses.Remove(0, 1);
// shorten the name of the header so the log file is more readable
- wxString header = iface->GetHeader().AfterLast('/');
+ wxString header = wxFileName(iface->GetHeader()).GetFullName();
for (unsigned int i=0; i<iface->GetMethodCount(); i++)
{
for (unsigned int i=0; i<iface->GetMethodCount(); i++)
{
+ wxASSERT((m_bVirtual && m_bPureVirtual) || !m_bVirtual);
+
for (unsigned int i=0; i<m_args.GetCount(); i++)
if (!m_args[i].IsOk()) {
LogError("'%s' method has invalid %d-th argument type: %s",
for (unsigned int i=0; i<m_args.GetCount(); i++)
if (!m_args[i].IsOk()) {
LogError("'%s' method has invalid %d-th argument type: %s",
void SetVirtual(bool c = true)
{ m_bVirtual=c; }
void SetPureVirtual(bool c = true)
void SetVirtual(bool c = true)
{ m_bVirtual=c; }
void SetPureVirtual(bool c = true)
+ {
+ m_bPureVirtual=c;
+ if (c) m_bVirtual=c; // pure virtual => virtual
+ }
void SetDeprecated(bool c = true)
{ m_bDeprecated=c; }
void SetLocation(int lineNumber)
void SetDeprecated(bool c = true)
{ m_bDeprecated=c; }
void SetLocation(int lineNumber)