]> git.saurik.com Git - wxWidgets.git/blob - include/wx/textfile.h
Return the old file descriptor/pointer from wx(F)File::Detach().
[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 // Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
10 // Licence: wxWindows licence
11 ///////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_TEXTFILE_H
14 #define _WX_TEXTFILE_H
15
16 #include "wx/defs.h"
17
18 #include "wx/textbuf.h"
19
20 #if wxUSE_TEXTFILE
21
22 #include "wx/file.h"
23
24 // ----------------------------------------------------------------------------
25 // wxTextFile
26 // ----------------------------------------------------------------------------
27
28 class WXDLLIMPEXP_BASE wxTextFile : public wxTextBuffer
29 {
30 public:
31 // constructors
32 wxTextFile() { }
33 wxTextFile(const wxString& strFileName);
34
35 protected:
36 // implement the base class pure virtuals
37 virtual bool OnExists() const;
38 virtual bool OnOpen(const wxString &strBufferName,
39 wxTextBufferOpenMode OpenMode);
40 virtual bool OnClose();
41 virtual bool OnRead(const wxMBConv& conv);
42 virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv);
43
44 private:
45
46 wxFile m_file;
47
48 wxDECLARE_NO_COPY_CLASS(wxTextFile);
49 };
50
51 #else // !wxUSE_TEXTFILE
52
53 // old code relies on the static methods of wxTextFile being always available
54 // and they still are available in wxTextBuffer (even if !wxUSE_TEXTBUFFER), so
55 // make it possible to use them in a backwards compatible way
56 typedef wxTextBuffer wxTextFile;
57
58 #endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE
59
60 #endif // _WX_TEXTFILE_H
61