// Purpose: implementation of wxTextBuffer class
// Created: 14.11.01
// Author: Morten Hanssen, Vadim Zeitlin
+// RCS-ID: $Id$
// Copyright: (c) 1998-2001 wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// headers
// ============================================================================
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "textbuf.h"
-#endif
-
#include "wx/wxprec.h"
#ifdef __BORLANDC__
// - Mac when compiling with CodeWarrior (__WXMAC__)
const wxTextFileType wxTextBuffer::typeDefault =
-#if defined(__WINDOWS__) || defined(__DOS__)
+#if defined(__WINDOWS__) || defined(__DOS__) || defined(__PALMOS__)
wxTextFileType_Dos;
#elif defined(__UNIX__)
wxTextFileType_Unix;
#elif defined(__WXMAC__)
wxTextFileType_Mac;
-#elif defined(__WXPM__)
+#elif defined(__OS2__)
wxTextFileType_Os2;
#else
wxTextFileType_None;
wxFAIL_MSG(wxT("bad buffer type in wxTextBuffer::GetEOL."));
// fall through nevertheless - we must return something...
- case wxTextFileType_None: return wxT("");
+ case wxTextFileType_None: return wxEmptyString;
case wxTextFileType_Unix: return wxT("\n");
case wxTextFileType_Dos: return wxT("\r\n");
case wxTextFileType_Mac: return wxT("\r");
return text;
// nor if it is empty
- if ( text.IsEmpty() )
+ if ( text.empty() )
return text;
wxString eol = GetEOL(type), result;
#if wxUSE_TEXTBUFFER
+wxString wxTextBuffer::ms_eof;
+
// ----------------------------------------------------------------------------
// ctors & dtor
// ----------------------------------------------------------------------------
m_isOpened = false;
}
+wxTextBuffer::~wxTextBuffer()
+{
+ // required here for Darwin
+}
+
// ----------------------------------------------------------------------------
// buffer operations
// ----------------------------------------------------------------------------
bool wxTextBuffer::Create()
{
// buffer name must be either given in ctor or in Create(const wxString&)
- wxASSERT( !m_strBufferName.IsEmpty() );
+ wxASSERT( !m_strBufferName.empty() );
// if the buffer already exists do nothing
if ( Exists() ) return false;
bool wxTextBuffer::Open(wxMBConv& conv)
{
// buffer name must be either given in ctor or in Open(const wxString&)
- wxASSERT( !m_strBufferName.IsEmpty() );
+ wxASSERT( !m_strBufferName.empty() );
// open buffer in read-only mode
if ( !OnOpen(m_strBufferName, ReadAccess) )
? wxTextFileType_##t1 \
: wxTextFileType_##t2
- // Watcom C++ doesn't seem to be able to handle the macro
- // VS: Watcom 11 doesn't have a problem...
-#if !(defined(__WATCOMC__) && (__WATCOMC__ < 1100))
+#if !defined(__WATCOMC__) || wxCHECK_WATCOM_VERSION(1,4)
if ( nDos > nUnix )
return GREATER_OF(Dos, Mac);
else if ( nDos < nUnix )
bool wxTextBuffer::Close()
{
- m_aTypes.Clear();
- m_aLines.Clear();
- m_nCurLine = 0;
+ Clear();
m_isOpened = false;
return true;
}
#endif // wxUSE_TEXTBUFFER
-