+
+ // 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_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]; }
+