]> git.saurik.com Git - wxWidgets.git/blobdiff - utils/ifacecheck/src/xmlparser.h
lock wxPendingEventsLocker when deleting the handler from wxPendingEvents (patch...
[wxWidgets.git] / utils / ifacecheck / src / xmlparser.h
index 989aafbfafeb783c1c1c09abd57ea855f1c2decd..a002f4244d74b37c847de5c375712a3357a154b5 100644 (file)
@@ -18,7 +18,7 @@
 
 // helper macros
 #define LogMessage(fmt, ...)   { wxPrintf(fmt "\n", __VA_ARGS__); fflush(stdout); }
-#define LogWarning(fmt, ...)   { wxPrintf("WARNING: " fmt "\n", __VA_ARGS__); fflush(stdout); }
+#define LogWarning(fmt, ...)   { wxPrintf(fmt "\n", __VA_ARGS__); fflush(stdout); }
 #define LogError(fmt, ...)     { wxPrintf("ERROR: " fmt "\n", __VA_ARGS__); fflush(stdout); }
 #define wxPrint(str)           { wxPrintf(str); fflush(stdout); }
 
@@ -32,14 +32,12 @@ class wxType
 public:
     wxType() {}
     wxType(const wxString& type)
-        { SetFromString(type); }
+        { SetTypeFromString(type); }
 
-    void SetFromString(const wxString& t);
+    void SetTypeFromString(const wxString& t);
     wxString GetAsString() const
         { return m_strType; }
 
-    wxString GetClean() const;
-
     bool IsConst() const
         { return m_strType.Contains("const"); }
     bool IsStatic() const
@@ -57,12 +55,52 @@ public:
 
 protected:
     wxString m_strType;
+
+    // utility for doing comparisons
+    wxString GetClean() const;
 };
 
 extern wxType wxEmptyType;
 WX_DECLARE_OBJARRAY(wxType, wxTypeArray);
 
 
+// ----------------------------------------------------------------------------
+// Represents a type used as argument for some wxMethod
+// ----------------------------------------------------------------------------
+class wxArgumentType : public wxType
+{
+public:
+    wxArgumentType() {}
+    wxArgumentType(const wxString& type, const wxString& defVal,
+                   const wxString& argName = wxEmptyString)
+        { SetTypeFromString(type); SetDefaultValue(defVal); m_strArgName = argName; }
+
+    void SetArgumentName(const wxString& name)
+        { m_strArgName=name.Strip(wxString::both); }
+    wxString GetArgumentName() const
+        { return m_strArgName; }
+
+    void SetDefaultValue(const wxString& defval);
+    wxString GetDefaultValue() const
+        { return m_strDefaultValue; }
+
+    bool HasDefaultValue() const
+        { return !m_strDefaultValue.IsEmpty(); }
+
+    bool operator==(const wxArgumentType& m) const;
+    bool operator!=(const wxArgumentType& m) const
+        { return !(*this == m); }
+
+protected:
+    wxString m_strDefaultValue;
+    wxString m_strArgName;      // this one only makes sense when this wxType is
+                                // used as argument type (and not as return type)
+                                // and can be empty.
+};
+
+extern wxArgumentType wxEmptyArgumentType;
+WX_DECLARE_OBJARRAY(wxArgumentType, wxArgumentTypeArray);
+
 
 // ----------------------------------------------------------------------------
 // Represents a single prototype of a class' member.
@@ -71,20 +109,19 @@ class wxMethod
 {
 public:
     wxMethod()
-        { m_bConst=m_bVirtual=m_bStatic=m_bDeprecated=false; m_nLine=-1; }
+        { m_bConst=m_bVirtual=m_bPureVirtual=m_bStatic=m_bDeprecated=false; m_nLine=-1; }
 
     wxMethod(const wxType& rettype, const wxString& name,
-             const wxTypeArray& arguments, const wxArrayString& defaults,
+             const wxArgumentTypeArray& arguments,
              bool isConst, bool isStatic, bool isVirtual)
         : m_retType(rettype), m_strName(name.Strip(wxString::both)),
           m_bConst(isConst), m_bStatic(isStatic), m_bVirtual(isVirtual)
-        { SetArgumentTypes(arguments,defaults); m_nLine=-1; }
+        { SetArgumentTypes(arguments); m_nLine=-1; }
 
 
 public:     // getters
 
-    //void SetFromString(const wxString& proto);
-    wxString GetAsString() const;
+    wxString GetAsString(bool bWithArgumentNames = true) const;
 
     // parser of the prototype:
     // all these functions return strings with spaces stripped
@@ -92,10 +129,8 @@ public:     // getters
         { return m_retType; }
     wxString GetName() const
         { return m_strName; }
-    wxTypeArray GetArgumentTypes() const
+    wxArgumentTypeArray GetArgumentTypes() const
         { return m_args; }
-    wxArrayString GetArgumentDefaults() const
-        { return m_argDefaults; }
     int GetLocation() const
         { return m_nLine; }
 
@@ -105,6 +140,8 @@ public:     // getters
         { return m_bStatic; }
     bool IsVirtual() const
         { return m_bVirtual; }
+    bool IsPureVirtual() const
+        { return m_bPureVirtual; }
 
     bool IsOk() const;
     bool IsCtor() const
@@ -122,13 +159,19 @@ public:     // setters
         { m_retType=t; }
     void SetName(const wxString& name)
         { m_strName=name; }
-    void SetArgumentTypes(const wxTypeArray& arr, const wxArrayString& defaults);
+    void SetArgumentTypes(const wxArgumentTypeArray& arr)
+        { m_args=arr; }
     void SetConst(bool c = true)
         { m_bConst=c; }
     void SetStatic(bool c = true)
         { m_bStatic=c; }
     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)
@@ -145,11 +188,11 @@ public:     // misc
 protected:
     wxType m_retType;
     wxString m_strName;
-    wxTypeArray m_args;
-    wxArrayString m_argDefaults;
+    wxArgumentTypeArray m_args;
     bool m_bConst;
     bool m_bStatic;
     bool m_bVirtual;
+    bool m_bPureVirtual;
     bool m_bDeprecated;
     int m_nLine;
 };
@@ -251,6 +294,9 @@ public:
             return methods;
         }
 
+    // pass a full-path header filename:
+    wxClassPtrArray FindClassesDefinedIn(const wxString& headerfile) const;
+
     void ShowProgress()
         { /*wxPrint(".");*/ }