// Purpose: implementation of wxTextBuffer class
// Created: 14.11.01
// Author: Morten Hanssen, Vadim Zeitlin
-// Copyright: (c) 1998-2001 wxWindows team
-// Licence: wxWindows license
+// Copyright: (c) 1998-2001 wxWidgets team
+// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// headers
// ============================================================================
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "textbuf.h"
#endif
// - 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;
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;
: m_strBufferName(strBufferName)
{
m_nCurLine = 0;
- m_isOpened = FALSE;
+ m_isOpened = false;
}
wxTextBuffer::~wxTextBuffer()
{
+ // required here for Darwin
}
// ----------------------------------------------------------------------------
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;
-
+ if ( Exists() ) return false;
+
if ( !OnOpen(m_strBufferName, WriteAccess) )
- return FALSE;
+ return false;
OnClose();
- return TRUE;
+ return true;
}
bool wxTextBuffer::Open(const wxString& strBufferName, wxMBConv& conv)
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) )
- return FALSE;
+ return false;
// read buffer into memory
m_isOpened = OnRead(conv);
m_aTypes.Clear();
m_aLines.Clear();
m_nCurLine = 0;
- m_isOpened = FALSE;
+ m_isOpened = false;
- return TRUE;
+ return true;
}
bool wxTextBuffer::Write(wxTextFileType typeNew, wxMBConv& conv)