1998-05-20 14:01:55 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2001-11-14 20:40:20 +00:00
|
|
|
// Name: wx/textfile.h
|
1998-05-20 14:01:55 +00:00
|
|
|
// Purpose: class wxTextFile to work with text files of _small_ size
|
|
|
|
// (file is fully loaded in memory) and which understands CR/LF
|
|
|
|
// differences between platforms.
|
|
|
|
// Author: Vadim Zeitlin
|
1999-03-16 18:44:38 +00:00
|
|
|
// Modified by:
|
1998-05-20 14:01:55 +00:00
|
|
|
// Created: 03.04.98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:01:55 +00:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-07-14 22:55:57 +00:00
|
|
|
#ifndef _WX_TEXTFILE_H
|
|
|
|
#define _WX_TEXTFILE_H
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
#include "wx/defs.h"
|
1999-06-15 20:21:59 +00:00
|
|
|
|
2001-11-25 00:20:56 +00:00
|
|
|
#include "wx/textbuf.h"
|
|
|
|
|
2000-12-05 22:38:43 +00:00
|
|
|
#if wxUSE_TEXTFILE
|
|
|
|
|
|
|
|
#include "wx/file.h"
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxTextFile
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2003-07-02 01:59:24 +00:00
|
|
|
class WXDLLIMPEXP_BASE wxTextFile : public wxTextBuffer
|
1998-05-20 14:01:55 +00:00
|
|
|
{
|
|
|
|
public:
|
2001-11-14 20:40:20 +00:00
|
|
|
// constructors
|
|
|
|
wxTextFile() { }
|
|
|
|
wxTextFile(const wxString& strFileName);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// implement the base class pure virtuals
|
|
|
|
virtual bool OnExists() const;
|
|
|
|
virtual bool OnOpen(const wxString &strBufferName,
|
|
|
|
wxTextBufferOpenMode OpenMode);
|
|
|
|
virtual bool OnClose();
|
2006-04-05 14:37:47 +00:00
|
|
|
virtual bool OnRead(const wxMBConv& conv);
|
|
|
|
virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv);
|
1998-05-20 14:01:55 +00:00
|
|
|
|
|
|
|
private:
|
2003-07-22 00:24:07 +00:00
|
|
|
|
2001-11-14 20:40:20 +00:00
|
|
|
wxFile m_file;
|
2003-07-22 00:24:07 +00:00
|
|
|
|
2009-02-08 11:45:59 +00:00
|
|
|
wxDECLARE_NO_COPY_CLASS(wxTextFile);
|
1998-05-20 14:01:55 +00:00
|
|
|
};
|
|
|
|
|
1999-07-14 22:55:57 +00:00
|
|
|
#else // !wxUSE_TEXTFILE
|
1999-06-15 20:21:59 +00:00
|
|
|
|
2001-11-14 20:40:20 +00:00
|
|
|
// old code relies on the static methods of wxTextFile being always available
|
|
|
|
// and they still are available in wxTextBuffer (even if !wxUSE_TEXTBUFFER), so
|
|
|
|
// make it possible to use them in a backwards compatible way
|
|
|
|
typedef wxTextBuffer wxTextFile;
|
1999-07-14 22:55:57 +00:00
|
|
|
|
2001-11-14 20:40:20 +00:00
|
|
|
#endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE
|
1999-07-14 22:55:57 +00:00
|
|
|
|
|
|
|
#endif // _WX_TEXTFILE_H
|
1999-06-30 04:28:29 +00:00
|
|
|
|