moved Write(const wxString&) to .cpp files as they're going to be changed again soon; removed unnecessary casts
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45043 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -62,17 +62,7 @@ public:
|
|||||||
// returns the number of bytes written
|
// returns the number of bytes written
|
||||||
size_t Write(const void *pBuf, size_t nCount);
|
size_t Write(const void *pBuf, size_t nCount);
|
||||||
// returns true on success
|
// returns true on success
|
||||||
bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto())
|
bool Write(const wxString& s, const wxMBConv& conv = wxConvAuto());
|
||||||
{
|
|
||||||
const wxWX2MBbuf buf = s.mb_str(conv);
|
|
||||||
if (buf)
|
|
||||||
{
|
|
||||||
size_t size = strlen(buf);
|
|
||||||
return Write((const char *)buf, size) == size;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// flush data not yet written
|
// flush data not yet written
|
||||||
bool Flush();
|
bool Flush();
|
||||||
|
|
||||||
|
@@ -97,17 +97,7 @@ public:
|
|||||||
// returns the number of bytes written
|
// returns the number of bytes written
|
||||||
size_t Write(const void *pBuf, size_t nCount);
|
size_t Write(const void *pBuf, size_t nCount);
|
||||||
// returns true on success
|
// returns true on success
|
||||||
bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8)
|
bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8);
|
||||||
{
|
|
||||||
const wxWX2MBbuf buf = s.mb_str(conv);
|
|
||||||
if (buf)
|
|
||||||
{
|
|
||||||
size_t size = strlen(buf);
|
|
||||||
return Write((const char *) buf, size) == size;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// flush data not yet written
|
// flush data not yet written
|
||||||
bool Flush();
|
bool Flush();
|
||||||
|
|
||||||
|
@@ -161,13 +161,21 @@ size_t wxFFile::Write(const void *pBuf, size_t nCount)
|
|||||||
return nWritten;
|
return nWritten;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxFFile::Write(const wxString& s, const wxMBConv& conv)
|
||||||
|
{
|
||||||
|
const wxWX2MBbuf buf = s.mb_str(conv);
|
||||||
|
if ( !buf )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const size_t size = strlen(buf); // FIXME: use buf.length() when available
|
||||||
|
return Write(buf, size) == size;
|
||||||
|
}
|
||||||
|
|
||||||
bool wxFFile::Flush()
|
bool wxFFile::Flush()
|
||||||
{
|
{
|
||||||
if ( IsOpened() )
|
if ( IsOpened() )
|
||||||
{
|
{
|
||||||
// fflush returns non-zero on error
|
if ( fflush(m_fp) != 0 )
|
||||||
//
|
|
||||||
if ( fflush(m_fp) )
|
|
||||||
{
|
{
|
||||||
wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str());
|
wxLogSysError(_("failed to flush the file '%s'"), m_name.c_str());
|
||||||
|
|
||||||
|
@@ -323,6 +323,16 @@ size_t wxFile::Write(const void *pBuf, size_t nCount)
|
|||||||
return iRc;
|
return iRc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxFile::Write(const wxString& s, const wxMBConv& conv)
|
||||||
|
{
|
||||||
|
const wxWX2MBbuf buf = s.mb_str(conv);
|
||||||
|
if ( !buf )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const size_t size = strlen(buf); // FIXME: use buf.length() when available
|
||||||
|
return Write(buf, size) == size;
|
||||||
|
}
|
||||||
|
|
||||||
// flush
|
// flush
|
||||||
bool wxFile::Flush()
|
bool wxFile::Flush()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user