X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/55d99c7a77789ff4904bf96eddca3715eb5af9b9..0118b60be6ccd5a198f15cf54d307c0c8645f94c:/src/common/textbuf.cpp?ds=sidebyside diff --git a/src/common/textbuf.cpp b/src/common/textbuf.cpp index c9df178872..2564a4cdbf 100644 --- a/src/common/textbuf.cpp +++ b/src/common/textbuf.cpp @@ -3,7 +3,8 @@ // Purpose: implementation of wxTextBuffer class // Created: 14.11.01 // Author: Morten Hanssen, Vadim Zeitlin -// Copyright: (c) 1998-2001 wxWindows team +// RCS-ID: $Id$ +// Copyright: (c) 1998-2001 wxWidgets team // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -11,10 +12,6 @@ // headers // ============================================================================ -#ifdef __GNUG__ - #pragma implementation "textbuf.h" -#endif - #include "wx/wxprec.h" #ifdef __BORLANDC__ @@ -43,13 +40,13 @@ // - 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; @@ -63,7 +60,7 @@ const wxChar *wxTextBuffer::GetEOL(wxTextFileType type) 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"); @@ -77,7 +74,7 @@ wxString wxTextBuffer::Translate(const wxString& text, wxTextFileType type) return text; // nor if it is empty - if ( text.IsEmpty() ) + if ( text.empty() ) return text; wxString eol = GetEOL(type), result; @@ -143,11 +140,12 @@ wxTextBuffer::wxTextBuffer(const wxString& strBufferName) : m_strBufferName(strBufferName) { m_nCurLine = 0; - m_isOpened = FALSE; + m_isOpened = false; } wxTextBuffer::~wxTextBuffer() { + // required here for Darwin } // ---------------------------------------------------------------------------- @@ -169,16 +167,16 @@ bool wxTextBuffer::Create(const wxString& strBufferName) 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) @@ -191,11 +189,11 @@ 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); @@ -250,9 +248,7 @@ wxTextFileType wxTextBuffer::GuessType() const ? 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 ) @@ -275,9 +271,9 @@ bool wxTextBuffer::Close() 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) @@ -286,4 +282,3 @@ bool wxTextBuffer::Write(wxTextFileType typeNew, wxMBConv& conv) } #endif // wxUSE_TEXTBUFFER -