]> git.saurik.com Git - wxWidgets.git/commitdiff
compilation fixes for wxAnyStrPtr for VC6
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 25 Mar 2009 00:44:25 +0000 (00:44 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 25 Mar 2009 00:44:25 +0000 (00:44 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59824 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/anystr.h
include/wx/datetime.h

index f8167456253e6d7c6c838e3c5016b603b352b171..029e5095cf0189c25dcb7284e66882c72380b9e8 100644 (file)
@@ -61,6 +61,11 @@ public:
     // different conversions to pointers)
     operator bool() const { return m_str != NULL; }
 
+#ifdef __VISUALC6__
+    // FIXME-VC6: it also needs this one or it complains about ambiguity
+    bool operator!() const { return !((bool)*this); }
+#endif // __VISUALC6__
+
 
     // and these are the conversions operator which allow to assign the result
     // of FuncReturningAnyStrPtr() to either char* or wxChar* (i.e. wchar_t*)
@@ -132,5 +137,14 @@ private:
     wxDECLARE_NO_ASSIGN_CLASS(wxAnyStrPtr);
 };
 
+// FIXME-VC6: expressions involving logical operations are not compiled
+//            correctly without these operators
+#ifdef __VISUALC6__
+    inline bool operator||(const wxAnyStrPtr& p, bool v) { return (bool)p || v; }
+    inline bool operator||(bool v, const wxAnyStrPtr& p) { return v || (bool)p; }
+    inline bool operator&&(const wxAnyStrPtr& p, bool v) { return (bool)p && v; }
+    inline bool operator&&(bool v, const wxAnyStrPtr& p) { return v && (bool)p; }
+#endif // __VISUALC6__
+
 #endif // _WX_ANYSTR_H_
 
index b7df66ae9be19f8b5fa9210bb028553cf27d3a12..5b26a830a07bc4cd193d1f84960ac478856ce39f 100644 (file)
@@ -1136,21 +1136,34 @@ public:
         // provide compatibility overloads for them
     bool ParseISODate(const wxString& date)
     {
+        // FIXME-VC6: notice that writing "return ParseFormat() && ..." crashes
+        //            VC6 with internal compiler error so don't attempt to
+        //            simplify this code like this
+
         wxString::const_iterator end;
-        return ParseFormat(date, wxS("%Y-%m-%d"), &end) && end == date.end();
+        if ( !ParseFormat(date, wxS("%Y-%m-%d"), &end) )
+            return false;
+
+        return end == date.end();
     }
 
     bool ParseISOTime(const wxString& time)
     {
         wxString::const_iterator end;
-        return ParseFormat(time, wxS("%H:%M:%S"), &end) && end == time.end();
+        if ( !ParseFormat(time, wxS("%H:%M:%S"), &end) )
+            return false;
+        
+        return end == time.end();
     }
 
     bool ParseISOCombined(const wxString& datetime, char sep = 'T')
     {
         wxString::const_iterator end;
         const wxString fmt = wxS("%Y-%m-%d") + wxString(sep) + wxS("%H:%M:%S");
-        return ParseFormat(datetime, fmt, &end) && end == datetime.end();
+        if ( !ParseFormat(datetime, fmt, &end) )
+           return false;
+       
+        return end == datetime.end();
     }
 
         // parse a string containing the date/time in "free" format, this