]> git.saurik.com Git - wxWidgets.git/commitdiff
more stream-like insertion operators
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 5 Jan 2000 16:38:12 +0000 (16:38 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 5 Jan 2000 16:38:12 +0000 (16:38 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5260 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/string.h
src/common/string.cpp

index d469d96866ffa71c09ced4f79aaf57b7ace26d55..f9155fbf60e9114c06c8a3bbb3bddff225be913f 100644 (file)
@@ -280,7 +280,9 @@ private:
   //
   // try `s << i' or `s.Printf("%d", i)' instead
   wxString(int);
+  wxString(unsigned int);
   wxString(long);
+  wxString(unsigned long);
 
 public:
   // constructors and destructor
@@ -530,11 +532,23 @@ public:
 
   // stream-like functions
       // insert an int into string
-  wxString& operator<<(int i);
+  wxString& operator<<(int i)
+    { return (*this) << Format(_T("%d"), i); }
+      // insert an unsigned int into string
+  wxString& operator<<(unsigned int ui)
+    { return (*this) << Format(_T("%u"), ui); }
+      // insert a long into string
+  wxString& operator<<(long l)
+    { return (*this) << Format(_T("%ld"), l); }
+      // insert an unsigned long into string
+  wxString& operator<<(unsigned long ul)
+    { return (*this) << Format(_T("%lu"), ul); }
       // insert a float into string
-  wxString& operator<<(float f);
+  wxString& operator<<(float f)
+    { return (*this) << Format(_T("%f"), f); }
       // insert a double into string
-  wxString& operator<<(double d);
+  wxString& operator<<(double d)
+    { return (*this) << Format(_T("%g"), d); }
 
   // string comparison
     // case-sensitive comparison (returns a value < 0, = 0 or > 0)
index 29dc8d60dad2736cf230f406b063513677fbdda7..f37934d939c1aa8b65c26ca4fe76a14df9c4b4a2 100644 (file)
@@ -1076,33 +1076,6 @@ bool wxString::ToDouble(double *val) const
     return !*end && (end != start);
 }
 
-// ---------------------------------------------------------------------------
-// stream-like operators
-// ---------------------------------------------------------------------------
-wxString& wxString::operator<<(int i)
-{
-    wxString res;
-    res.Printf(wxT("%d"), i);
-
-    return (*this) << res;
-}
-
-wxString& wxString::operator<<(float f)
-{
-    wxString res;
-    res.Printf(wxT("%f"), f);
-
-    return (*this) << res;
-}
-
-wxString& wxString::operator<<(double d)
-{
-    wxString res;
-    res.Printf(wxT("%g"), d);
-
-    return (*this) << res;
-}
-
 // ---------------------------------------------------------------------------
 // formatted output
 // ---------------------------------------------------------------------------