X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce4169a4d129fc6cd165b2e9ccc5cf5d48356020..d4c241b9e6b05a6a2ca5b701d25792994a52c023:/src/common/docview.cpp diff --git a/src/common/docview.cpp b/src/common/docview.cpp index a7fd1a2209..3834c2a2e7 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -25,11 +25,7 @@ #include "wx/wxprec.h" #ifdef __BORLANDC__ - #pragma hdrstop -#endif - -#ifndef WX_PRECOMP - #include "wx/defs.h" + #pragma hdrstop #endif #if wxUSE_DOC_VIEW_ARCHITECTURE @@ -63,12 +59,15 @@ #include #include -#include "wx/ioswrap.h" - -#if wxUSE_IOSTREAMH +#if wxUSE_STD_IOSTREAM + #include "wx/ioswrap.h" + #if wxUSE_IOSTREAMH #include -#else + #else #include + #endif +#else + #include "wx/wfstream.h" #endif // ---------------------------------------------------------------------------- @@ -281,8 +280,13 @@ bool wxDocument::OnSaveDocument(const wxString& file) else msgTitle = wxString(_("File error")); +#if wxUSE_STD_IOSTREAM ofstream store(file.fn_str()); if (store.fail() || store.bad()) +#else + wxFileOutputStream store(file.fn_str()); + if (store.LastError() == 0) +#endif { (void)wxMessageBox(_("Sorry, could not open this file for saving."), msgTitle, wxOK | wxICON_EXCLAMATION, GetDocumentWindow()); @@ -312,8 +316,13 @@ bool wxDocument::OnOpenDocument(const wxString& file) else msgTitle = wxString(_("File error")); +#if wxUSE_STD_IOSTREAM ifstream store(file.fn_str()); if (store.fail() || store.bad()) +#else + wxFileInputStream store(file.fn_str()); + if (store.LastError() == 0) +#endif { (void)wxMessageBox(_("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION, GetDocumentWindow()); @@ -334,19 +343,27 @@ bool wxDocument::OnOpenDocument(const wxString& file) return TRUE; } +#if wxUSE_STD_IOSTREAM istream& wxDocument::LoadObject(istream& stream) { - // wxObject::LoadObject(stream); - return stream; } ostream& wxDocument::SaveObject(ostream& stream) { - // wxObject::SaveObject(stream); - return stream; } +#else +bool wxDocument::LoadObject(wxInputStream& stream) +{ + return TRUE; +} + +bool wxDocument::SaveObject(wxOutputStream& stream) +{ + return TRUE; +} +#endif bool wxDocument::Revert() { @@ -1947,6 +1964,7 @@ void wxFileHistory::AddFilesToMenu(wxMenu* menu) // manipulate files directly // ---------------------------------------------------------------------------- +#if wxUSE_STD_IOSTREAM bool wxTransferFileToStream(const wxString& filename, ostream& stream) { FILE *fd1; @@ -1981,6 +1999,7 @@ bool wxTransferStreamToFile(istream& stream, const wxString& filename) fclose (fd1); return TRUE; } +#endif #endif // wxUSE_DOC_VIEW_ARCHITECTURE