]> git.saurik.com Git - wxWidgets.git/blob - include/wx/textfile.h
Added DetachOldLog to avoid destruction of old log target
[wxWidgets.git] / include / wx / textfile.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/textfile.h
3 // Purpose: class wxTextFile to work with text files of _small_ size
4 // (file is fully loaded in memory) and which understands CR/LF
5 // differences between platforms.
6 // Author: Vadim Zeitlin
7 // Modified by:
8 // Created: 03.04.98
9 // RCS-ID: $Id$
10 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
11 // Licence: wxWindows licence
12 ///////////////////////////////////////////////////////////////////////////////
13
14 #ifndef _WX_TEXTFILE_H
15 #define _WX_TEXTFILE_H
16
17 #include "wx/defs.h"
18
19 #include "wx/textbuf.h"
20
21 #if wxUSE_TEXTFILE
22
23 #include "wx/file.h"
24
25 // ----------------------------------------------------------------------------
26 // wxTextFile
27 // ----------------------------------------------------------------------------
28
29 class WXDLLIMPEXP_BASE wxTextFile : public wxTextBuffer
30 {
31 public:
32 // constructors
33 wxTextFile() { }
34 wxTextFile(const wxString& strFileName);
35
36 protected:
37 // implement the base class pure virtuals
38 virtual bool OnExists() const;
39 virtual bool OnOpen(const wxString &strBufferName,
40 wxTextBufferOpenMode OpenMode);
41 virtual bool OnClose();
42 virtual bool OnRead(const wxMBConv& conv);
43 virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv);
44
45 private:
46
47 wxFile m_file;
48
49 DECLARE_NO_COPY_CLASS(wxTextFile)
50 };
51
52 #else // !wxUSE_TEXTFILE
53
54 // old code relies on the static methods of wxTextFile being always available
55 // and they still are available in wxTextBuffer (even if !wxUSE_TEXTBUFFER), so
56 // make it possible to use them in a backwards compatible way
57 typedef wxTextBuffer wxTextFile;
58
59 #endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE
60
61 #endif // _WX_TEXTFILE_H
62