really fixed iteration over wxTextbuffer using GetFirst/NextLine()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38398 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -114,12 +114,15 @@ public:
|
|||||||
|
|
||||||
// NB: const is commented out because not all compilers understand
|
// NB: const is commented out because not all compilers understand
|
||||||
// 'mutable' keyword yet (m_nCurLine should be mutable)
|
// 'mutable' keyword yet (m_nCurLine should be mutable)
|
||||||
wxString& GetFirstLine() /* const */ { return m_aLines[m_nCurLine = 0]; }
|
wxString& GetFirstLine() /* const */
|
||||||
wxString& GetNextLine() /* const */ { return m_aLines[++m_nCurLine]; }
|
{ return m_aLines.empty() ? ms_eof : m_aLines[m_nCurLine = 0]; }
|
||||||
|
wxString& GetNextLine() /* const */
|
||||||
|
{ return ++m_nCurLine == m_aLines.size() ? ms_eof
|
||||||
|
: m_aLines[m_nCurLine]; }
|
||||||
wxString& GetPrevLine() /* const */
|
wxString& GetPrevLine() /* const */
|
||||||
{ wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; }
|
{ wxASSERT(m_nCurLine > 0); return m_aLines[--m_nCurLine]; }
|
||||||
wxString& GetLastLine() /* const */
|
wxString& GetLastLine() /* const */
|
||||||
{ return m_aLines[m_nCurLine = m_aLines.size() - 1]; }
|
{ m_nCurLine = m_aLines.size() - 1; return m_aLines.Last(); }
|
||||||
|
|
||||||
// get the type of the line (see also GetEOL)
|
// get the type of the line (see also GetEOL)
|
||||||
wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; }
|
wxTextFileType GetLineType(size_t n) const { return m_aTypes[n]; }
|
||||||
@@ -183,7 +186,8 @@ protected:
|
|||||||
virtual bool OnRead(wxMBConv& conv) = 0;
|
virtual bool OnRead(wxMBConv& conv) = 0;
|
||||||
virtual bool OnWrite(wxTextFileType typeNew, wxMBConv& conv) = 0;
|
virtual bool OnWrite(wxTextFileType typeNew, wxMBConv& conv) = 0;
|
||||||
|
|
||||||
wxString m_strBufferName; // name of the buffer
|
static wxString ms_eof; // dummy string returned at EOF
|
||||||
|
wxString m_strBufferName; // name of the buffer
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxArrayLinesType m_aTypes; // type of each line
|
wxArrayLinesType m_aTypes; // type of each line
|
||||||
|
@@ -132,6 +132,8 @@ wxString wxTextBuffer::Translate(const wxString& text, wxTextFileType type)
|
|||||||
|
|
||||||
#if wxUSE_TEXTBUFFER
|
#if wxUSE_TEXTBUFFER
|
||||||
|
|
||||||
|
wxString wxTextBuffer::ms_eof;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// ctors & dtor
|
// ctors & dtor
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user