added support for binary data to wxConfig (slightly modified patch 1736788)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47353 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -42,6 +42,8 @@
|
||||
#include "wx/fileconf.h"
|
||||
#include "wx/filefn.h"
|
||||
|
||||
#include "wx/base64.h"
|
||||
|
||||
#include "wx/stdpaths.h"
|
||||
|
||||
#if defined(__WXMAC__)
|
||||
@@ -916,6 +918,18 @@ bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const
|
||||
return str.ToLong(pl);
|
||||
}
|
||||
|
||||
bool wxFileConfig::DoReadBinary(const wxString& key, wxMemoryBuffer* buf) const
|
||||
{
|
||||
wxCHECK_MSG( buf, false, _T("NULL buffer") );
|
||||
|
||||
wxString str;
|
||||
if ( !Read(key, &str) )
|
||||
return false;
|
||||
|
||||
*buf = wxBase64Decode(str);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue)
|
||||
{
|
||||
wxConfigPathChanger path(this, key);
|
||||
@@ -981,6 +995,11 @@ bool wxFileConfig::DoWriteLong(const wxString& key, long lValue)
|
||||
return Write(key, wxString::Format(_T("%ld"), lValue));
|
||||
}
|
||||
|
||||
bool wxFileConfig::DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf)
|
||||
{
|
||||
return Write(key, wxBase64Encode(buf));
|
||||
}
|
||||
|
||||
bool wxFileConfig::Flush(bool /* bCurrentOnly */)
|
||||
{
|
||||
if ( !IsDirty() || !m_fnLocalFile.GetFullPath() )
|
||||
|
Reference in New Issue
Block a user