From 45ea509a21a23ce62caadb6a0a9aaf3799c13d39 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 14 Jul 1998 22:15:29 +0000 Subject: [PATCH] common constants (wxSeekMode) and types (off_t) to wxFile and wxStream are now defined in filefn.h included by both file.h and stream.h git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@270 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/file.h | 20 ++++---------------- include/wx/filefn.h | 26 ++++++++++++++++++++++++-- include/wx/stream.h | 14 +++----------- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/include/wx/file.h b/include/wx/file.h index e3f8ab1fc3..fc1e0a5f17 100644 --- a/include/wx/file.h +++ b/include/wx/file.h @@ -17,20 +17,8 @@ #pragma interface "file.h" #endif -// ---------------------------------------------------------------------------- -// simple types -// ---------------------------------------------------------------------------- - #include "wx/string.h" #include "wx/filefn.h" -#include "wx/stream.h" // for wxSeekMode - -// define off_t -#include - -#ifdef _MSC_VER - #define off_t _off_t -#endif // ---------------------------------------------------------------------------- // constants @@ -85,7 +73,7 @@ public: // returns true on success uint Write(const void *pBuf, uint nCount); // returns true on success - bool Write(const wxString& str) { return Write(str.c_str(), str.Len()); } + bool Write(const wxString& s) { return Write(s.c_str(), s.Len()) != 0; } // flush data not yet written bool Flush(); @@ -144,8 +132,8 @@ public: bool IsOpened() const { return m_file.IsOpened(); } // I/O (both functions return true on success, false on failure) - bool Write(const void *p, uint n) { return m_file.Write(p, n); } - bool Write(const wxString& str) { return m_file.Write(str); } + bool Write(const void *p, uint n) { return m_file.Write(p, n) != 0; } + bool Write(const wxString& str) { return m_file.Write(str); } // different ways to close the file // validate changes and delete the old file of name m_strName @@ -163,4 +151,4 @@ private: }; #endif - // __FILEH__ + // __FILEH__ diff --git a/include/wx/filefn.h b/include/wx/filefn.h index e0ad458fb5..720beb4bf2 100644 --- a/include/wx/filefn.h +++ b/include/wx/filefn.h @@ -6,7 +6,7 @@ // Created: 29/01/98 // RCS-ID: $Id$ // Copyright: (c) 1998 Julian Smart -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifndef __FILEFNH__ @@ -16,8 +16,26 @@ #pragma interface "filefn.h" #endif -#include "wx/list.h" +// ---------------------------------------------------------------------------- +// constants +// ---------------------------------------------------------------------------- +// define off_t +#include + +#ifdef _MSC_VER + #define off_t _off_t +#endif + +typedef enum { + wxFromStart, + wxFromCurrent, + wxFromEnd +} wxSeekMode; + +// ---------------------------------------------------------------------------- +// functions +// ---------------------------------------------------------------------------- bool WXDLLEXPORT wxFileExists(const wxString& filename); #define FileExists wxFileExists @@ -158,6 +176,10 @@ void WXDLLEXPORT wxSplitPath(const char *pszFileName, // find a file in a list of directories, returns false if not found bool WXDLLEXPORT wxFindFileInPath(wxString *pStr, const char *pszPath, const char *pszFile); +// ---------------------------------------------------------------------------- +// classes +// ---------------------------------------------------------------------------- + // Path searching class WXDLLEXPORT wxPathList: public wxStringList { diff --git a/include/wx/stream.h b/include/wx/stream.h index 692d522305..d22e9c0f9e 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -17,21 +17,13 @@ #endif #include -#include -#include - -#ifdef _MSC_VER - #define off_t _off_t -#endif +#include "wx/object.h" +#include "wx/string.h" +#include "wx/filefn.h" // for off_t and wxSeekMode /* * wxStream: base classes */ - -typedef enum { - wxFromStart, wxFromCurrent, wxFromEnd -} wxSeekMode; - class wxOutputStream; class wxInputStream: virtual public wxObject { DECLARE_ABSTRACT_CLASS(wxInputStream) -- 2.45.2