1998-05-20 10:01:55 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2001-11-14 15:40:20 -05:00
|
|
|
// Name: wx/textfile.h
|
1998-05-20 10:01:55 -04: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 13:44:38 -05:00
|
|
|
// Modified by:
|
1998-05-20 10:01:55 -04:00
|
|
|
// Created: 03.04.98
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1998 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
|
2003-03-17 05:34:04 -05:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:01:55 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1999-07-14 18:55:57 -04:00
|
|
|
#ifndef _WX_TEXTFILE_H
|
|
|
|
#define _WX_TEXTFILE_H
|
1998-05-20 10:01:55 -04:00
|
|
|
|
2003-08-09 08:38:21 -04:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-07-14 18:55:57 -04:00
|
|
|
#pragma interface "textfile.h"
|
1998-05-20 10:01:55 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/defs.h"
|
1999-06-15 16:21:59 -04:00
|
|
|
|
2001-11-24 19:20:56 -05:00
|
|
|
#include "wx/textbuf.h"
|
|
|
|
|
2000-12-05 17:38:43 -05:00
|
|
|
#if wxUSE_TEXTFILE
|
|
|
|
|
|
|
|
#include "wx/file.h"
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// wxTextFile
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
2003-07-01 21:59:24 -04:00
|
|
|
class WXDLLIMPEXP_BASE wxTextFile : public wxTextBuffer
|
1998-05-20 10:01:55 -04:00
|
|
|
{
|
|
|
|
public:
|
2001-11-14 15:40:20 -05: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();
|
|
|
|
virtual bool OnRead(wxMBConv& conv);
|
2002-12-04 09:11:26 -05:00
|
|
|
virtual bool OnWrite(wxTextFileType typeNew, wxMBConv& conv);
|
1998-05-20 10:01:55 -04:00
|
|
|
|
|
|
|
private:
|
2003-07-21 20:24:07 -04:00
|
|
|
|
2001-11-14 15:40:20 -05:00
|
|
|
wxFile m_file;
|
2003-07-21 20:24:07 -04:00
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxTextFile)
|
1998-05-20 10:01:55 -04:00
|
|
|
};
|
|
|
|
|
1999-07-14 18:55:57 -04:00
|
|
|
#else // !wxUSE_TEXTFILE
|
1999-06-15 16:21:59 -04:00
|
|
|
|
2001-11-14 15:40:20 -05: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 18:55:57 -04:00
|
|
|
|
2001-11-14 15:40:20 -05:00
|
|
|
#endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE
|
1999-07-14 18:55:57 -04:00
|
|
|
|
|
|
|
#endif // _WX_TEXTFILE_H
|
1999-06-30 00:28:29 -04:00
|
|
|
|