Add wxInt64 support to wxText{Input,Output}Stream.
Add explicit Read64[S]() and Write64() methods. Closes #14685. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -24,6 +24,7 @@ All:
|
|||||||
- Add wxScopedArray ctor taking the number of elements to allocate.
|
- Add wxScopedArray ctor taking the number of elements to allocate.
|
||||||
- Add wxDynamicLibrary::GetModuleFromAddress() (Luca Bacci).
|
- Add wxDynamicLibrary::GetModuleFromAddress() (Luca Bacci).
|
||||||
- Implement wxThread::SetPriority() for pthreads (Luca Bacci).
|
- Implement wxThread::SetPriority() for pthreads (Luca Bacci).
|
||||||
|
- Add wxInt64 support to wxText{Input,Output}Stream (Alexander Bezzubikov).
|
||||||
|
|
||||||
All (GUI):
|
All (GUI):
|
||||||
|
|
||||||
|
@@ -46,9 +46,12 @@ public:
|
|||||||
|
|
||||||
const wxInputStream& GetInputStream() const { return m_input; }
|
const wxInputStream& GetInputStream() const { return m_input; }
|
||||||
|
|
||||||
wxUint32 Read32(int base = 10); // base may be between 2 and 36, inclusive, or the special 0 (= C format)
|
// base may be between 2 and 36, inclusive, or the special 0 (= C format)
|
||||||
|
wxUint64 Read64(int base = 10);
|
||||||
|
wxUint32 Read32(int base = 10);
|
||||||
wxUint16 Read16(int base = 10);
|
wxUint16 Read16(int base = 10);
|
||||||
wxUint8 Read8(int base = 10);
|
wxUint8 Read8(int base = 10);
|
||||||
|
wxInt64 Read64S(int base = 10);
|
||||||
wxInt32 Read32S(int base = 10);
|
wxInt32 Read32S(int base = 10);
|
||||||
wxInt16 Read16S(int base = 10);
|
wxInt16 Read16S(int base = 10);
|
||||||
wxInt8 Read8S(int base = 10);
|
wxInt8 Read8S(int base = 10);
|
||||||
@@ -68,8 +71,10 @@ public:
|
|||||||
#endif // wxUSE_UNICODE
|
#endif // wxUSE_UNICODE
|
||||||
wxTextInputStream& operator>>(wxInt16& i);
|
wxTextInputStream& operator>>(wxInt16& i);
|
||||||
wxTextInputStream& operator>>(wxInt32& i);
|
wxTextInputStream& operator>>(wxInt32& i);
|
||||||
|
wxTextInputStream& operator>>(wxInt64& i);
|
||||||
wxTextInputStream& operator>>(wxUint16& i);
|
wxTextInputStream& operator>>(wxUint16& i);
|
||||||
wxTextInputStream& operator>>(wxUint32& i);
|
wxTextInputStream& operator>>(wxUint32& i);
|
||||||
|
wxTextInputStream& operator>>(wxUint64& i);
|
||||||
wxTextInputStream& operator>>(double& i);
|
wxTextInputStream& operator>>(double& i);
|
||||||
wxTextInputStream& operator>>(float& f);
|
wxTextInputStream& operator>>(float& f);
|
||||||
|
|
||||||
@@ -118,6 +123,7 @@ public:
|
|||||||
void SetMode( wxEOL mode = wxEOL_NATIVE );
|
void SetMode( wxEOL mode = wxEOL_NATIVE );
|
||||||
wxEOL GetMode() { return m_mode; }
|
wxEOL GetMode() { return m_mode; }
|
||||||
|
|
||||||
|
void Write64(wxUint64 i);
|
||||||
void Write32(wxUint32 i);
|
void Write32(wxUint32 i);
|
||||||
void Write16(wxUint16 i);
|
void Write16(wxUint16 i);
|
||||||
void Write8(wxUint8 i);
|
void Write8(wxUint8 i);
|
||||||
@@ -135,8 +141,10 @@ public:
|
|||||||
#endif // wxUSE_UNICODE
|
#endif // wxUSE_UNICODE
|
||||||
wxTextOutputStream& operator<<(wxInt16 c);
|
wxTextOutputStream& operator<<(wxInt16 c);
|
||||||
wxTextOutputStream& operator<<(wxInt32 c);
|
wxTextOutputStream& operator<<(wxInt32 c);
|
||||||
|
wxTextOutputStream& operator<<(wxInt64 c);
|
||||||
wxTextOutputStream& operator<<(wxUint16 c);
|
wxTextOutputStream& operator<<(wxUint16 c);
|
||||||
wxTextOutputStream& operator<<(wxUint32 c);
|
wxTextOutputStream& operator<<(wxUint32 c);
|
||||||
|
wxTextOutputStream& operator<<(wxUint64 c);
|
||||||
wxTextOutputStream& operator<<(double f);
|
wxTextOutputStream& operator<<(double f);
|
||||||
wxTextOutputStream& operator<<(float f);
|
wxTextOutputStream& operator<<(float f);
|
||||||
|
|
||||||
|
@@ -113,6 +113,24 @@ public:
|
|||||||
*/
|
*/
|
||||||
wxInt32 Read32S(int base = 10);
|
wxInt32 Read32S(int base = 10);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a 64 bit unsigned integer from the stream.
|
||||||
|
|
||||||
|
See Read8() for the description of the @a base parameter.
|
||||||
|
|
||||||
|
@since 3.1.0
|
||||||
|
*/
|
||||||
|
wxUint64 Read64(int base = 10);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reads a 64 bit signed integer from the stream.
|
||||||
|
|
||||||
|
See Read8() for the description of the @a base parameter.
|
||||||
|
|
||||||
|
@since 3.1.0
|
||||||
|
*/
|
||||||
|
wxInt64 Read64S(int base = 10);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Reads a single unsigned byte from the stream, given in base @a base.
|
Reads a single unsigned byte from the stream, given in base @a base.
|
||||||
|
|
||||||
@@ -283,15 +301,22 @@ public:
|
|||||||
void SetMode(wxEOL mode = wxEOL_NATIVE);
|
void SetMode(wxEOL mode = wxEOL_NATIVE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes the 16 bit integer @a i16 to the stream.
|
Writes the 64 bit integer @a i64 to the stream.
|
||||||
|
|
||||||
|
@since 3.1.0
|
||||||
*/
|
*/
|
||||||
void Write16(wxUint16 i16);
|
void Write64(wxUint64 i64);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes the 32 bit integer @a i32 to the stream.
|
Writes the 32 bit integer @a i32 to the stream.
|
||||||
*/
|
*/
|
||||||
void Write32(wxUint32 i32);
|
void Write32(wxUint32 i32);
|
||||||
|
|
||||||
|
/**
|
||||||
|
Writes the 16 bit integer @a i16 to the stream.
|
||||||
|
*/
|
||||||
|
void Write16(wxUint16 i16);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Writes the single byte @a i8 to the stream.
|
Writes the single byte @a i8 to the stream.
|
||||||
*/
|
*/
|
||||||
|
@@ -146,6 +146,21 @@ bool wxTextInputStream::EatEOL(const wxChar &c)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxUint64 wxTextInputStream::Read64(int base)
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( !base || (base > 1 && base <= 36), wxT("invalid base") );
|
||||||
|
if(!m_input) return 0;
|
||||||
|
|
||||||
|
wxString word = ReadWord();
|
||||||
|
if(word.empty())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
wxUint64 res;
|
||||||
|
if(!word.ToULongLong(&res, base))
|
||||||
|
return 0;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
wxUint32 wxTextInputStream::Read32(int base)
|
wxUint32 wxTextInputStream::Read32(int base)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !base || (base > 1 && base <= 36), wxT("invalid base") );
|
wxASSERT_MSG( !base || (base > 1 && base <= 36), wxT("invalid base") );
|
||||||
@@ -167,6 +182,21 @@ wxUint8 wxTextInputStream::Read8(int base)
|
|||||||
return (wxUint8)Read32(base);
|
return (wxUint8)Read32(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxInt64 wxTextInputStream::Read64S(int base)
|
||||||
|
{
|
||||||
|
wxASSERT_MSG( !base || (base > 1 && base <= 36), wxT("invalid base") );
|
||||||
|
if(!m_input) return 0;
|
||||||
|
|
||||||
|
wxString word = ReadWord();
|
||||||
|
if(word.empty())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
wxInt64 res;
|
||||||
|
if(!word.ToLongLong(&res, base))
|
||||||
|
return 0;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
wxInt32 wxTextInputStream::Read32S(int base)
|
wxInt32 wxTextInputStream::Read32S(int base)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !base || (base > 1 && base <= 36), wxT("invalid base") );
|
wxASSERT_MSG( !base || (base > 1 && base <= 36), wxT("invalid base") );
|
||||||
@@ -287,6 +317,12 @@ wxTextInputStream& wxTextInputStream::operator>>(wxInt32& i)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxTextInputStream& wxTextInputStream::operator>>(wxInt64& i)
|
||||||
|
{
|
||||||
|
i = (wxInt64)Read64();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
wxTextInputStream& wxTextInputStream::operator>>(wxUint16& i)
|
wxTextInputStream& wxTextInputStream::operator>>(wxUint16& i)
|
||||||
{
|
{
|
||||||
i = Read16();
|
i = Read16();
|
||||||
@@ -299,6 +335,12 @@ wxTextInputStream& wxTextInputStream::operator>>(wxUint32& i)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxTextInputStream& wxTextInputStream::operator>>(wxUint64& i)
|
||||||
|
{
|
||||||
|
i = Read64();
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
wxTextInputStream& wxTextInputStream::operator>>(double& i)
|
wxTextInputStream& wxTextInputStream::operator>>(double& i)
|
||||||
{
|
{
|
||||||
i = ReadDouble();
|
i = ReadDouble();
|
||||||
@@ -354,6 +396,14 @@ void wxTextOutputStream::SetMode(wxEOL mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxTextOutputStream::Write64(wxUint64 i)
|
||||||
|
{
|
||||||
|
wxString str;
|
||||||
|
str.Printf(wxT("%" wxLongLongFmtSpec "u"), (unsigned long long)i);
|
||||||
|
|
||||||
|
WriteString(str);
|
||||||
|
}
|
||||||
|
|
||||||
void wxTextOutputStream::Write32(wxUint32 i)
|
void wxTextOutputStream::Write32(wxUint32 i)
|
||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
@@ -495,6 +545,13 @@ wxTextOutputStream& wxTextOutputStream::operator<<(wxInt32 c)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxTextOutputStream& wxTextOutputStream::operator<<(wxInt64 c)
|
||||||
|
{
|
||||||
|
WriteString(wxString::Format("%" wxLongLongFmtSpec "d", c));
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
wxTextOutputStream& wxTextOutputStream::operator<<(wxUint16 c)
|
wxTextOutputStream& wxTextOutputStream::operator<<(wxUint16 c)
|
||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
@@ -513,6 +570,13 @@ wxTextOutputStream& wxTextOutputStream::operator<<(wxUint32 c)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxTextOutputStream& wxTextOutputStream::operator<<(wxUint64 c)
|
||||||
|
{
|
||||||
|
WriteString(wxString::Format("%" wxLongLongFmtSpec "u", c));
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
wxTextOutputStream &wxTextOutputStream::operator<<(double f)
|
wxTextOutputStream &wxTextOutputStream::operator<<(double f)
|
||||||
{
|
{
|
||||||
WriteDouble(f);
|
WriteDouble(f);
|
||||||
|
Reference in New Issue
Block a user