searchedclasses += "/" + api[j]->GetName();
searchedclasses.Remove(0, 1);
-
// shorten the name of the header so the log file is more readable
wxString header = iface->GetHeader().AfterLast('/');
for (unsigned int i=0; i<iface->GetMethodCount(); i++)
{
const wxMethod& m = iface->GetMethod(i);
- const wxString& tofind = m.GetAsString();
int matches = 0;
// search in the methods of the api classes provided
for (unsigned int j=0; j<api.GetCount(); j++)
{
real = api[j]->FindMethod(m);
- if (real) {
-
- // there is a matching prototype! It's ok!
- //LogMessage("the doxygen method '%s' has a match in the real interface of '%s'!",
- // tofind, api[j]->GetName());
- matches++;
- }
+ if (real)
+ matches++; // there is a real matching prototype! It's ok!
}
if (matches == 0)
WX_APPEND_ARRAY(overloads, results);
}
- if (overloads.GetCount()>1)
+ if (overloads.GetCount()==0)
{
- // TODO: decide which of these overloads is the most "similar" to m
- // and eventually modify it
- LogWarning("%s: there are %d overloads of method '%s' in the classes '%s' "
- "all with different signatures; manual fix is required",
- header, overloads.GetCount(), tofind, searchedclasses);
+ LogMessage("%s: real '%s' class has no method '%s'",
+ header, searchedclasses, m.GetAsString());
+ // we've found no overloads
}
- else if (overloads.GetCount() == 1)
+ else
{
- wxString tmp;
- if (m_modify) tmp = "; fixing it...";
-
- LogWarning("%s: the method '%s' of classes '%s' has a different signature%s",
- header, tofind, searchedclasses, tmp);
+ // first, output a warning
+ wxString warning = header;
+ if (overloads.GetCount()>1)
+ warning += wxString::Format(": in the real headers there are %d overloads of '%s' for "
+ "'%s' all with different signatures:\n",
+ overloads.GetCount(), m.GetName(), searchedclasses);
+ else
+ warning += wxString::Format(": in the real headers there is a method '%s' for '%s'"
+ " but has different signature:\n",
+ m.GetName(), searchedclasses);
+
+ warning += "\tdoxy header: " + m.GetAsString();
+ for (unsigned int j=0; j<overloads.GetCount(); j++)
+ warning += "\n\treal header: " + overloads[j]->GetAsString();
+
+ wxPrint(warning + "\n");
count++;
- // try to modify it!
- if (m_modify)
- FixMethod(iface->GetHeader(), &m, overloads[0]);
- }
- else
- {
- LogMessage("%s: real '%s' class has no method '%s'",
- header, searchedclasses, tofind);
- count++; // count this type of warnings
+ if (overloads.GetCount()>1)
+ {
+ // TODO: decide which of these overloads is the most "similar" to m
+ // and eventually modify it
+ if (m_modify)
+ wxPrint("\tmanual fix is required\n");
+ }
+ else
+ {
+ wxASSERT(overloads.GetCount() == 1);
+
+ if (m_modify)
+ {
+ wxPrint("\tfixing it...\n");
+
+ // try to modify it!
+ FixMethod(iface->GetHeader(), &m, overloads[0]);
+ }
+ }
}
+
+ count++;
}
}
return;
}
+ if (!file.GetLine(end).Contains(iface->GetName())) {
+ LogWarning("invalid location info for method '%s': %d.",
+ iface->GetAsString(), iface->GetLocation());
+ return;
+ }
+
// find the start point of this prototype declaration:
- int start = end;
+ int start = end-1;
while (start > 0 &&
!file.GetLine(start).Contains(";") &&
- !file.GetLine(start).Contains("*/"))
+ !file.GetLine(start).Contains("*/"))
start--;
if (start <= 0)
return;
}
+ // start-th line contains either the declaration of another prototype
+ // or the closing tag */ of a doxygen comment; start one line below
+ start++;
+
// remove the old prototype
for (int i=start; i<=end; i++)
file.RemoveLine(start); // remove (end-start)-nth times the start-th line
void wxType::SetFromString(const wxString& t)
{
- m_strType = t.Strip(wxString::both);
+ /*
+ TODO: optimize the following code writing a single function
+ which works at char-level and does everything in a single pass
+ */
+
+ m_strType = t;
// [] is the same as * for gccxml
m_strType.Replace("[]", "*");
+ m_strType.Replace("long int", "long"); // in wx typically we never write "long int", just "long"
+
+ // make sure the * and & operator always use the same spacing rules
+ // (to make sure GetAsString() output is always consistent)
+ m_strType.Replace("*", "* ");
+ m_strType.Replace("&", "& ");
+ m_strType.Replace(" *", "*");
+ m_strType.Replace(" &", "&");
+
+ while (m_strType.Contains(" "))
+ m_strType.Replace(" ", " "); // do it once again
+
+ m_strType.Replace(" ,", ",");
+
+ m_strType = m_strType.Strip(wxString::both);
}
bool wxType::IsOk() const
return false;
// a function can't be both const and static or virtual and static!
- if ((m_bConst && m_bStatic) || (m_bVirtual && m_bStatic)) {
+ if ((m_bConst && m_bStatic) || ((m_bVirtual || m_bPureVirtual) && m_bStatic)) {
LogError("'%s' method can't be both const/static or virtual/static", m_strName);
return false;
}
IsConst() != m.IsConst() ||
IsStatic() != m.IsStatic() ||
IsVirtual() != m.IsVirtual() ||
+ IsPureVirtual() != m.IsPureVirtual() ||
IsDeprecated() != m.IsDeprecated())
return false;
ret += " const";
if (m_bStatic)
ret = "static " + ret;
- if (m_bVirtual)
+ if (m_bVirtual || m_bPureVirtual)
ret = "virtual " + ret;
+ if (m_bPureVirtual)
+ ret = ret + " = 0";
// in doxygen headers we don't need wxDEPRECATED:
//if (m_bDeprecated)
stream << " STATIC";
if (IsVirtual())
stream << " VIRTUAL";
+ if (IsPureVirtual())
+ stream << " PURE-VIRTUAL";
if (IsDeprecated())
stream << " DEPRECATED";
m.SetConst(p->GetAttribute("const") == "1");
m.SetStatic(p->GetAttribute("static") == "1");
m.SetVirtual(p->GetAttribute("virtual") == "1");
+ m.SetPureVirtual(p->GetAttribute("pure_virtual") == "1");
m.SetDeprecated(p->GetAttribute("attributes") == "deprecated");
if (!m.IsOk()) {
m.SetConst(p->GetAttribute("const")=="yes");
m.SetStatic(p->GetAttribute("static")=="yes");
m.SetVirtual(p->GetAttribute("virt")=="virtual");
+ m.SetPureVirtual(p->GetAttribute("virt")=="pure-virtual");
if (!m.IsOk()) {
LogError("The prototype '%s' is not valid!", m.GetAsString());