]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/longlong.cpp
Send generic wxTreeCtrl wxEVT_COMMAND_TREE_KEY_DOWN events from OnKeyDown rather...
[wxWidgets.git] / src / common / longlong.cpp
index b8364d85799ace4a069e05bd6a508ad57cbac2b2..27e771096da29796855d956a49d19cc88c1449c8 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        wx/longlong.cpp
+// Name:        src/common/longlong.cpp
 // Purpose:     implementation of wxLongLongNative
 // Author:      Jeffrey C. Ollie <jeff@ollie.clive.ia.us>, Vadim Zeitlin
 // Remarks:     this class is not public in wxWidgets 2.0! It is intentionally
 #endif
 
 #if wxUSE_LONGLONG
+
 #include "wx/longlong.h"
-#include "wx/math.h"       // for fabs()
 
-#if wxUSE_STREAMS
-#include "wx/txtstrm.h"
+#ifndef WX_PRECOMP
+    #include "wx/math.h"       // for fabs()
 #endif
 
-#if defined(__MWERKS__) && defined(__WXMSW__)
-#include <string.h>     // for memset()
-#else
-#include <memory.h>     // for memset()
+#if wxUSE_STREAMS
+    #include "wx/txtstrm.h"
 #endif
 
+#include <string.h>            // for memset()
+
 #include "wx/ioswrap.h"
 
 // ============================================================================
@@ -190,6 +190,19 @@ double wxLongLongWx::ToDouble() const
     return d;
 }
 
+double wxULongLongWx::ToDouble() const
+{
+    unsigned double d = m_hi;
+    d *= 1.0 + (double)ULONG_MAX;
+    d += m_lo;
+
+#ifdef wxLONGLONG_TEST_MODE
+    wxASSERT( d == m_ll );
+#endif // wxLONGLONG_TEST_MODE
+
+    return d;
+}
+
 wxLongLongWx wxLongLongWx::operator<<(int shift) const
 {
     wxLongLongWx ll(*this);
@@ -1159,7 +1172,7 @@ void *wxULongLongWx::asArray(void) const
             while ( ll != 0 )                                        \
             {                                                        \
                 long digit = (ll % 10).ToLong();                     \
-                result.Prepend((wxChar)(_T('0') - digit));           \
+                result.Prepend((wxChar)(wxT('0') - digit));          \
                 ll /= 10;                                            \
             }                                                        \
         }                                                            \
@@ -1168,15 +1181,15 @@ void *wxULongLongWx::asArray(void) const
             while ( ll != 0 )                                        \
             {                                                        \
                 long digit = (ll % 10).ToLong();                     \
-                result.Prepend((wxChar)(_T('0') + digit));           \
+                result.Prepend((wxChar)(wxT('0') + digit));          \
                 ll /= 10;                                            \
             }                                                        \
         }                                                            \
                                                                      \
         if ( result.empty() )                                        \
-            result = _T('0');                                        \
+            result = wxT('0');                                       \
         else if ( neg )                                              \
-            result.Prepend(_T('-'));                                 \
+            result.Prepend(wxT('-'));                                \
                                                                      \
         return result;                                               \
     }
@@ -1191,12 +1204,12 @@ void *wxULongLongWx::asArray(void) const
                                                                      \
         while ( ll != 0 )                                            \
         {                                                            \
-            result.Prepend((wxChar)(_T('0') + (ll % 10).ToULong())); \
+            result.Prepend((wxChar)(wxT('0') + (ll % 10).ToULong())); \
             ll /= 10;                                                \
         }                                                            \
                                                                      \
         if ( result.empty() )                                        \
-            result = _T('0');                                        \
+            result = wxT('0');                                       \
                                                                      \
         return result;                                               \
     }
@@ -1250,14 +1263,14 @@ WXDLLIMPEXP_BASE wxTextOutputStream& operator<< (wxTextOutputStream& o, const wx
     return o << ll.ToString();
 }
 
-#define READ_STRING_CHAR(s, idx, len) ((wxChar) ((idx!=len) ? s[idx++] : 0))
+#define READ_STRING_CHAR(s, idx, len) ((idx!=len) ? (wxChar)s[idx++] : wxT('\0'))
 
 WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o, wxULongLong &ll)
 {
     wxString s = o.ReadWord();
 
     ll = wxULongLong(0l, 0l);
-    size_t length = s.Length();
+    size_t length = s.length();
     size_t idx = 0;
 
     wxChar ch = READ_STRING_CHAR(s, idx, length);
@@ -1282,7 +1295,7 @@ WXDLLIMPEXP_BASE class wxTextInputStream &operator>>(class wxTextInputStream &o,
     wxString s = o.ReadWord();
 
     ll = wxLongLong(0l, 0l);
-    size_t length = s.Length();
+    size_t length = s.length();
     size_t idx = 0;
 
     wxChar ch = READ_STRING_CHAR(s, idx, length);