m_strType.Replace("[]", "*");
m_strType.Replace("long int", "long"); // in wx typically we never write "long int", just "long"
m_strType.Replace("long unsigned int", "unsigned long");
+ m_strType.Replace("short unsigned int", "unsigned short");
// make sure the * and & operator always use the same spacing rules
// (to make sure GetAsString() output is always consistent)
m_strType.Replace(" ,", ",");
// ADHOC-FIX
- m_strType.Replace("_wxArraywxArrayStringBase", "const wxString&");
+ m_strType.Replace("_wxArraywxArrayStringBase", "wxString");
+ m_strType.Replace("ExitCode", "void*"); // used in wxThread stuff
m_strType = m_strType.Strip(wxString::both);
if (m_strTypeClean.EndsWith("Base"))
m_strTypeClean = m_strTypeClean.Left(m_strTypeClean.Len()-4);
+ // remove the namespace from the types; there's no problem of conflicts
+ // (except for templates) and this avoids tons of false warnings
+ if (m_strTypeClean.Contains("::") && !m_strTypeClean.Contains("<"))
+ m_strTypeClean = m_strTypeClean.Mid(m_strTypeClean.Find("::")+2);
+
// ADHOC-FIX:
- // doxygen likes to put wxDateTime:: in front of all wxDateTime enums;
- // fix this to avoid false positives
- m_strTypeClean.Replace("wxDateTime::", "");
- m_strTypeClean.Replace("wxStockGDI::", ""); // same story for some other classes
- m_strTypeClean.Replace("wxHelpEvent::", "");
m_strTypeClean.Replace("wxWindowID", "int");
}
// Note: we adjust the aesthetic form of the m_strDefaultValue string for the "modify mode"
// of ifacecheck: we may need to write it out in an interface header
- wxString *p;
+ wxString *p = NULL;
for (int i=0; i<2; i++) // to avoid copying&pasting the code!
{
if (i == 0) p = &m_strDefaultValue;
if (i == 1) p = &m_strDefaultValueForCmp;
- if (*p == "0u") *p = "0";
+ if (*p == "0u" || *p == "0l") *p = "0";
p->Replace("0x000000001", "1");
p->Replace("\\000\\000\\000", ""); // fix for unicode strings:
p->Replace("\\011", "\\t");
+ p->Replace("e+0", "");
+ p->Replace("2147483647", "__INT_MAX__");
// ADHOC-FIX: for wxConv* default values
p->Replace("wxConvAuto(wxFONTENCODING_DEFAULT)", "wxConvAuto()");
if ((const wxType&)(*this) != (const wxType&)m)
return false;
+ // check if the default values match
+ // ---------------------------------
+
+
// ADHOC-FIX:
// default values for style attributes of wxWindow-derived classes in gccxml appear as raw
// numbers; avoid false positives in this case!
(m.m_strDefaultValueForCmp.IsNumber() && m_strDefaultValueForCmp.StartsWith("wx")))
{
if (g_verbose)
+ {
wxLogMessage("Supposing '%s' default value to be the same of '%s'...",
m_strDefaultValueForCmp, m.m_strDefaultValueForCmp);
+ }
return true;
}
}
+ else if (m_strTypeClean == "float" || m_strTypeClean == "double")
+ // gccXML translates the default floating values in a hardly usable
+ // format; e.g. 25.2 => 2.51999999999999992894572642398998141288757324219e+1
+ // we avoid check on these...
+ return true;
if (m_strDefaultValueForCmp != m.m_strDefaultValueForCmp)
{
}
if (g_verbose)
+ {
wxLogMessage("Argument type '%s = %s' has different default value from '%s = %s'",
m_strType, m_strDefaultValueForCmp, m.m_strType, m.m_strDefaultValueForCmp);
+ }
return false;
}
GetName() != m.GetName())
{
if (g_verbose)
+ {
wxLogMessage("The method '%s' does not match method '%s'; different names/rettype", GetName(), m.GetName());
+ }
return false;
}
if (m_args.GetCount()!=m.m_args.GetCount()) {
if (g_verbose)
+ {
wxLogMessage("Method '%s' has %d arguments while '%s' has %d arguments",
m_strName, m_args.GetCount(), m_strName, m.m_args.GetCount());
+ }
return false;
}
GetAccessSpecifier() != m.GetAccessSpecifier())
{
if (g_verbose)
+ {
wxLogMessage("The method '%s' does not match method '%s'; different attributes", GetName(), m.GetName());
+ }
return false;
}
// dump the classes in alphabetical order
wxSortedClassArray sorted(CompareWxClassObjects);
sorted.Alloc(m_classes.GetCount());
- for (unsigned int i=0; i<m_classes.GetCount(); i++)
+
+ unsigned i;
+ for (i=0; i<m_classes.GetCount(); i++)
sorted.Add(&m_classes[i]);
// now they have been sorted
- for (unsigned int i=0; i<sorted.GetCount(); i++)
+ for (i=0; i<sorted.GetCount(); i++)
sorted[i]->Dump(apiout);
}
// they're never used as return/argument types by wxWidgets methods
if (g_verbose)
+ {
wxLogWarning("Type node '%s' with ID '%s' does not have name attribute",
n, child->GetAttribute("id"));
+ }
types[id] = "TOFIX";
}
while (toResolveTypes.size()>0)
{
if (g_verbose)
+ {
wxLogMessage("%d types were collected; %d types need yet to be resolved...",
types.size(), toResolveTypes.size());
+ }
for (wxToResolveTypeHashMap::iterator i = toResolveTypes.begin();
i != toResolveTypes.end();)
}
// resolve header names
- for (unsigned int i=0; i<m_classes.GetCount(); i++)
+ unsigned i;
+ for (i=0; i<m_classes.GetCount(); i++)
{
unsigned long fileID = 0;
if (!getID(&fileID, m_classes[i].GetHeader()) || fileID == 0) {
}
// resolve parent names
- for (unsigned int i=0; i<m_classes.GetCount(); i++)
+ for (i=0; i<m_classes.GetCount(); i++)
{
for (unsigned int k=0; k<m_classes[i].GetParentCount(); k++)
{
int nodes = 0;
if (g_verbose)
+ {
wxLogMessage("Parsing %s...", filename);
+ }
if (!doc.Load(filename)) {
wxLogError("can't load %s", 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;
if (!ParseMethod(membernode, m, header)) {
wxLogError("The method '%s' could not be added to class '%s'",
- m.GetName(), klass.GetName());
+ m.GetName(), klass.GetName());
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())
absoluteFile = header;
else if (header != absoluteFile)
{
- wxLogError("The method '%s' is documented in a different "
- "file from others (which belong to '%s') ?",
- header, absoluteFile);
+ wxLogError("Found inconsistency in the XML file '%s': "
+ "the method '%s' is documented in the "
+ "file '%s' but the other methods of the same "
+ "class are documented in the file '%s'",
+ filename, m.GetName(), header, absoluteFile);
return false;
}
// add a new class
if (klass.IsOk())
+ {
m_classes.Add(klass);
+ }
else if (g_verbose)
+ {
wxLogWarning("discarding class '%s' with %d methods...",
klass.GetName(), klass.GetMethodCount());
+ }
}
child = child->GetNext();