wxLongLong to wxString operators.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31153 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -304,6 +304,8 @@ public:
|
|||||||
friend wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongNative&);
|
friend wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongNative&);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
friend wxString& operator<<(wxString&, const wxLongLongNative&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxLongLong_t m_ll;
|
wxLongLong_t m_ll;
|
||||||
};
|
};
|
||||||
@@ -487,6 +489,8 @@ public:
|
|||||||
friend wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongNative&);
|
friend wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongNative&);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
friend wxString& operator<<(wxString&, const wxULongLongNative&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
unsigned wxLongLong_t m_ll;
|
unsigned wxLongLong_t m_ll;
|
||||||
};
|
};
|
||||||
@@ -679,6 +683,8 @@ public:
|
|||||||
friend wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongWx&);
|
friend wxSTD ostream& operator<<(wxSTD ostream&, const wxLongLongWx&);
|
||||||
#endif // wxUSE_STD_IOSTREAM
|
#endif // wxUSE_STD_IOSTREAM
|
||||||
|
|
||||||
|
friend wxString& operator<<(wxString&, const wxLongLongWx&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// long is at least 32 bits, so represent our 64bit number as 2 longs
|
// long is at least 32 bits, so represent our 64bit number as 2 longs
|
||||||
|
|
||||||
@@ -861,6 +867,8 @@ public:
|
|||||||
friend wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongWx&);
|
friend wxSTD ostream& operator<<(wxSTD ostream&, const wxULongLongWx&);
|
||||||
#endif // wxUSE_STD_IOSTREAM
|
#endif // wxUSE_STD_IOSTREAM
|
||||||
|
|
||||||
|
friend wxString& operator<<(wxString&, const wxULongLongWx&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// long is at least 32 bits, so represent our 64bit number as 2 longs
|
// long is at least 32 bits, so represent our 64bit number as 2 longs
|
||||||
|
|
||||||
|
@@ -1162,4 +1162,14 @@ wxSTD ostream& operator<< (wxSTD ostream& o, const wxULongLong& ll)
|
|||||||
|
|
||||||
#endif // wxUSE_STD_IOSTREAM
|
#endif // wxUSE_STD_IOSTREAM
|
||||||
|
|
||||||
|
wxString& operator<< (wxString& s, const wxLongLong& ll)
|
||||||
|
{
|
||||||
|
return s << ll.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString& operator<< (wxString& s, const wxULongLong& ll)
|
||||||
|
{
|
||||||
|
return s << ll.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_LONGLONG
|
#endif // wxUSE_LONGLONG
|
||||||
|
@@ -240,30 +240,30 @@ void LongLongTestCase::BitOperations()
|
|||||||
for ( size_t n = 0; n < 33; n++ )
|
for ( size_t n = 0; n < 33; n++ )
|
||||||
{
|
{
|
||||||
wxLongLong b(a.GetHi(), a.GetLo()), c, d = b, e;
|
wxLongLong b(a.GetHi(), a.GetLo()), c, d = b, e;
|
||||||
d >>= n;
|
d >>= n;
|
||||||
c = b >> n;
|
c = b >> n;
|
||||||
CPPUNIT_ASSERT( c == d );
|
CPPUNIT_ASSERT( c == d );
|
||||||
d <<= n;
|
d <<= n;
|
||||||
e = c << n;
|
e = c << n;
|
||||||
CPPUNIT_ASSERT( d == e );
|
CPPUNIT_ASSERT( d == e );
|
||||||
|
|
||||||
#if wxUSE_LONGLONG_WX
|
#if wxUSE_LONGLONG_WX
|
||||||
wxLongLongWx b1(a.GetHi(), a.GetLo()), c1, d1 = b1, e1;
|
wxLongLongWx b1(a.GetHi(), a.GetLo()), c1, d1 = b1, e1;
|
||||||
d1 >>= n;
|
d1 >>= n;
|
||||||
c1 = b1 >> n;
|
c1 = b1 >> n;
|
||||||
CPPUNIT_ASSERT( c1 == d1 );
|
CPPUNIT_ASSERT( c1 == d1 );
|
||||||
d1 <<= n;
|
d1 <<= n;
|
||||||
e1 = c1 << n;
|
e1 = c1 << n;
|
||||||
CPPUNIT_ASSERT( d1 == e1 );
|
CPPUNIT_ASSERT( d1 == e1 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_LONGLONG_NATIVE
|
#if wxUSE_LONGLONG_NATIVE
|
||||||
wxLongLongNative b2(a.GetHi(), a.GetLo()), c2, d2 = b2, e2;
|
wxLongLongNative b2(a.GetHi(), a.GetLo()), c2, d2 = b2, e2;
|
||||||
d2 >>= n;
|
d2 >>= n;
|
||||||
c2 = b2 >> n;
|
c2 = b2 >> n;
|
||||||
CPPUNIT_ASSERT( c2 == d2 );
|
CPPUNIT_ASSERT( c2 == d2 );
|
||||||
d2 <<= n;
|
d2 <<= n;
|
||||||
e2 = c2 << n;
|
e2 = c2 << n;
|
||||||
CPPUNIT_ASSERT( d2 == e2 );
|
CPPUNIT_ASSERT( d2 == e2 );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -281,6 +281,10 @@ void LongLongTestCase::ToString()
|
|||||||
s2 = a.ToString();
|
s2 = a.ToString();
|
||||||
CPPUNIT_ASSERT( s1 == s2 );
|
CPPUNIT_ASSERT( s1 == s2 );
|
||||||
|
|
||||||
|
s2 = wxEmptyString;
|
||||||
|
s2 << a;
|
||||||
|
CPPUNIT_ASSERT( s1 == s2 );
|
||||||
|
|
||||||
#if wxUSE_LONGLONG_WX
|
#if wxUSE_LONGLONG_WX
|
||||||
wxLongLongWx a1 = testLongs[n];
|
wxLongLongWx a1 = testLongs[n];
|
||||||
s2 = a1.ToString();
|
s2 = a1.ToString();
|
||||||
|
Reference in New Issue
Block a user