#include "wx/xml/xml.h"
#include "wx/wfstream.h"
-#include "wx/arrimpl.cpp"
#include "wx/hashmap.h"
#include "wx/filename.h"
-
-#include <errno.h>
-
#include "xmlparser.h"
+#include <errno.h>
-#define PROGRESS_RATE 1000 // each PROGRESS_RATE nodes processed print a dot
-#define ESTIMATED_NUM_CLASSES 600 // used by both wxXmlInterface-derived classes to prealloc mem
-
+#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(wxTypeArray)
WX_DEFINE_OBJARRAY(wxMethodArray)
WX_DEFINE_OBJARRAY(wxClassArray)
-// declared in ifacecheck.cpp
+#define PROGRESS_RATE 1000 // each PROGRESS_RATE nodes processed print a dot
+#define ESTIMATED_NUM_CLASSES 600 // used by both wxXmlInterface-derived classes to prealloc mem
+
+
+// defined in ifacecheck.cpp
extern bool g_verbose;
GetName() != m.GetName() ||
IsConst() != m.IsConst() ||
IsStatic() != m.IsStatic() ||
- IsVirtual() != m.IsVirtual())
+ IsVirtual() != m.IsVirtual() ||
+ IsDeprecated() != m.IsDeprecated())
return false;
if (m_args.GetCount()!=m.m_args.GetCount())
if (m_bVirtual)
ret = "virtual " + ret;
+ if (m_bDeprecated)
+ ret = "wxDEPRECATED( " + ret + " )";
+
return ret;
}
stream << " STATIC";
if (IsVirtual())
stream << " VIRTUAL";
+ if (IsDeprecated())
+ stream << " DEPRECATED";
// no final newline
}
}
else if (n == "FunctionType" || n == "MethodType")
{
- /* TODO: incomplete */
-
- unsigned long ret = 0;
- if (!getID(&ret, child->GetAttribute("returns")) || ret == 0) {
- LogError("Invalid empty returns value for '%s' node", n);
- return false;
+ /*
+ TODO: parsing FunctionType and MethodType nodes is not as easy
+ as for other "simple" types.
+ */
+
+ wxString argstr;
+ wxXmlNode *arg = child->GetChildren();
+ while (arg)
+ {
+ if (arg->GetName() == "Argument")
+ argstr += arg->GetAttribute("type") + ", ";
+ arg = arg->GetNext();
}
+ if (argstr.Len() > 0)
+ argstr = argstr.Left(argstr.Len()-2);
+
// these nodes make reference to other types... we'll resolve them later
- toResolveTypes[id] = toResolveTypeItem(ret, 0);
+ //toResolveTypes[id] = toResolveTypeItem(ret, 0);
+ types[id] = child->GetAttribute("returns") + "(" + argstr + ")";
}
else if (n == "File")
{
}
else
{
-#if 1
LogError("Cannot solve '%s' reference type!", referenced);
return false;
-#else
- typeIds.Add(toResolveTypeIds[i]);
- typeNames.Add("TOFIX");
-
- // this one has been resolved!
- toResolveTypeIds.RemoveAt(i);
- toResolveRefType.RemoveAt(i);
- toResolveAttrib.RemoveAt(i);
- n--;
-#endif
}
}
}
m.SetConst(p->GetAttribute("const") == "1");
m.SetStatic(p->GetAttribute("static") == "1");
m.SetVirtual(p->GetAttribute("virtual") == "1");
+ m.SetDeprecated(p->GetAttribute("attributes") == "deprecated");
if (!m.IsOk()) {
LogError("The prototype '%s' is not valid!", m.GetAsString());
return text;
}
+static bool HasTextNodeContaining(const wxXmlNode *parent, const wxString& name)
+{
+ wxXmlNode *p = parent->GetChildren();
+ while (p)
+ {
+ switch (p->GetType())
+ {
+ case wxXML_TEXT_NODE:
+ if (p->GetContent() == name)
+ return true;
+ break;
+
+ case wxXML_ELEMENT_NODE:
+ // recurse into this node...
+ if (HasTextNodeContaining(p, name))
+ return true;
+ break;
+
+ default:
+ // skip it
+ break;
+ }
+
+ p = p->GetNext();
+ }
+
+ return false;
+}
+
bool wxXmlDoxygenInterface::ParseMethod(const wxXmlNode* p, wxMethod& m, wxString& header)
{
wxTypeArray args;
m.SetLocation((int)line);
header = child->GetAttribute("file");
}
+ else if (child->GetName() == "detaileddescription")
+ {
+ // when a method has a @deprecated tag inside its description,
+ // Doxygen outputs somewhere nested inside <detaileddescription>
+ // a <xreftitle>Deprecated</xreftitle> tag.
+ m.SetDeprecated(HasTextNodeContaining(child, "Deprecated"));
+ }
child = child->GetNext();
}
class wxMethod
{
public:
- wxMethod() { m_bConst=m_bVirtual=m_bStatic=false; m_nLine=-1; }
+ wxMethod()
+ { m_bConst=m_bVirtual=m_bStatic=m_bDeprecated=false; m_nLine=-1; }
+
wxMethod(const wxType& rettype, const wxString& name,
const wxTypeArray& arguments, const wxArrayString& defaults,
bool isConst, bool isStatic, bool isVirtual)
bool IsDtor() const
{ return m_retType==wxEmptyType && m_strName.StartsWith("~"); }
+ bool IsDeprecated() const
+ { return m_bDeprecated; }
+
public: // setters
{ m_bStatic=c; }
void SetVirtual(bool c = true)
{ m_bVirtual=c; }
+ void SetDeprecated(bool c = true)
+ { m_bDeprecated=c; }
void SetLocation(int lineNumber)
{ m_nLine=lineNumber; }
bool m_bConst;
bool m_bStatic;
bool m_bVirtual;
+ bool m_bDeprecated;
int m_nLine;
};