#include <wx/dynarray.h>
#include <wx/xml/xml.h>
#include <wx/platinfo.h>
+#include <wx/log.h>
/*
ifacecheck sources with the string:
// ADHOC-FIX:
-
+ // ...fix description...
*/
-
-
-// helper macros
-#define LogMessage(fmt, ...) { if (g_bLogEnabled) { wxPrintf(fmt "\n", __VA_ARGS__); fflush(stdout); }}
-#define LogWarning(fmt, ...) { if (g_bLogEnabled) { wxPrintf(fmt "\n", __VA_ARGS__); fflush(stdout); }}
-#define LogError(fmt, ...) { if (g_bLogEnabled) { wxPrintf("ERROR: " fmt "\n", __VA_ARGS__); fflush(stdout); }}
-#define wxPrint(str) { wxPrintf(str); fflush(stdout); }
-
-// enable/disable logging
-extern bool g_bLogEnabled;
-
-class LogNull
-{
-public:
- LogNull() { g_bLogEnabled = false; }
- ~LogNull() { g_bLogEnabled = true; }
-};
-
+// NOTE: all messages in this way are printed on the stderr
+//#define wxLogWarning wxLogMessage
// ----------------------------------------------------------------------------
{ return m_retType; }
wxString GetName() const
{ return m_strName; }
- wxArgumentTypeArray GetArgumentTypes() const
+ const wxArgumentTypeArray& GetArgumentTypes() const
+ { return m_args; }
+ wxArgumentTypeArray& GetArgumentTypes()
{ return m_args; }
int GetLocation() const
{ return m_nLine; }
{ return m_retType==wxEmptyType && !m_strName.StartsWith("~"); }
bool IsDtor() const
{ return m_retType==wxEmptyType && m_strName.StartsWith("~"); }
+ bool IsOperator() const
+ { return m_strName.StartsWith("operator"); }
bool IsDeprecated() const
{ return m_bDeprecated; }
+
public: // setters
void SetReturnType(const wxType& t)
// except for the method attributes (const,static,virtual,pureVirtual,deprecated)
bool MatchesExceptForAttributes(const wxMethod& m) const;
+ // returns true if this is a ctor which has default values for all its
+ // argument, thus is able to act also as default ctor
+ bool ActsAsDefaultCtor() const;
+
+ // dumps the contents of this class in the given stream
void Dump(wxTextOutputStream& stream) const;
protected:
WX_DEFINE_ARRAY(const wxMethod*, wxMethodPtrArray);
+// we need wxClassPtrArray to be defined _before_ wxClass itself,
+// since wxClass uses wxClassPtrArray.
+class wxClass;
+WX_DEFINE_ARRAY(const wxClass*, wxClassPtrArray);
+
+class wxXmlInterface;
+
+
// ----------------------------------------------------------------------------
// Represents a class of the wx API/interface.
// ----------------------------------------------------------------------------
{ m_strName=name; }
void SetAvailability(int nAvail)
{ m_nAvailability=nAvail; }
-
+ void SetParent(unsigned int k, const wxString& name)
+ { m_parents[k]=name; }
public: // getters
int GetAvailability() const
{ return m_nAvailability; }
+ //const wxClass *GetParent(unsigned int i) const
+ const wxString& GetParent(unsigned int i) const
+ { return m_parents[i]; }
+ unsigned int GetParentCount() const
+ { return m_parents.GetCount(); }
+
public: // misc
void AddMethod(const wxMethod& func)
{ m_methods.Add(func); }
+ void AddParent(const wxString& parent)//wxClass* parent)
+ { m_parents.Add(parent); }
+
// returns a single result (the first, which is also the only
// one if CheckConsistency() return true)
const wxMethod* FindMethod(const wxMethod& m) const;
+ // like FindMethod() but this one searches also recursively in
+ // the parents of this class.
+ const wxMethod* RecursiveUpwardFindMethod(const wxMethod& m,
+ const wxXmlInterface* allclasses) const;
+
// returns an array of pointers to the overloaded methods with the
// same given name
- wxMethodPtrArray FindMethodsNamed(const wxString& m) const;
+ wxMethodPtrArray FindMethodsNamed(const wxString& name) const;
+
+ // like FindMethodsNamed() but this one searches also recursively in
+ // the parents of this class.
+ wxMethodPtrArray RecursiveUpwardFindMethodsNamed(const wxString& name,
+ const wxXmlInterface* allclasses) const;
// dumps all methods to the given output stream
void Dump(wxTextOutputStream& stream) const;
wxString m_strHeader;
wxMethodArray m_methods;
+ // name of the base classes: we store the names and not the pointers
+ // because this makes _much_ easier the parsing process!
+ // (basically because when parsing class X which derives from Y,
+ // we may have not parsed yet class Y!)
+ wxArrayString m_parents;
+
// see the wxMethod::m_nAvailability field for more info
int m_nAvailability;
};
WX_DECLARE_OBJARRAY(wxClass, wxClassArray);
-WX_DEFINE_ARRAY(const wxClass*, wxClassPtrArray);
wxClassPtrArray FindClassesDefinedIn(const wxString& headerfile) const;
void ShowProgress()
- { /*wxPrint(".");*/ }
+ { /*wxFprintf(stderr, ".");*/ }
- bool CheckParseResults() const;
+ // is this interface coherent?
+ bool CheckConsistency() const;
protected:
wxClassArray m_classes;