]> git.saurik.com Git - wxWidgets.git/commitdiff
compilation fixes for wxAnyStrPtr for VC7; mention it in the change log
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 25 Mar 2009 09:23:30 +0000 (09:23 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 25 Mar 2009 09:23:30 +0000 (09:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59826 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/anystr.h

index 532d531ab2c11cd0b3436f56d3495c4948302ecd..2eae3302519f95f0386d906180723a5c8a9e838a 100644 (file)
@@ -33,6 +33,12 @@ changes:
      wxString, in many cases code using it won't compile any more and NULL
      should be replaced with an empty string.
 
+- Functions returning "const wxChar *" were changed as well. Mostly they now
+  return wxString which is then transparently convertible to either "const char
+  *" or "const wchar_t *" but in some cases, notably wxDateTime::ParseXXX(),
+  the returned string could be NULL and so a separate helper class is used. If
+  you obtain compilation errors because of this, you can always correct them by
+  explicitly assigning the function return value to a variable of wanted type.
 
 - Some structure fields which used to be of type "const wxChar *" (such as
   wxCmdLineEntryDesc::shortName, longName and description fields) are now of
index 029e5095cf0189c25dcb7284e66882c72380b9e8..678741bdef0f2b5866b907cde21ac62dc8082a1b 100644 (file)
@@ -61,10 +61,9 @@ 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
+    // at least VC6 and VC7 also need this one or they complain about ambiguity
+    // for !anystr expressions
     bool operator!() const { return !((bool)*this); }
-#endif // __VISUALC6__
 
 
     // and these are the conversions operator which allow to assign the result
@@ -129,22 +128,21 @@ public:
     // already works fine.
 
 private:
-    // the original string and the offset in it we correspond to, if the string
-    // is NULL this object is NULL pointer-like
+    // the original string and the position in it we correspond to, if the
+    // string is NULL this object is NULL pointer-like
     const wxString * const m_str;
     const wxString::const_iterator m_iter;
 
     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__
+// at least for VC6 and VC7 these operators are needed too, otherwise boolean
+// expressions involving wxAnyStrPtr don't compile because of ambiguity between
+// built-in overloads of these operators for (bool, bool/char*/wchar_t*)
+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 // _WX_ANYSTR_H_