added wxTextBuffer and wxMemoryText which allow to use wxTextFile with in-memory data
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@12424 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
00ca6262d1
commit
a3a584a7a6
13
configure.in
13
configure.in
@ -679,6 +679,7 @@ if test $DEBUG_CONFIGURE = 1; then
|
||||
DEFAULT_wxUSE_STOPWATCH=no
|
||||
DEFAULT_wxUSE_FILE=no
|
||||
DEFAULT_wxUSE_FFILE=no
|
||||
DEFAULT_wxUSE_TEXTBUFFER=no
|
||||
DEFAULT_wxUSE_TEXTFILE=no
|
||||
DEFAULT_wxUSE_WAVE=no
|
||||
DEFAULT_wxUSE_INTL=no
|
||||
@ -840,6 +841,7 @@ else
|
||||
DEFAULT_wxUSE_STOPWATCH=yes
|
||||
DEFAULT_wxUSE_FILE=yes
|
||||
DEFAULT_wxUSE_FFILE=yes
|
||||
DEFAULT_wxUSE_TEXTBUFFER=yes
|
||||
DEFAULT_wxUSE_TEXTFILE=yes
|
||||
DEFAULT_wxUSE_WAVE=no
|
||||
DEFAULT_wxUSE_INTL=yes
|
||||
@ -1073,7 +1075,8 @@ WX_ARG_ENABLE(log, [ --enable-log use logging system], wxU
|
||||
WX_ARG_ENABLE(streams, [ --enable-streams use wxStream etc classes], wxUSE_STREAMS)
|
||||
WX_ARG_ENABLE(file, [ --enable-file use wxFile classes], wxUSE_FILE)
|
||||
WX_ARG_ENABLE(ffile, [ --enable-ffile use wxFFile classes], wxUSE_FFILE)
|
||||
WX_ARG_ENABLE(textfile, [ --enable-textfile use wxTextFile classes], wxUSE_TEXTFILE)
|
||||
WX_ARG_ENABLE(textbuf, [ --enable-textbuf use wxTextBuffer class], wxUSE_TEXTBUFFER)
|
||||
WX_ARG_ENABLE(textfile, [ --enable-textfile use wxTextFile class], wxUSE_TEXTFILE)
|
||||
WX_ARG_ENABLE(fontmap, [ --enable-fontmap use font encodings conversion classes], wxUSE_FONTMAP)
|
||||
WX_ARG_ENABLE(unicode, [ --enable-unicode compile wxString with Unicode support], wxUSE_UNICODE)
|
||||
WX_ARG_ENABLE(wxprintfv, [ --enable-wxprintfv use wxWindows implementation of vprintf()], wxUSE_EXPERIMENTAL_PRINTF)
|
||||
@ -3613,9 +3616,13 @@ if test "$wxUSE_STD_IOSTREAM" = "yes"; then
|
||||
AC_DEFINE(wxUSE_STD_IOSTREAM)
|
||||
fi
|
||||
|
||||
if test "$wxUSE_TEXTBUFFER" = "yes"; then
|
||||
AC_DEFINE(wxUSE_TEXTBUFFER)
|
||||
fi
|
||||
|
||||
if test "$wxUSE_TEXTFILE" = "yes"; then
|
||||
if test "$wxUSE_FILE" != "yes"; then
|
||||
AC_MSG_WARN(wxTextFile requires wxFile and it won't be compiled without it)
|
||||
if test "$wxUSE_FILE" != "yes" -o "$wxUSE_TEXTBUFFER" != "yes" ; then
|
||||
AC_MSG_WARN(wxTextFile requires wxFile and wxTextBuffer and won't be compiled without them)
|
||||
else
|
||||
AC_DEFINE(wxUSE_TEXTFILE)
|
||||
fi
|
||||
|
@ -215,6 +215,7 @@ stream.cpp Common Base
|
||||
string.cpp Common Base
|
||||
sysopt.cpp Common Base
|
||||
tbarbase.cpp Common
|
||||
textbuf.cpp Common Base
|
||||
textcmn.cpp Common
|
||||
textfile.cpp Common Base
|
||||
timercmn.cpp Common Base
|
||||
@ -817,6 +818,7 @@ matrix.h WXH
|
||||
mdi.h WXH
|
||||
memory.h WXH Base
|
||||
memconf.h WXH Base
|
||||
memtext.h WXH Base
|
||||
menu.h WXH
|
||||
menuitem.h WXH
|
||||
metafile.h WXH
|
||||
@ -881,6 +883,7 @@ tabctrl.h WXH
|
||||
taskbar.h WXH
|
||||
tbarbase.h WXH
|
||||
tbarsmpl.h WXH
|
||||
textbuf.h WXH Base
|
||||
textctrl.h WXH
|
||||
textdlg.h WXH
|
||||
textfile.h WXH Base
|
||||
|
@ -45,6 +45,7 @@ wxBase:
|
||||
|
||||
- wxRegEx class added
|
||||
- wxGetDiskSpace() function added (Jonothan Farr, Markus Fieber)
|
||||
- wxTextBuffer and wxTextFile(wxStream) added (Morten Hanssen)
|
||||
- more fixes to wxMBConv classes. Conversion to and from wchar_t now works with
|
||||
glibc 2.2 as well as with glibc 2.1. Unix version now checks for iconv()'s
|
||||
capabilities at runtime instead of in the configure script.
|
||||
|
@ -469,6 +469,14 @@
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_TAB_DIALOG) */
|
||||
|
||||
#ifndef wxUSE_TEXTBUFFER
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_TEXTBUFFER must be defined."
|
||||
# else
|
||||
# define wxUSE_TEXTBUFFER 0
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_TEXTBUFFER) */
|
||||
|
||||
#ifndef wxUSE_TEXTCTRL
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_TEXTCTRL must be defined."
|
||||
@ -477,6 +485,14 @@
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_TEXTCTRL) */
|
||||
|
||||
#ifndef wxUSE_TEXTFILE
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_TEXTFILE must be defined."
|
||||
# else
|
||||
# define wxUSE_TEXTFILE 0
|
||||
# endif
|
||||
#endif /* !defined(wxUSE_TEXTFILE) */
|
||||
|
||||
#ifndef wxUSE_TOOLBAR
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_TOOLBAR must be defined."
|
||||
@ -826,6 +842,15 @@
|
||||
# endif
|
||||
#endif /* wxUSE_MIMETYPE */
|
||||
|
||||
#if wxUSE_TEXTFILE && !wxUSE_TEXTBUFFER
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_TEXTFILE requires wxUSE_TEXTBUFFER"
|
||||
# else
|
||||
# undef wxUSE_TEXTBUFFER
|
||||
# define wxUSE_TEXTBUFFER 1
|
||||
# endif
|
||||
#endif /* wxUSE_TEXTFILE */
|
||||
|
||||
#if wxUSE_TEXTFILE && !wxUSE_FILE
|
||||
# ifdef wxABORT_ON_CONFIG_ERROR
|
||||
# error "wxUSE_TEXTFILE requires wxUSE_FILE"
|
||||
|
@ -121,6 +121,11 @@ public:
|
||||
const wxString& globalFilename = wxT(""),
|
||||
long style = wxCONFIG_USE_LOCAL_FILE);
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
// ctor that takes an input stream.
|
||||
wxFileConfig(wxInputStream &inStream);
|
||||
#endif // wxUSE_STREAMS
|
||||
|
||||
// dtor will save unsaved data
|
||||
virtual ~wxFileConfig();
|
||||
|
||||
@ -210,7 +215,7 @@ private:
|
||||
void CleanUp();
|
||||
|
||||
// parse the whole file
|
||||
void Parse(wxTextFile& file, bool bLocal);
|
||||
void Parse(wxTextBuffer& buffer, bool bLocal);
|
||||
|
||||
// the same as SetPath("/")
|
||||
void SetRootPath();
|
||||
|
@ -243,6 +243,9 @@
|
||||
#define wxUSE_FILE 1
|
||||
#define wxUSE_FFILE 1
|
||||
|
||||
// use wxTextBuffer class: required by wxTextFile
|
||||
#define wxUSE_TEXTBUFFER 1
|
||||
|
||||
// use wxTextFile class: requires wxFile, required by wxFileConfig
|
||||
#define wxUSE_TEXTFILE 1
|
||||
|
||||
|
51
include/wx/memtext.h
Normal file
51
include/wx/memtext.h
Normal file
@ -0,0 +1,51 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/memtext.h
|
||||
// Purpose: wxMemoryText allows to use wxTextBuffer without a file
|
||||
// Created: 14.11.01
|
||||
// Author: Morten Hanssen
|
||||
// Copyright: (c) 2001 wxWindows team
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MEMTEXT_H
|
||||
#define _WX_MEMTEXT_H
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
// there is no separate setting for wxMemoryText, it's smallish anyhow
|
||||
#if wxUSE_TEXTBUFFER
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxMemoryText
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxMemoryText : public wxTextBuffer
|
||||
{
|
||||
public:
|
||||
// Constructors.
|
||||
wxMemoryText() { }
|
||||
wxMemoryText(const wxString& name) : wxTextBuffer(name) { }
|
||||
|
||||
protected:
|
||||
virtual bool OnExists() const
|
||||
{ return false; }
|
||||
|
||||
virtual bool OnOpen(const wxString &strBufferName,
|
||||
wxTextBufferOpenMode OpenMode)
|
||||
{ return true; }
|
||||
|
||||
virtual bool OnClose()
|
||||
{ return true; }
|
||||
|
||||
virtual bool OnRead(wxMBConv& conv)
|
||||
{ return true; }
|
||||
|
||||
virtual bool OnWrite(wxTextFileType typeNew,
|
||||
wxMBConv& conv = wxConvLibc)
|
||||
{ return true; }
|
||||
};
|
||||
|
||||
#endif // wxUSE_TEXTBUFFER
|
||||
|
||||
#endif // _WX_MEMTEXT_H
|
||||
|
@ -258,7 +258,11 @@
|
||||
#define wxUSE_FILE 1
|
||||
#define wxUSE_FFILE 1
|
||||
|
||||
// use wxTextFile class: requires wxFile, required by wxFileConfig
|
||||
// use wxTextBuffer class: required by wxTextFile
|
||||
#define wxUSE_TEXTBUFFER 1
|
||||
|
||||
// use wxTextFile class: requires wxFile and wxTextBuffer, required by
|
||||
// wxFileConfig
|
||||
#define wxUSE_TEXTFILE 1
|
||||
|
||||
// i18n support: _() macro, wxLocale class. Requires wxTextFile.
|
||||
|
@ -287,6 +287,9 @@
|
||||
|
||||
#define wxUSE_FFILE 1
|
||||
|
||||
// use wxTextBuffer class: required by wxTextFile
|
||||
#define wxUSE_TEXTBUFFER 1
|
||||
|
||||
// use wxTextFile class: requires wxFile, required by wxConfig
|
||||
#define wxUSE_TEXTFILE 1
|
||||
|
||||
|
194
include/wx/textbuf.h
Normal file
194
include/wx/textbuf.h
Normal file
@ -0,0 +1,194 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/textbuf.h
|
||||
// Purpose: class wxTextBuffer to work with text buffers of _small_ size
|
||||
// (buffer is fully loaded in memory) and which understands CR/LF
|
||||
// differences between platforms.
|
||||
// Created: 14.11.01
|
||||
// Author: Morten Hanssen, Vadim Zeitlin
|
||||
// Copyright: (c) 1998-2001 wxWindows team
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_TEXTBUFFER_H
|
||||
#define _WX_TEXTBUFFER_H
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "textbuf.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// the line termination type (kept wxTextFileType name for compability)
|
||||
enum wxTextFileType
|
||||
{
|
||||
wxTextFileType_None, // incomplete (the last line of the file only)
|
||||
wxTextFileType_Unix, // line is terminated with 'LF' = 0xA = 10 = '\n'
|
||||
wxTextFileType_Dos, // 'CR' 'LF'
|
||||
wxTextFileType_Mac, // 'CR' = 0xD = 13 = '\r'
|
||||
wxTextFileType_Os2 // 'CR' 'LF'
|
||||
};
|
||||
|
||||
#include "wx/string.h"
|
||||
|
||||
#if wxUSE_TEXTBUFFER
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextBuffer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DEFINE_EXPORTED_ARRAY(wxTextFileType, ArrayFileType);
|
||||
|
||||
#endif // wxUSE_TEXTBUFFER
|
||||
|
||||
class WXDLLEXPORT wxTextBuffer
|
||||
{
|
||||
public:
|
||||
// constants and static functions
|
||||
// default type for current platform (determined at compile time)
|
||||
static const wxTextFileType typeDefault;
|
||||
|
||||
// this function returns a string which is identical to "text" passed in
|
||||
// except that the line terminator characters are changed to correspond the
|
||||
// given type. Called with the default argument, the function translates
|
||||
// the string to the native format (Unix for Unix, DOS for Windows, ...).
|
||||
static wxString Translate(const wxString& text,
|
||||
wxTextFileType type = typeDefault);
|
||||
|
||||
// get the buffer termination string
|
||||
static const wxChar *GetEOL(wxTextFileType type = typeDefault);
|
||||
|
||||
// the static methods of this class are compiled in even when
|
||||
// !wxUSE_TEXTBUFFER because they are used by the library itself, but the
|
||||
// rest can be left out
|
||||
#if wxUSE_TEXTBUFFER
|
||||
|
||||
// buffer operations
|
||||
// -----------------
|
||||
|
||||
// buffer exists?
|
||||
bool Exists() const;
|
||||
|
||||
// create the buffer if it doesn't already exist
|
||||
bool Create();
|
||||
|
||||
// same as Create() but with (another) buffer name
|
||||
bool Create(const wxString& strBufferName);
|
||||
|
||||
// Open() also loads buffer in memory on success
|
||||
bool Open(wxMBConv& conv = wxConvLibc);
|
||||
|
||||
// same as Open() but with (another) buffer name
|
||||
bool Open(const wxString& strBufferName, wxMBConv& conv = wxConvLibc);
|
||||
|
||||
// closes the buffer and frees memory, losing all changes
|
||||
bool Close();
|
||||
|
||||
// is buffer currently opened?
|
||||
bool IsOpened() const { return m_isOpened; }
|
||||
|
||||
// accessors
|
||||
// ---------
|
||||
|
||||
// get the number of lines in the buffer
|
||||
size_t GetLineCount() const { return m_aLines.Count(); }
|
||||
|
||||
// the returned line may be modified (but don't add CR/LF at the end!)
|
||||
wxString& GetLine(size_t n) const { return m_aLines[n]; }
|
||||
wxString& operator[](size_t n) const { return m_aLines[n]; }
|
||||
|
||||
// the current line has meaning only when you're using
|
||||
// GetFirstLine()/GetNextLine() functions, it doesn't get updated when
|
||||
// you're using "direct access" i.e. GetLine()
|
||||
size_t GetCurrentLine() const { return m_nCurLine; }
|
||||
void GoToLine(size_t n) { m_nCurLine = n; }
|
||||
bool Eof() const { return (m_aLines.Count() == 0 || m_nCurLine == m_aLines.Count() - 1); }
|
||||
|
||||
// these methods allow more "iterator-like" traversal of the list of
|
||||
// lines, i.e. you may write something like:
|
||||
// for ( str = GetFirstLine(); !Eof(); str = GetNextLine() ) { ... }
|
||||
|
||||
// NB: const is commented out because not all compilers understand
|
||||
// 'mutable' keyword yet (m_nCurLine should be mutable)
|
||||
wxString& GetFirstLine() /* const */ { return m_aLines[m_nCurLine = 0]; }
|
||||
wxString& GetNextLine() /* const */ { return m_aLines[++m_nCurLine]; }
|
||||
wxString& GetPrevLine() /* const */
|
||||
{ wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; }
|
||||
wxString& GetLastLine() /* const */
|
||||
{ return m_aLines[m_nCurLine = m_aLines.Count() - 1]; }
|
||||
|
||||
// get the type of the line (see also GetEOL)
|
||||
wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; }
|
||||
|
||||
// guess the type of buffer
|
||||
wxTextFileType GuessType() const;
|
||||
|
||||
// get the name of the buffer
|
||||
const wxChar *GetName() const { return m_strBufferName.c_str(); }
|
||||
|
||||
// add/remove lines
|
||||
// ----------------
|
||||
|
||||
// add a line to the end
|
||||
void AddLine(const wxString& str, wxTextFileType type = typeDefault)
|
||||
{ m_aLines.Add(str); m_aTypes.Add(type); }
|
||||
// insert a line before the line number n
|
||||
void InsertLine(const wxString& str,
|
||||
size_t n,
|
||||
wxTextFileType type = typeDefault)
|
||||
{ m_aLines.Insert(str, n); m_aTypes.Insert(type, n); }
|
||||
// delete one line
|
||||
void RemoveLine(size_t n) { m_aLines.RemoveAt(n); m_aTypes.RemoveAt(n); }
|
||||
|
||||
// change the buffer (default argument means "don't change type")
|
||||
// possibly in another format
|
||||
bool Write(wxTextFileType typeNew = wxTextFileType_None,
|
||||
wxMBConv& conv = wxConvLibc);
|
||||
|
||||
// dtor
|
||||
virtual ~wxTextBuffer();
|
||||
|
||||
protected:
|
||||
// ctors
|
||||
// -----
|
||||
|
||||
// default ctor, use Open(string)
|
||||
wxTextBuffer() { }
|
||||
|
||||
// ctor from filename
|
||||
wxTextBuffer(const wxString& strBufferName);
|
||||
|
||||
enum wxTextBufferOpenMode { ReadAccess, WriteAccess };
|
||||
|
||||
// Must implement these in derived classes.
|
||||
virtual bool OnExists() const = 0;
|
||||
virtual bool OnOpen(const wxString &strBufferName,
|
||||
wxTextBufferOpenMode openmode) = 0;
|
||||
virtual bool OnClose() = 0;
|
||||
virtual bool OnRead(wxMBConv& conv) = 0;
|
||||
virtual bool OnWrite(wxTextFileType typeNew,
|
||||
wxMBConv& conv = wxConvLibc) = 0;
|
||||
|
||||
wxString m_strBufferName; // name of the buffer
|
||||
|
||||
private:
|
||||
ArrayFileType m_aTypes; // type of each line
|
||||
wxArrayString m_aLines; // lines of file
|
||||
|
||||
size_t m_nCurLine; // number of current line in the buffer
|
||||
|
||||
bool m_isOpened; // was the buffer successfully opened the last time?
|
||||
#endif // wxUSE_TEXTBUFFER
|
||||
|
||||
// copy ctor/assignment operator not implemented
|
||||
wxTextBuffer(const wxTextBuffer&);
|
||||
wxTextBuffer& operator=(const wxTextBuffer&);
|
||||
};
|
||||
|
||||
#endif // _WX_TEXTBUFFER_H
|
||||
|
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: textfile.h
|
||||
// Name: wx/textfile.h
|
||||
// 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.
|
||||
@ -20,181 +20,43 @@
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// constants
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// NB: this is always defined, even if !wxUSE_TEXTFILE
|
||||
|
||||
// the line termination type
|
||||
enum wxTextFileType
|
||||
{
|
||||
wxTextFileType_None, // incomplete (the last line of the file only)
|
||||
wxTextFileType_Unix, // line is terminated with 'LF' = 0xA = 10 = '\n'
|
||||
wxTextFileType_Dos, // 'CR' 'LF'
|
||||
wxTextFileType_Mac, // 'CR' = 0xD = 13 = '\r'
|
||||
wxTextFileType_Os2 // 'CR' 'LF'
|
||||
};
|
||||
|
||||
#if wxUSE_TEXTFILE
|
||||
|
||||
#include "wx/string.h"
|
||||
#include "wx/file.h"
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/textbuf.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxTextFile
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
WX_DEFINE_EXPORTED_ARRAY(wxTextFileType, ArrayFileType);
|
||||
|
||||
class WXDLLEXPORT wxTextFile
|
||||
class WXDLLEXPORT wxTextFile : public wxTextBuffer
|
||||
{
|
||||
public:
|
||||
// constants and static functions
|
||||
// default type for current platform (determined at compile time)
|
||||
static const wxTextFileType typeDefault;
|
||||
// constructors
|
||||
wxTextFile() { }
|
||||
wxTextFile(const wxString& strFileName);
|
||||
|
||||
// this function returns a string which is identical to "text" passed in
|
||||
// except that the line terminator characters are changed to correspond the
|
||||
// given type. Called with the default argument, the function translates
|
||||
// the string to the native format (Unix for Unix, DOS for Windows, ...).
|
||||
static wxString Translate(const wxString& text,
|
||||
wxTextFileType type = typeDefault);
|
||||
|
||||
// get the file termination string
|
||||
static const wxChar *GetEOL(wxTextFileType type = typeDefault);
|
||||
|
||||
// ctors
|
||||
// def ctor, use Open(string)
|
||||
wxTextFile() { }
|
||||
//
|
||||
wxTextFile(const wxString& strFile);
|
||||
|
||||
// file operations
|
||||
// file exists?
|
||||
bool Exists() const;
|
||||
// create the file if it doesn't already exist
|
||||
bool Create();
|
||||
// same as Create() but with (another) file name
|
||||
bool Create(const wxString& strFile);
|
||||
// Open() also loads file in memory on success
|
||||
bool Open(wxMBConv& conv = wxConvLibc);
|
||||
// same as Open() but with (another) file name
|
||||
bool Open(const wxString& strFile, wxMBConv& conv = wxConvLibc);
|
||||
// closes the file and frees memory, losing all changes
|
||||
bool Close();
|
||||
// is file currently opened?
|
||||
bool IsOpened() const { return m_isOpened; }
|
||||
|
||||
// accessors
|
||||
// get the number of lines in the file
|
||||
size_t GetLineCount() const { return m_aLines.Count(); }
|
||||
// the returned line may be modified (but don't add CR/LF at the end!)
|
||||
wxString& GetLine(size_t n) const { return m_aLines[n]; }
|
||||
wxString& operator[](size_t n) const { return m_aLines[n]; }
|
||||
|
||||
// the current line has meaning only when you're using
|
||||
// GetFirstLine()/GetNextLine() functions, it doesn't get updated when
|
||||
// you're using "direct access" i.e. GetLine()
|
||||
size_t GetCurrentLine() const { return m_nCurLine; }
|
||||
void GoToLine(size_t n) { m_nCurLine = n; }
|
||||
bool Eof() const { return (m_aLines.Count() == 0 || m_nCurLine == m_aLines.Count() - 1); }
|
||||
|
||||
// these methods allow more "iterator-like" traversal of the list of
|
||||
// lines, i.e. you may write something like:
|
||||
// for ( str = GetFirstLine(); !Eof(); str = GetNextLine() ) { ... }
|
||||
|
||||
// NB: const is commented out because not all compilers understand
|
||||
// 'mutable' keyword yet (m_nCurLine should be mutable)
|
||||
wxString& GetFirstLine() /* const */ { return m_aLines[m_nCurLine = 0]; }
|
||||
wxString& GetNextLine() /* const */ { return m_aLines[++m_nCurLine]; }
|
||||
wxString& GetPrevLine() /* const */
|
||||
{ wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; }
|
||||
wxString& GetLastLine() /* const */
|
||||
{ return m_aLines[m_nCurLine = m_aLines.Count() - 1]; }
|
||||
|
||||
// get the type of the line (see also GetEOL)
|
||||
wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; }
|
||||
// guess the type of file (m_file is supposed to be opened)
|
||||
wxTextFileType GuessType() const;
|
||||
// get the name of the file
|
||||
const wxChar *GetName() const { return m_strFile.c_str(); }
|
||||
|
||||
// add/remove lines
|
||||
// add a line to the end
|
||||
void AddLine(const wxString& str, wxTextFileType type = typeDefault)
|
||||
{ m_aLines.Add(str); m_aTypes.Add(type); }
|
||||
// insert a line before the line number n
|
||||
void InsertLine(const wxString& str,
|
||||
size_t n,
|
||||
wxTextFileType type = typeDefault)
|
||||
{ m_aLines.Insert(str, n); m_aTypes.Insert(type, n); }
|
||||
// delete one line
|
||||
void RemoveLine(size_t n) { m_aLines.RemoveAt(n); m_aTypes.RemoveAt(n); }
|
||||
|
||||
// change the file on disk (default argument means "don't change type")
|
||||
// possibly in another format
|
||||
bool Write(wxTextFileType typeNew = wxTextFileType_None,
|
||||
wxMBConv& conv = wxConvLibc);
|
||||
|
||||
// dtor
|
||||
~wxTextFile();
|
||||
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);
|
||||
virtual bool OnWrite(wxTextFileType typeNew, wxMBConv& conv = wxConvLibc);
|
||||
|
||||
private:
|
||||
// copy ctor/assignment operator not implemented
|
||||
wxTextFile(const wxTextFile&);
|
||||
wxTextFile& operator=(const wxTextFile&);
|
||||
|
||||
// read the file in memory (m_file is supposed to be just opened)
|
||||
bool Read(wxMBConv& conv);
|
||||
|
||||
wxFile m_file; // current file
|
||||
|
||||
ArrayFileType m_aTypes; // type of each line
|
||||
wxArrayString m_aLines; // lines of file
|
||||
|
||||
size_t m_nCurLine; // number of current line in the file
|
||||
|
||||
bool m_isOpened; // was the file successfully opened the last time?
|
||||
|
||||
wxString m_strFile; // name of the file
|
||||
wxFile m_file;
|
||||
};
|
||||
|
||||
#else // !wxUSE_TEXTFILE
|
||||
|
||||
// these static wxTextFile methods are used internally by wxWindows, so should
|
||||
// be defined even if we're compiling without wxTextFile at all.
|
||||
// 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;
|
||||
|
||||
class WXDLLEXPORT wxTextFile
|
||||
{
|
||||
public:
|
||||
// default type for current platform (determined at compile time)
|
||||
static const wxTextFileType typeDefault;
|
||||
|
||||
// this function returns a string which is identical to "text" passed in
|
||||
// except that the line terminator characters are changed to correspond the
|
||||
// given type. Called with the default argument, the function translates
|
||||
// the string to the native format (Unix for Unix, DOS for Windows, ...).
|
||||
static wxString Translate(const wxString& text,
|
||||
wxTextFileType type = typeDefault);
|
||||
|
||||
// get the file termination string
|
||||
static const wxChar *GetEOL(wxTextFileType type = typeDefault);
|
||||
|
||||
private:
|
||||
// copy ctor/assignment operator not implemented
|
||||
wxTextFile(const wxTextFile&);
|
||||
wxTextFile& operator=(const wxTextFile&);
|
||||
|
||||
// suppress the gcc warning: 'class defines only private constructors and
|
||||
// has no friends'
|
||||
#ifdef __GNUG__
|
||||
friend class wxTextFileDummyFriend;
|
||||
#endif // gcc
|
||||
};
|
||||
|
||||
#endif // wxUSE_TEXTFILE
|
||||
#endif // wxUSE_TEXTFILE/!wxUSE_TEXTFILE
|
||||
|
||||
#endif // _WX_TEXTFILE_H
|
||||
|
||||
|
@ -50,9 +50,9 @@
|
||||
//#define TEST_ENVIRON
|
||||
//#define TEST_EXECUTE
|
||||
//#define TEST_FILE
|
||||
//#define TEST_FILECONF
|
||||
#define TEST_FILECONF
|
||||
//#define TEST_FILENAME
|
||||
#define TEST_FILETIME
|
||||
//#define TEST_FILETIME
|
||||
//#define TEST_FTP
|
||||
//#define TEST_HASH
|
||||
//#define TEST_INFO_FUNCTIONS
|
||||
|
@ -488,6 +488,10 @@
|
||||
* Use wxFFile class
|
||||
*/
|
||||
#define wxUSE_FFILE 0
|
||||
/*
|
||||
* Use wxTextBuffer class
|
||||
*/
|
||||
#define wxUSE_TEXTBUFFER 0
|
||||
/*
|
||||
* Use wxTextFile class
|
||||
*/
|
||||
|
@ -36,9 +36,14 @@
|
||||
#include "wx/file.h"
|
||||
#include "wx/log.h"
|
||||
#include "wx/textfile.h"
|
||||
#include "wx/memtext.h"
|
||||
#include "wx/config.h"
|
||||
#include "wx/fileconf.h"
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
#include "wx/stream.h"
|
||||
#endif // wxUSE_STREAMS
|
||||
|
||||
#include "wx/utils.h" // for wxGetHomeDir
|
||||
|
||||
// _WINDOWS_ is defined when windows.h is included,
|
||||
@ -523,6 +528,68 @@ wxFileConfig::wxFileConfig(const wxString& appName, const wxString& vendorName,
|
||||
Init();
|
||||
}
|
||||
|
||||
#if wxUSE_STREAMS
|
||||
|
||||
wxFileConfig::wxFileConfig(wxInputStream &inStream)
|
||||
{
|
||||
// always local_file when this constructor is called (?)
|
||||
SetStyle(GetStyle() | wxCONFIG_USE_LOCAL_FILE);
|
||||
|
||||
m_pCurrentGroup =
|
||||
m_pRootGroup = new wxFileConfigGroup(NULL, "", this);
|
||||
|
||||
m_linesHead =
|
||||
m_linesTail = NULL;
|
||||
|
||||
// translate everything to the current (platform-dependent) line
|
||||
// termination character
|
||||
wxString strTrans;
|
||||
{
|
||||
wxString strTmp;
|
||||
|
||||
char buf[1024];
|
||||
while ( !inStream.Read(buf, WXSIZEOF(buf)).Eof() )
|
||||
strTmp += wxString(buf, inStream.LastRead());
|
||||
|
||||
strTmp += wxString(buf, inStream.LastRead());
|
||||
|
||||
strTrans = wxTextBuffer::Translate(strTmp);
|
||||
}
|
||||
|
||||
wxMemoryText memText;
|
||||
|
||||
// Now we can add the text to the memory text. To do this we extract line
|
||||
// by line from the translated string, until we've reached the end.
|
||||
//
|
||||
// VZ: all this is horribly inefficient, we should do the translation on
|
||||
// the fly in one pass saving both memory and time (TODO)
|
||||
|
||||
const wxChar *pEOL = wxTextBuffer::GetEOL(wxTextBuffer::typeDefault);
|
||||
const size_t EOLLen = wxStrlen(pEOL);
|
||||
|
||||
int posLineStart = strTrans.Find(pEOL);
|
||||
while ( posLineStart != -1 )
|
||||
{
|
||||
wxString line(strTrans.Left(posLineStart));
|
||||
|
||||
memText.AddLine(line);
|
||||
|
||||
strTrans = strTrans.Mid(posLineStart + EOLLen);
|
||||
|
||||
posLineStart = strTrans.Find(pEOL);
|
||||
}
|
||||
|
||||
// also add whatever we have left in the translated string.
|
||||
memText.AddLine(strTrans);
|
||||
|
||||
// Finally we can parse it all.
|
||||
Parse(memText, TRUE /* local */);
|
||||
|
||||
SetRootPath();
|
||||
}
|
||||
|
||||
#endif // wxUSE_STREAMS
|
||||
|
||||
void wxFileConfig::CleanUp()
|
||||
{
|
||||
delete m_pRootGroup;
|
||||
@ -546,15 +613,15 @@ wxFileConfig::~wxFileConfig()
|
||||
// parse a config file
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
void wxFileConfig::Parse(wxTextBuffer& buffer, bool bLocal)
|
||||
{
|
||||
const wxChar *pStart;
|
||||
const wxChar *pEnd;
|
||||
wxString strLine;
|
||||
|
||||
size_t nLineCount = file.GetLineCount();
|
||||
size_t nLineCount = buffer.GetLineCount();
|
||||
for ( size_t n = 0; n < nLineCount; n++ ) {
|
||||
strLine = file[n];
|
||||
strLine = buffer[n];
|
||||
|
||||
// add the line to linked list
|
||||
if ( bLocal )
|
||||
@ -585,7 +652,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
|
||||
if ( *pEnd != wxT(']') ) {
|
||||
wxLogError(_("file '%s': unexpected character %c at line %d."),
|
||||
file.GetName(), *pEnd, n + 1);
|
||||
buffer.GetName(), *pEnd, n + 1);
|
||||
continue; // skip this line
|
||||
}
|
||||
|
||||
@ -617,7 +684,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
|
||||
default:
|
||||
wxLogWarning(_("file '%s', line %d: '%s' ignored after group header."),
|
||||
file.GetName(), n + 1, pEnd);
|
||||
buffer.GetName(), n + 1, pEnd);
|
||||
bCont = FALSE;
|
||||
}
|
||||
}
|
||||
@ -646,7 +713,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
|
||||
if ( *pEnd++ != wxT('=') ) {
|
||||
wxLogError(_("file '%s', line %d: '=' expected."),
|
||||
file.GetName(), n + 1);
|
||||
buffer.GetName(), n + 1);
|
||||
}
|
||||
else {
|
||||
wxFileConfigEntry *pEntry = m_pCurrentGroup->FindEntry(strKey);
|
||||
@ -662,7 +729,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
if ( bLocal && pEntry->IsImmutable() ) {
|
||||
// immutable keys can't be changed by user
|
||||
wxLogWarning(_("file '%s', line %d: value for immutable key '%s' ignored."),
|
||||
file.GetName(), n + 1, strKey.c_str());
|
||||
buffer.GetName(), n + 1, strKey.c_str());
|
||||
continue;
|
||||
}
|
||||
// the condition below catches the cases (a) and (b) but not (c):
|
||||
@ -672,7 +739,7 @@ void wxFileConfig::Parse(wxTextFile& file, bool bLocal)
|
||||
// which is exactly what we want.
|
||||
else if ( !bLocal || pEntry->IsLocal() ) {
|
||||
wxLogWarning(_("file '%s', line %d: key '%s' was first found at line %d."),
|
||||
file.GetName(), n + 1, strKey.c_str(), pEntry->Line());
|
||||
buffer.GetName(), n + 1, strKey.c_str(), pEntry->Line());
|
||||
|
||||
if ( bLocal )
|
||||
pEntry->SetLine(m_linesTail);
|
||||
|
288
src/common/textbuf.cpp
Normal file
288
src/common/textbuf.cpp
Normal file
@ -0,0 +1,288 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/common/textbuf.cpp
|
||||
// Purpose: implementation of wxTextBuffer class
|
||||
// Created: 14.11.01
|
||||
// Author: Morten Hanssen, Vadim Zeitlin
|
||||
// Copyright: (c) 1998-2001 wxWindows team
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// headers
|
||||
// ============================================================================
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "textbuf.h"
|
||||
#endif
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif //__BORLANDC__
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/string.h"
|
||||
#include "wx/intl.h"
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
#include "wx/textbuf.h"
|
||||
|
||||
// ============================================================================
|
||||
// wxTextBuffer class implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// static methods (always compiled in)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// default type is the native one
|
||||
// the native type under Mac OS X is:
|
||||
// - Unix when compiling with the Apple Developer Tools (__UNIX__)
|
||||
// - Mac when compiling with CodeWarrior (__WXMAC__)
|
||||
|
||||
const wxTextFileType wxTextBuffer::typeDefault =
|
||||
#if defined(__WINDOWS__)
|
||||
wxTextFileType_Dos;
|
||||
#elif defined(__UNIX__)
|
||||
wxTextFileType_Unix;
|
||||
#elif defined(__WXMAC__)
|
||||
wxTextFileType_Mac;
|
||||
#elif defined(__WXPM__)
|
||||
wxTextFileType_Os2;
|
||||
#else
|
||||
wxTextFileType_None;
|
||||
#error "wxTextBuffer: unsupported platform."
|
||||
#endif
|
||||
|
||||
const wxChar *wxTextBuffer::GetEOL(wxTextFileType type)
|
||||
{
|
||||
switch ( type ) {
|
||||
default:
|
||||
wxFAIL_MSG(wxT("bad buffer type in wxTextBuffer::GetEOL."));
|
||||
// fall through nevertheless - we must return something...
|
||||
|
||||
case wxTextFileType_None: return wxT("");
|
||||
case wxTextFileType_Unix: return wxT("\n");
|
||||
case wxTextFileType_Dos: return wxT("\r\n");
|
||||
case wxTextFileType_Mac: return wxT("\r");
|
||||
}
|
||||
}
|
||||
|
||||
wxString wxTextBuffer::Translate(const wxString& text, wxTextFileType type)
|
||||
{
|
||||
// don't do anything if there is nothing to do
|
||||
if ( type == wxTextFileType_None )
|
||||
return text;
|
||||
|
||||
// nor if it is empty
|
||||
if ( text.IsEmpty() )
|
||||
return text;
|
||||
|
||||
wxString eol = GetEOL(type), result;
|
||||
|
||||
// optimization: we know that the length of the new string will be about
|
||||
// the same as the length of the old one, so prealloc memory to aviod
|
||||
// unnecessary relocations
|
||||
result.Alloc(text.Len());
|
||||
|
||||
wxChar chLast = 0;
|
||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
||||
{
|
||||
wxChar ch = *pc;
|
||||
switch ( ch ) {
|
||||
case _T('\n'):
|
||||
// Dos/Unix line termination
|
||||
result += eol;
|
||||
chLast = 0;
|
||||
break;
|
||||
|
||||
case _T('\r'):
|
||||
if ( chLast == _T('\r') ) {
|
||||
// Mac empty line
|
||||
result += eol;
|
||||
}
|
||||
else {
|
||||
// just remember it: we don't know whether it is just "\r"
|
||||
// or "\r\n" yet
|
||||
chLast = _T('\r');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( chLast == _T('\r') ) {
|
||||
// Mac line termination
|
||||
result += eol;
|
||||
|
||||
// reset chLast to avoid inserting another eol before the
|
||||
// next character
|
||||
chLast = 0;
|
||||
}
|
||||
|
||||
// add to the current line
|
||||
result += ch;
|
||||
}
|
||||
}
|
||||
|
||||
if ( chLast ) {
|
||||
// trailing '\r'
|
||||
result += eol;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if wxUSE_TEXTBUFFER
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ctors & dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxTextBuffer::wxTextBuffer(const wxString& strBufferName)
|
||||
: m_strBufferName(strBufferName)
|
||||
{
|
||||
m_nCurLine = 0;
|
||||
m_isOpened = FALSE;
|
||||
}
|
||||
|
||||
wxTextBuffer::~wxTextBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// buffer operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxTextBuffer::Exists() const
|
||||
{
|
||||
return OnExists();
|
||||
}
|
||||
|
||||
bool wxTextBuffer::Create(const wxString& strBufferName)
|
||||
{
|
||||
m_strBufferName = strBufferName;
|
||||
|
||||
return Create();
|
||||
}
|
||||
|
||||
bool wxTextBuffer::Create()
|
||||
{
|
||||
// buffer name must be either given in ctor or in Create(const wxString&)
|
||||
wxASSERT( !m_strBufferName.IsEmpty() );
|
||||
|
||||
// if the buffer already exists do nothing
|
||||
if ( Exists() ) return FALSE;
|
||||
|
||||
if ( !OnOpen(m_strBufferName, WriteAccess) )
|
||||
return FALSE;
|
||||
|
||||
OnClose();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxTextBuffer::Open(const wxString& strBufferName, wxMBConv& conv)
|
||||
{
|
||||
m_strBufferName = strBufferName;
|
||||
|
||||
return Open(conv);
|
||||
}
|
||||
|
||||
bool wxTextBuffer::Open(wxMBConv& conv)
|
||||
{
|
||||
// buffer name must be either given in ctor or in Open(const wxString&)
|
||||
wxASSERT( !m_strBufferName.IsEmpty() );
|
||||
|
||||
// open buffer in read-only mode
|
||||
if ( !OnOpen(m_strBufferName, ReadAccess) )
|
||||
return FALSE;
|
||||
|
||||
// read buffer into memory
|
||||
m_isOpened = OnRead(conv);
|
||||
|
||||
OnClose();
|
||||
|
||||
return m_isOpened;
|
||||
}
|
||||
|
||||
// analyse some lines of the buffer trying to guess it's type.
|
||||
// if it fails, it assumes the native type for our platform.
|
||||
wxTextFileType wxTextBuffer::GuessType() const
|
||||
{
|
||||
wxASSERT( IsOpened() );
|
||||
|
||||
// scan the buffer lines
|
||||
size_t nUnix = 0, // number of '\n's alone
|
||||
nDos = 0, // number of '\r\n'
|
||||
nMac = 0; // number of '\r's
|
||||
|
||||
// we take MAX_LINES_SCAN in the beginning, middle and the end of buffer
|
||||
#define MAX_LINES_SCAN (10)
|
||||
size_t nCount = m_aLines.Count() / 3,
|
||||
nScan = nCount > 3*MAX_LINES_SCAN ? MAX_LINES_SCAN : nCount / 3;
|
||||
|
||||
#define AnalyseLine(n) \
|
||||
switch ( m_aTypes[n] ) { \
|
||||
case wxTextFileType_Unix: nUnix++; break; \
|
||||
case wxTextFileType_Dos: nDos++; break; \
|
||||
case wxTextFileType_Mac: nMac++; break; \
|
||||
default: wxFAIL_MSG(_("unknown line terminator")); \
|
||||
}
|
||||
|
||||
size_t n;
|
||||
for ( n = 0; n < nScan; n++ ) // the beginning
|
||||
AnalyseLine(n);
|
||||
for ( n = (nCount - nScan)/2; n < (nCount + nScan)/2; n++ )
|
||||
AnalyseLine(n);
|
||||
for ( n = nCount - nScan; n < nCount; n++ )
|
||||
AnalyseLine(n);
|
||||
|
||||
#undef AnalyseLine
|
||||
|
||||
// interpret the results (FIXME far from being even 50% fool proof)
|
||||
if ( nScan > 0 && nDos + nUnix + nMac == 0 ) {
|
||||
// no newlines at all
|
||||
wxLogWarning(_("'%s' is probably a binary buffer."), m_strBufferName.c_str());
|
||||
}
|
||||
else {
|
||||
#define GREATER_OF(t1, t2) n##t1 == n##t2 ? typeDefault \
|
||||
: n##t1 > n##t2 \
|
||||
? wxTextFileType_##t1 \
|
||||
: wxTextFileType_##t2
|
||||
|
||||
// Watcom C++ doesn't seem to be able to handle the macro
|
||||
#if !defined(__WATCOMC__)
|
||||
if ( nDos > nUnix )
|
||||
return GREATER_OF(Dos, Mac);
|
||||
else if ( nDos < nUnix )
|
||||
return GREATER_OF(Unix, Mac);
|
||||
else {
|
||||
// nDos == nUnix
|
||||
return nMac > nDos ? wxTextFileType_Mac : typeDefault;
|
||||
}
|
||||
#endif // __WATCOMC__
|
||||
|
||||
#undef GREATER_OF
|
||||
}
|
||||
|
||||
return typeDefault;
|
||||
}
|
||||
|
||||
|
||||
bool wxTextBuffer::Close()
|
||||
{
|
||||
m_aTypes.Clear();
|
||||
m_aLines.Clear();
|
||||
m_nCurLine = 0;
|
||||
m_isOpened = FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxTextBuffer::Write(wxTextFileType typeNew, wxMBConv& conv)
|
||||
{
|
||||
return OnWrite(typeNew, conv);
|
||||
}
|
||||
|
||||
#endif // wxUSE_TEXTBUFFER
|
||||
|
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: textfile.cpp
|
||||
// Name: src/common/textfile.cpp
|
||||
// Purpose: implementation of wxTextFile class
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
@ -23,11 +23,13 @@
|
||||
#pragma hdrstop
|
||||
#endif //__BORLANDC__
|
||||
|
||||
#if !wxUSE_FILE
|
||||
#if !wxUSE_FILE || !wxUSE_TEXTBUFFER
|
||||
#undef wxUSE_TEXTFILE
|
||||
#define wxUSE_TEXTFILE 0
|
||||
#endif // wxUSE_FILE
|
||||
|
||||
#if wxUSE_TEXTFILE
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/string.h"
|
||||
#include "wx/intl.h"
|
||||
@ -35,252 +37,56 @@
|
||||
#include "wx/log.h"
|
||||
#endif
|
||||
|
||||
#include "wx/textfile.h"
|
||||
#include "wx/textfile.h"
|
||||
|
||||
// ============================================================================
|
||||
// wxTextFile class implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// static methods (always compiled in)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// default type is the native one
|
||||
// the native type under Mac OS X is:
|
||||
// - Unix when compiling with the Apple Developer Tools (__UNIX__)
|
||||
// - Mac when compiling with CodeWarrior (__WXMAC__)
|
||||
|
||||
const wxTextFileType wxTextFile::typeDefault =
|
||||
#if defined(__WINDOWS__)
|
||||
wxTextFileType_Dos;
|
||||
#elif defined(__UNIX__)
|
||||
wxTextFileType_Unix;
|
||||
#elif defined(__WXMAC__)
|
||||
wxTextFileType_Mac;
|
||||
#elif defined(__WXPM__)
|
||||
wxTextFileType_Os2;
|
||||
#else
|
||||
wxTextFileType_None;
|
||||
#error "wxTextFile: unsupported platform."
|
||||
#endif
|
||||
|
||||
const wxChar *wxTextFile::GetEOL(wxTextFileType type)
|
||||
wxTextFile::wxTextFile(const wxString& strFileName)
|
||||
: wxTextBuffer(strFileName)
|
||||
{
|
||||
switch ( type ) {
|
||||
default:
|
||||
wxFAIL_MSG(wxT("bad file type in wxTextFile::GetEOL."));
|
||||
// fall through nevertheless - we must return something...
|
||||
|
||||
case wxTextFileType_None: return wxT("");
|
||||
case wxTextFileType_Unix: return wxT("\n");
|
||||
case wxTextFileType_Dos: return wxT("\r\n");
|
||||
case wxTextFileType_Mac: return wxT("\r");
|
||||
}
|
||||
}
|
||||
|
||||
wxString wxTextFile::Translate(const wxString& text, wxTextFileType type)
|
||||
{
|
||||
// don't do anything if there is nothing to do
|
||||
if ( type == wxTextFileType_None )
|
||||
return text;
|
||||
|
||||
// GRG: don't do anything either if it is empty
|
||||
if ( text.IsEmpty() )
|
||||
return text;
|
||||
|
||||
wxString eol = GetEOL(type), result;
|
||||
|
||||
// optimization: we know that the length of the new string will be about
|
||||
// the same as the length of the old one, so prealloc memory to aviod
|
||||
// unnecessary relocations
|
||||
result.Alloc(text.Len());
|
||||
|
||||
wxChar chLast = 0;
|
||||
for ( const wxChar *pc = text.c_str(); *pc; pc++ )
|
||||
{
|
||||
wxChar ch = *pc;
|
||||
switch ( ch ) {
|
||||
case _T('\n'):
|
||||
// Dos/Unix line termination
|
||||
result += eol;
|
||||
chLast = 0;
|
||||
break;
|
||||
|
||||
case _T('\r'):
|
||||
if ( chLast == _T('\r') ) {
|
||||
// Mac empty line
|
||||
result += eol;
|
||||
}
|
||||
else {
|
||||
// just remember it: we don't know whether it is just "\r"
|
||||
// or "\r\n" yet
|
||||
chLast = _T('\r');
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if ( chLast == _T('\r') ) {
|
||||
// Mac line termination
|
||||
result += eol;
|
||||
|
||||
// reset chLast to avoid inserting another eol before the
|
||||
// next character
|
||||
chLast = 0;
|
||||
}
|
||||
|
||||
// add to the current line
|
||||
result += ch;
|
||||
}
|
||||
}
|
||||
|
||||
if ( chLast ) {
|
||||
// trailing '\r'
|
||||
result += eol;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#if wxUSE_TEXTFILE
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// ctors & dtor
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxTextFile::wxTextFile(const wxString& strFile) : m_strFile(strFile)
|
||||
{
|
||||
m_nCurLine = 0;
|
||||
m_isOpened = FALSE;
|
||||
}
|
||||
|
||||
wxTextFile::~wxTextFile()
|
||||
{
|
||||
// m_file dtor called automatically
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// file operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxTextFile::Exists() const
|
||||
bool wxTextFile::OnExists() const
|
||||
{
|
||||
return wxFile::Exists(m_strFile);
|
||||
return wxFile::Exists(m_strBufferName);
|
||||
}
|
||||
|
||||
bool wxTextFile::Create(const wxString& strFile)
|
||||
|
||||
bool wxTextFile::OnOpen(const wxString &strBufferName, wxTextBufferOpenMode OpenMode)
|
||||
{
|
||||
m_strFile = strFile;
|
||||
|
||||
return Create();
|
||||
}
|
||||
|
||||
bool wxTextFile::Create()
|
||||
{
|
||||
// file name must be either given in ctor or in Create(const wxString&)
|
||||
wxASSERT( !m_strFile.IsEmpty() );
|
||||
|
||||
// if the file already exists do nothing
|
||||
if ( Exists() ) return FALSE;
|
||||
wxFile::OpenMode FileOpenMode = wxFile::read;
|
||||
|
||||
if ( m_file.Open(m_strFile, wxFile::write) )
|
||||
switch (OpenMode)
|
||||
{
|
||||
m_file.Close();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
case ReadAccess :
|
||||
FileOpenMode = wxFile::read;
|
||||
break;
|
||||
case WriteAccess :
|
||||
FileOpenMode = wxFile::write;
|
||||
break;
|
||||
default :
|
||||
wxASSERT(0); // Should not happen.
|
||||
break;
|
||||
}
|
||||
|
||||
return m_file.Open(strBufferName.c_str(), FileOpenMode);
|
||||
}
|
||||
|
||||
bool wxTextFile::Open(const wxString& strFile, wxMBConv& conv)
|
||||
|
||||
bool wxTextFile::OnClose()
|
||||
{
|
||||
m_strFile = strFile;
|
||||
|
||||
return Open(conv);
|
||||
return m_file.Close();
|
||||
}
|
||||
|
||||
bool wxTextFile::Open(wxMBConv& conv)
|
||||
{
|
||||
// file name must be either given in ctor or in Open(const wxString&)
|
||||
wxASSERT( !m_strFile.IsEmpty() );
|
||||
|
||||
// open file in read-only mode
|
||||
if ( !m_file.Open(m_strFile) )
|
||||
return FALSE;
|
||||
|
||||
// read file into memory
|
||||
m_isOpened = Read(conv);
|
||||
|
||||
m_file.Close();
|
||||
|
||||
return m_isOpened;
|
||||
}
|
||||
|
||||
// analyse some lines of the file trying to guess it's type.
|
||||
// if it fails, it assumes the native type for our platform.
|
||||
wxTextFileType wxTextFile::GuessType() const
|
||||
{
|
||||
wxASSERT( IsOpened() );
|
||||
|
||||
// scan the file lines
|
||||
size_t nUnix = 0, // number of '\n's alone
|
||||
nDos = 0, // number of '\r\n'
|
||||
nMac = 0; // number of '\r's
|
||||
|
||||
// we take MAX_LINES_SCAN in the beginning, middle and the end of file
|
||||
#define MAX_LINES_SCAN (10)
|
||||
size_t nCount = m_aLines.Count() / 3,
|
||||
nScan = nCount > 3*MAX_LINES_SCAN ? MAX_LINES_SCAN : nCount / 3;
|
||||
|
||||
#define AnalyseLine(n) \
|
||||
switch ( m_aTypes[n] ) { \
|
||||
case wxTextFileType_Unix: nUnix++; break; \
|
||||
case wxTextFileType_Dos: nDos++; break; \
|
||||
case wxTextFileType_Mac: nMac++; break; \
|
||||
default: wxFAIL_MSG(_("unknown line terminator")); \
|
||||
}
|
||||
|
||||
size_t n;
|
||||
for ( n = 0; n < nScan; n++ ) // the beginning
|
||||
AnalyseLine(n);
|
||||
for ( n = (nCount - nScan)/2; n < (nCount + nScan)/2; n++ )
|
||||
AnalyseLine(n);
|
||||
for ( n = nCount - nScan; n < nCount; n++ )
|
||||
AnalyseLine(n);
|
||||
|
||||
#undef AnalyseLine
|
||||
|
||||
// interpret the results (FIXME far from being even 50% fool proof)
|
||||
if ( nScan > 0 && nDos + nUnix + nMac == 0 ) {
|
||||
// no newlines at all
|
||||
wxLogWarning(_("'%s' is probably a binary file."), m_strFile.c_str());
|
||||
}
|
||||
else {
|
||||
#define GREATER_OF(t1, t2) n##t1 == n##t2 ? typeDefault \
|
||||
: n##t1 > n##t2 \
|
||||
? wxTextFileType_##t1 \
|
||||
: wxTextFileType_##t2
|
||||
|
||||
// Watcom C++ doesn't seem to be able to handle the macro
|
||||
#if !defined(__WATCOMC__)
|
||||
if ( nDos > nUnix )
|
||||
return GREATER_OF(Dos, Mac);
|
||||
else if ( nDos < nUnix )
|
||||
return GREATER_OF(Unix, Mac);
|
||||
else {
|
||||
// nDos == nUnix
|
||||
return nMac > nDos ? wxTextFileType_Mac : typeDefault;
|
||||
}
|
||||
#endif // __WATCOMC__
|
||||
|
||||
#undef GREATER_OF
|
||||
}
|
||||
|
||||
return typeDefault;
|
||||
}
|
||||
|
||||
bool wxTextFile::Read(wxMBConv& conv)
|
||||
bool wxTextFile::OnRead(wxMBConv& conv)
|
||||
{
|
||||
// file should be opened and we must be in it's beginning
|
||||
wxASSERT( m_file.IsOpened() && m_file.Tell() == 0 );
|
||||
@ -309,8 +115,7 @@ bool wxTextFile::Read(wxMBConv& conv)
|
||||
switch ( ch ) {
|
||||
case '\n':
|
||||
// Dos/Unix line termination
|
||||
m_aLines.Add(str);
|
||||
m_aTypes.Add(chLast == '\r' ? wxTextFileType_Dos
|
||||
AddLine(str, chLast == '\r' ? wxTextFileType_Dos
|
||||
: wxTextFileType_Unix);
|
||||
str.Empty();
|
||||
chLast = '\n';
|
||||
@ -319,8 +124,7 @@ bool wxTextFile::Read(wxMBConv& conv)
|
||||
case '\r':
|
||||
if ( chLast == '\r' ) {
|
||||
// Mac empty line
|
||||
m_aLines.Add(wxEmptyString);
|
||||
m_aTypes.Add(wxTextFileType_Mac);
|
||||
AddLine(wxEmptyString, wxTextFileType_Mac);
|
||||
}
|
||||
else
|
||||
chLast = '\r';
|
||||
@ -329,8 +133,7 @@ bool wxTextFile::Read(wxMBConv& conv)
|
||||
default:
|
||||
if ( chLast == '\r' ) {
|
||||
// Mac line termination
|
||||
m_aLines.Add(str);
|
||||
m_aTypes.Add(wxTextFileType_Mac);
|
||||
AddLine(str, wxTextFileType_Mac);
|
||||
chLast = ch;
|
||||
#if wxUSE_UNICODE
|
||||
if (conv.MB2WC(conv_wcBuf, conv_mbBuf, 2) == (size_t)-1)
|
||||
@ -356,41 +159,32 @@ bool wxTextFile::Read(wxMBConv& conv)
|
||||
|
||||
// anything in the last line?
|
||||
if ( !str.IsEmpty() ) {
|
||||
m_aTypes.Add(wxTextFileType_None); // no line terminator
|
||||
m_aLines.Add(str);
|
||||
AddLine(str, wxTextFileType_None); // no line terminator
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxTextFile::Close()
|
||||
|
||||
bool wxTextFile::OnWrite(wxTextFileType typeNew, wxMBConv& conv)
|
||||
{
|
||||
m_aTypes.Clear();
|
||||
m_aLines.Clear();
|
||||
m_nCurLine = 0;
|
||||
m_isOpened = FALSE;
|
||||
wxTempFile fileTmp(m_strBufferName);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
if ( !fileTmp.IsOpened() ) {
|
||||
wxLogError(_("can't write buffer '%s' to disk."), m_strBufferName.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxTextFile::Write(wxTextFileType typeNew, wxMBConv& conv)
|
||||
{
|
||||
wxTempFile fileTmp(m_strFile);
|
||||
size_t nCount = GetLineCount();
|
||||
for ( size_t n = 0; n < nCount; n++ ) {
|
||||
fileTmp.Write(GetLine(n) +
|
||||
GetEOL(typeNew == wxTextFileType_None ? GetLineType(n)
|
||||
: typeNew),
|
||||
conv);
|
||||
}
|
||||
|
||||
if ( !fileTmp.IsOpened() ) {
|
||||
wxLogError(_("can't write file '%s' to disk."), m_strFile.c_str());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
size_t nCount = m_aLines.Count();
|
||||
for ( size_t n = 0; n < nCount; n++ ) {
|
||||
fileTmp.Write(m_aLines[n] +
|
||||
GetEOL(typeNew == wxTextFileType_None ? m_aTypes[n]
|
||||
: typeNew), conv);
|
||||
}
|
||||
|
||||
// replace the old file with this one
|
||||
return fileTmp.Commit();
|
||||
// replace the old file with this one
|
||||
return fileTmp.Commit();
|
||||
}
|
||||
|
||||
#endif // wxUSE_TEXTFILE
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 17:52, 2001/10/30
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BASE.T!
|
||||
ALL_SOURCES = \
|
||||
common/init.cpp \
|
||||
@ -52,6 +52,7 @@ ALL_SOURCES = \
|
||||
common/stream.cpp \
|
||||
common/string.cpp \
|
||||
common/sysopt.cpp \
|
||||
common/textbuf.cpp \
|
||||
common/textfile.cpp \
|
||||
common/timercmn.cpp \
|
||||
common/tokenzr.cpp \
|
||||
@ -127,6 +128,7 @@ ALL_HEADERS = \
|
||||
longlong.h \
|
||||
memconf.h \
|
||||
memory.h \
|
||||
memtext.h \
|
||||
mimetype.h \
|
||||
module.h \
|
||||
mstream.h \
|
||||
@ -145,6 +147,7 @@ ALL_HEADERS = \
|
||||
stream.h \
|
||||
string.h \
|
||||
sysopt.h \
|
||||
textbuf.h \
|
||||
textfile.h \
|
||||
thread.h \
|
||||
time.h \
|
||||
@ -223,6 +226,7 @@ BASE_OBJS = \
|
||||
stream.o \
|
||||
string.o \
|
||||
sysopt.o \
|
||||
textbuf.o \
|
||||
textfile.o \
|
||||
timercmn.o \
|
||||
tokenzr.o \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 17:19, 2001/11/06
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
|
||||
ALL_SOURCES = \
|
||||
generic/accel.cpp \
|
||||
@ -148,6 +148,7 @@ ALL_SOURCES = \
|
||||
common/string.cpp \
|
||||
common/sysopt.cpp \
|
||||
common/tbarbase.cpp \
|
||||
common/textbuf.cpp \
|
||||
common/textcmn.cpp \
|
||||
common/textfile.cpp \
|
||||
common/timercmn.cpp \
|
||||
@ -384,6 +385,7 @@ ALL_HEADERS = \
|
||||
mdi.h \
|
||||
memconf.h \
|
||||
memory.h \
|
||||
memtext.h \
|
||||
menu.h \
|
||||
menuitem.h \
|
||||
metafile.h \
|
||||
@ -448,6 +450,7 @@ ALL_HEADERS = \
|
||||
taskbar.h \
|
||||
tbarbase.h \
|
||||
tbarsmpl.h \
|
||||
textbuf.h \
|
||||
textctrl.h \
|
||||
textdlg.h \
|
||||
textfile.h \
|
||||
@ -713,6 +716,7 @@ COMMONOBJS = \
|
||||
string.o \
|
||||
sysopt.o \
|
||||
tbarbase.o \
|
||||
textbuf.o \
|
||||
textcmn.o \
|
||||
textfile.o \
|
||||
timercmn.o \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 17:19, 2001/11/06
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
|
||||
ALL_SOURCES = \
|
||||
generic/accel.cpp \
|
||||
@ -148,6 +148,7 @@ ALL_SOURCES = \
|
||||
common/string.cpp \
|
||||
common/sysopt.cpp \
|
||||
common/tbarbase.cpp \
|
||||
common/textbuf.cpp \
|
||||
common/textcmn.cpp \
|
||||
common/textfile.cpp \
|
||||
common/timercmn.cpp \
|
||||
@ -384,6 +385,7 @@ ALL_HEADERS = \
|
||||
mdi.h \
|
||||
memconf.h \
|
||||
memory.h \
|
||||
memtext.h \
|
||||
menu.h \
|
||||
menuitem.h \
|
||||
metafile.h \
|
||||
@ -448,6 +450,7 @@ ALL_HEADERS = \
|
||||
taskbar.h \
|
||||
tbarbase.h \
|
||||
tbarsmpl.h \
|
||||
textbuf.h \
|
||||
textctrl.h \
|
||||
textdlg.h \
|
||||
textfile.h \
|
||||
@ -713,6 +716,7 @@ COMMONOBJS = \
|
||||
string.o \
|
||||
sysopt.o \
|
||||
tbarbase.o \
|
||||
textbuf.o \
|
||||
textcmn.o \
|
||||
textfile.o \
|
||||
timercmn.o \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 17:52, 2001/10/30
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MAC.T!
|
||||
ALL_SOURCES = \
|
||||
generic/busyinfo.cpp \
|
||||
@ -143,6 +143,7 @@ ALL_SOURCES = \
|
||||
common/string.cpp \
|
||||
common/sysopt.cpp \
|
||||
common/tbarbase.cpp \
|
||||
common/textbuf.cpp \
|
||||
common/textcmn.cpp \
|
||||
common/textfile.cpp \
|
||||
common/timercmn.cpp \
|
||||
@ -389,6 +390,7 @@ ALL_HEADERS = \
|
||||
mdi.h \
|
||||
memconf.h \
|
||||
memory.h \
|
||||
memtext.h \
|
||||
menu.h \
|
||||
menuitem.h \
|
||||
metafile.h \
|
||||
@ -453,6 +455,7 @@ ALL_HEADERS = \
|
||||
taskbar.h \
|
||||
tbarbase.h \
|
||||
tbarsmpl.h \
|
||||
textbuf.h \
|
||||
textctrl.h \
|
||||
textdlg.h \
|
||||
textfile.h \
|
||||
@ -737,6 +740,7 @@ COMMONOBJS = \
|
||||
string.o \
|
||||
sysopt.o \
|
||||
tbarbase.o \
|
||||
textbuf.o \
|
||||
textcmn.o \
|
||||
textfile.o \
|
||||
timercmn.o \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 17:52, 2001/10/30
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MAC.T!
|
||||
ALL_SOURCES = \
|
||||
generic/busyinfo.cpp \
|
||||
@ -143,6 +143,7 @@ ALL_SOURCES = \
|
||||
common/string.cpp \
|
||||
common/sysopt.cpp \
|
||||
common/tbarbase.cpp \
|
||||
common/textbuf.cpp \
|
||||
common/textcmn.cpp \
|
||||
common/textfile.cpp \
|
||||
common/timercmn.cpp \
|
||||
@ -389,6 +390,7 @@ ALL_HEADERS = \
|
||||
mdi.h \
|
||||
memconf.h \
|
||||
memory.h \
|
||||
memtext.h \
|
||||
menu.h \
|
||||
menuitem.h \
|
||||
metafile.h \
|
||||
@ -453,6 +455,7 @@ ALL_HEADERS = \
|
||||
taskbar.h \
|
||||
tbarbase.h \
|
||||
tbarsmpl.h \
|
||||
textbuf.h \
|
||||
textctrl.h \
|
||||
textdlg.h \
|
||||
textfile.h \
|
||||
@ -737,6 +740,7 @@ COMMONOBJS = \
|
||||
string.o \
|
||||
sysopt.o \
|
||||
tbarbase.o \
|
||||
textbuf.o \
|
||||
textcmn.o \
|
||||
textfile.o \
|
||||
timercmn.o \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 17:52, 2001/10/30
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE GTK.T!
|
||||
ALL_SOURCES = \
|
||||
generic/accel.cpp \
|
||||
@ -147,6 +147,7 @@ ALL_SOURCES = \
|
||||
common/string.cpp \
|
||||
common/sysopt.cpp \
|
||||
common/tbarbase.cpp \
|
||||
common/textbuf.cpp \
|
||||
common/textcmn.cpp \
|
||||
common/textfile.cpp \
|
||||
common/timercmn.cpp \
|
||||
@ -345,6 +346,7 @@ ALL_HEADERS = \
|
||||
mdi.h \
|
||||
memconf.h \
|
||||
memory.h \
|
||||
memtext.h \
|
||||
menu.h \
|
||||
menuitem.h \
|
||||
metafile.h \
|
||||
@ -409,6 +411,7 @@ ALL_HEADERS = \
|
||||
taskbar.h \
|
||||
tbarbase.h \
|
||||
tbarsmpl.h \
|
||||
textbuf.h \
|
||||
textctrl.h \
|
||||
textdlg.h \
|
||||
textfile.h \
|
||||
@ -675,6 +678,7 @@ COMMONOBJS = \
|
||||
string.o \
|
||||
sysopt.o \
|
||||
tbarbase.o \
|
||||
textbuf.o \
|
||||
textcmn.o \
|
||||
textfile.o \
|
||||
timercmn.o \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 17:52, 2001/10/30
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MOTIF.T!
|
||||
ALL_SOURCES = \
|
||||
generic/busyinfo.cpp \
|
||||
@ -147,6 +147,7 @@ ALL_SOURCES = \
|
||||
common/string.cpp \
|
||||
common/sysopt.cpp \
|
||||
common/tbarbase.cpp \
|
||||
common/textbuf.cpp \
|
||||
common/textcmn.cpp \
|
||||
common/textfile.cpp \
|
||||
common/timercmn.cpp \
|
||||
@ -374,6 +375,7 @@ ALL_HEADERS = \
|
||||
mdi.h \
|
||||
memconf.h \
|
||||
memory.h \
|
||||
memtext.h \
|
||||
menu.h \
|
||||
menuitem.h \
|
||||
metafile.h \
|
||||
@ -438,6 +440,7 @@ ALL_HEADERS = \
|
||||
taskbar.h \
|
||||
tbarbase.h \
|
||||
tbarsmpl.h \
|
||||
textbuf.h \
|
||||
textctrl.h \
|
||||
textdlg.h \
|
||||
textfile.h \
|
||||
@ -700,6 +703,7 @@ COMMONOBJS = \
|
||||
string.o \
|
||||
sysopt.o \
|
||||
tbarbase.o \
|
||||
textbuf.o \
|
||||
textcmn.o \
|
||||
textfile.o \
|
||||
timercmn.o \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 10:57, 2001/11/03
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE MSW.T!
|
||||
ALL_SOURCES = \
|
||||
generic/busyinfo.cpp \
|
||||
@ -131,6 +131,7 @@ ALL_SOURCES = \
|
||||
common/string.cpp \
|
||||
common/sysopt.cpp \
|
||||
common/tbarbase.cpp \
|
||||
common/textbuf.cpp \
|
||||
common/textcmn.cpp \
|
||||
common/textfile.cpp \
|
||||
common/timercmn.cpp \
|
||||
@ -402,6 +403,7 @@ ALL_HEADERS = \
|
||||
mdi.h \
|
||||
memconf.h \
|
||||
memory.h \
|
||||
memtext.h \
|
||||
menu.h \
|
||||
menuitem.h \
|
||||
metafile.h \
|
||||
@ -466,6 +468,7 @@ ALL_HEADERS = \
|
||||
taskbar.h \
|
||||
tbarbase.h \
|
||||
tbarsmpl.h \
|
||||
textbuf.h \
|
||||
textctrl.h \
|
||||
textdlg.h \
|
||||
textfile.h \
|
||||
@ -770,6 +773,7 @@ COMMONOBJS = \
|
||||
string.o \
|
||||
sysopt.o \
|
||||
tbarbase.o \
|
||||
textbuf.o \
|
||||
textcmn.o \
|
||||
textfile.o \
|
||||
timercmn.o \
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# This file was automatically generated by tmake at 10:56, 2001/11/03
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE B32.T!
|
||||
|
||||
#
|
||||
@ -216,6 +216,7 @@ COMMONOBJS = \
|
||||
$(MSWDIR)\string.obj \
|
||||
$(MSWDIR)\sysopt.obj \
|
||||
$(MSWDIR)\tbarbase.obj \
|
||||
$(MSWDIR)\textbuf.obj \
|
||||
$(MSWDIR)\textcmn.obj \
|
||||
$(MSWDIR)\textfile.obj \
|
||||
$(MSWDIR)\timercmn.obj \
|
||||
@ -836,6 +837,8 @@ $(MSWDIR)\sysopt.obj: $(COMMDIR)\sysopt.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\tbarbase.obj: $(COMMDIR)\tbarbase.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\textbuf.obj: $(COMMDIR)\textbuf.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\textcmn.obj: $(COMMDIR)\textcmn.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\textfile.obj: $(COMMDIR)\textfile.$(SRCSUFF)
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# This file was automatically generated by tmake at 10:56, 2001/11/03
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE BCC.T!
|
||||
|
||||
#
|
||||
@ -187,6 +187,7 @@ COMMONOBJS = \
|
||||
$(MSWDIR)\string.obj \
|
||||
$(MSWDIR)\sysopt.obj \
|
||||
$(MSWDIR)\tbarbase.obj \
|
||||
$(MSWDIR)\textbuf.obj \
|
||||
$(MSWDIR)\textcmn.obj \
|
||||
$(MSWDIR)\textfile.obj \
|
||||
$(MSWDIR)\timercmn.obj \
|
||||
@ -666,6 +667,8 @@ $(MSWDIR)\sysopt.obj: $(COMMDIR)\sysopt.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\tbarbase.obj: $(COMMDIR)\tbarbase.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\textbuf.obj: $(COMMDIR)\textbuf.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\textcmn.obj: $(COMMDIR)\textcmn.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\textfile.obj: $(COMMDIR)\textfile.$(SRCSUFF)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 10:56, 2001/11/03
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE DOS.T!
|
||||
|
||||
#
|
||||
@ -174,6 +174,7 @@ COMMONOBJS2 = \
|
||||
$(COMMDIR)\string.obj \
|
||||
$(COMMDIR)\sysopt.obj \
|
||||
$(COMMDIR)\tbarbase.obj \
|
||||
$(COMMDIR)\textbuf.obj \
|
||||
$(COMMDIR)\textcmn.obj \
|
||||
$(COMMDIR)\textfile.obj \
|
||||
$(COMMDIR)\timercmn.obj \
|
||||
@ -1194,6 +1195,11 @@ $(COMMDIR)/tbarbase.obj: $*.$(SRCSUFF)
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/textbuf.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
<<
|
||||
|
||||
$(COMMDIR)/textcmn.obj: $*.$(SRCSUFF)
|
||||
cl @<<
|
||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 22:05, 2001/11/08
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE G95.T!
|
||||
|
||||
#
|
||||
@ -202,6 +202,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)/string.$(OBJSUFF) \
|
||||
$(COMMDIR)/sysopt.$(OBJSUFF) \
|
||||
$(COMMDIR)/tbarbase.$(OBJSUFF) \
|
||||
$(COMMDIR)/textbuf.$(OBJSUFF) \
|
||||
$(COMMDIR)/textcmn.$(OBJSUFF) \
|
||||
$(COMMDIR)/textfile.$(OBJSUFF) \
|
||||
$(COMMDIR)/timercmn.$(OBJSUFF) \
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# This file was automatically generated by tmake at 10:56, 2001/11/03
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE SC.T!
|
||||
|
||||
# Symantec C++ makefile for the msw objects
|
||||
@ -159,6 +159,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\string.obj \
|
||||
$(COMMDIR)\sysopt.obj \
|
||||
$(COMMDIR)\tbarbase.obj \
|
||||
$(COMMDIR)\textbuf.obj \
|
||||
$(COMMDIR)\textcmn.obj \
|
||||
$(COMMDIR)\textfile.obj \
|
||||
$(COMMDIR)\timercmn.obj \
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 10:56, 2001/11/03
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE VC.T!
|
||||
|
||||
# File: makefile.vc
|
||||
@ -238,6 +238,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\$D\string.obj \
|
||||
$(COMMDIR)\$D\sysopt.obj \
|
||||
$(COMMDIR)\$D\tbarbase.obj \
|
||||
$(COMMDIR)\$D\textbuf.obj \
|
||||
$(COMMDIR)\$D\textcmn.obj \
|
||||
$(COMMDIR)\$D\textfile.obj \
|
||||
$(COMMDIR)\$D\timercmn.obj \
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/binb/wmake.exe
|
||||
|
||||
# This file was automatically generated by tmake at 10:56, 2001/11/03
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE WAT.T!
|
||||
|
||||
#
|
||||
@ -197,6 +197,7 @@ COMMONOBJS = &
|
||||
string.obj &
|
||||
sysopt.obj &
|
||||
tbarbase.obj &
|
||||
textbuf.obj &
|
||||
textcmn.obj &
|
||||
textfile.obj &
|
||||
timercmn.obj &
|
||||
@ -1014,6 +1015,9 @@ sysopt.obj: $(COMMDIR)\sysopt.cpp
|
||||
tbarbase.obj: $(COMMDIR)\tbarbase.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
textbuf.obj: $(COMMDIR)\textbuf.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
textcmn.obj: $(COMMDIR)\textcmn.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
|
@ -41,6 +41,7 @@
|
||||
/usr/include/wx/longlong.h
|
||||
/usr/include/wx/memconf.h
|
||||
/usr/include/wx/memory.h
|
||||
/usr/include/wx/memtext.h
|
||||
/usr/include/wx/mimetype.h
|
||||
/usr/include/wx/module.h
|
||||
/usr/include/wx/mstream.h
|
||||
@ -59,6 +60,7 @@
|
||||
/usr/include/wx/stream.h
|
||||
/usr/include/wx/string.h
|
||||
/usr/include/wx/sysopt.h
|
||||
/usr/include/wx/textbuf.h
|
||||
/usr/include/wx/textfile.h
|
||||
/usr/include/wx/thread.h
|
||||
/usr/include/wx/time.h
|
||||
|
@ -1,4 +1,4 @@
|
||||
# This file was automatically generated by tmake at 17:52, 2001/10/30
|
||||
# This file was automatically generated by tmake at 21:26, 2001/11/14
|
||||
# DO NOT CHANGE THIS FILE, YOUR CHANGES WILL BE LOST! CHANGE UNIV.T!
|
||||
UNIVOBJS = \
|
||||
bmpbuttn.o \
|
||||
|
@ -445,6 +445,10 @@ SOURCE=.\common\sysopt.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\textbuf.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\textfile.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -809,6 +813,10 @@ SOURCE=..\include\wx\memory.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\memtext.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\mimetype.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -877,6 +885,10 @@ SOURCE=..\include\wx\sysopt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\textbuf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\textfile.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -485,6 +485,10 @@ SOURCE=.\common\tbarbase.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\textbuf.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\textcmn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -1674,6 +1678,10 @@ SOURCE=..\include\wx\memory.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\memtext.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\menu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -1926,6 +1934,10 @@ SOURCE=..\include\wx\tbarsmpl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\textbuf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\textctrl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
@ -648,6 +648,10 @@ SOURCE=.\common\tbarbase.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\textbuf.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\common\textcmn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -762,6 +766,10 @@ SOURCE=.\generic\choicdgg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\generic\dcpsg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\generic\dirctrlg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -1954,6 +1962,10 @@ SOURCE=..\include\wx\memory.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\memtext.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\menu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -2206,6 +2218,10 @@ SOURCE=..\include\wx\tbarsmpl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\textbuf.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\include\wx\textctrl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
Loading…
Reference in New Issue
Block a user