]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fileconf.cpp
compilation fix for Borland C++
[wxWidgets.git] / src / common / fileconf.cpp
index bc153a0a9f9994af8c07c1ab4c2ee52ecd361391..7a82bf45aebc553ce04dfa65a3fa61053904d81c 100644 (file)
@@ -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,22 @@ bool wxFileConfig::DoReadLong(const wxString& key, long *pl) const
     return str.ToLong(pl);
 }
 
+#if wxUSE_BASE64
+
+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.ToAscii());
+    return true;
+}
+
+#endif // wxUSE_BASE64
+
 bool wxFileConfig::DoWriteString(const wxString& key, const wxString& szValue)
 {
     wxConfigPathChanger     path(this, key);
@@ -981,6 +999,15 @@ bool wxFileConfig::DoWriteLong(const wxString& key, long lValue)
   return Write(key, wxString::Format(_T("%ld"), lValue));
 }
 
+#if wxUSE_BASE64
+
+bool wxFileConfig::DoWriteBinary(const wxString& key, const wxMemoryBuffer& buf)
+{
+  return Write(key, wxBase64Encode(buf));
+}
+
+#endif // wxUSE_BASE64
+
 bool wxFileConfig::Flush(bool /* bCurrentOnly */)
 {
   if ( !IsDirty() || !m_fnLocalFile.GetFullPath() )