X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4ae776b767f12af7e0c4f8e64a7848cfd44ada44..7bd30a12ade503fd135c686ecc98a6f6d5fecbeb:/include/wx/textbuf.h diff --git a/include/wx/textbuf.h b/include/wx/textbuf.h index 5749dd4134..0db6a65279 100644 --- a/include/wx/textbuf.h +++ b/include/wx/textbuf.h @@ -14,6 +14,7 @@ #include "wx/defs.h" #include "wx/arrstr.h" +#include "wx/convauto.h" // ---------------------------------------------------------------------------- // constants @@ -80,10 +81,10 @@ public: bool Create(const wxString& strBufferName); // Open() also loads buffer in memory on success - bool Open(wxMBConv& conv = wxConvUTF8); + bool Open(const wxMBConv& conv = wxConvAuto()); // same as Open() but with (another) buffer name - bool Open(const wxString& strBufferName, wxMBConv& conv = wxConvUTF8); + bool Open(const wxString& strBufferName, const wxMBConv& conv = wxConvAuto()); // closes the buffer and frees memory, losing all changes bool Close(); @@ -98,8 +99,10 @@ public: size_t GetLineCount() const { return m_aLines.size(); } // the returned line may be modified (but don't add CR/LF at the end!) - wxString& GetLine(size_t n) const { return (wxString&)m_aLines[n]; } - wxString& operator[](size_t n) const { return (wxString&)m_aLines[n]; } + wxString& GetLine(size_t n) { return m_aLines[n]; } + const wxString& GetLine(size_t n) const { return m_aLines[n]; } + wxString& operator[](size_t n) { return m_aLines[n]; } + const wxString& operator[](size_t n) const { return m_aLines[n]; } // the current line has meaning only when you're using // GetFirstLine()/GetNextLine() functions, it doesn't get updated when @@ -131,7 +134,7 @@ public: wxTextFileType GuessType() const; // get the name of the buffer - const wxChar *GetName() const { return m_strBufferName.c_str(); } + const wxString& GetName() const { return m_strBufferName; } // add/remove lines // ---------------- @@ -161,7 +164,7 @@ public: // change the buffer (default argument means "don't change type") // possibly in another format bool Write(wxTextFileType typeNew = wxTextFileType_None, - wxMBConv& conv = wxConvUTF8); + const wxMBConv& conv = wxConvAuto()); // dtor virtual ~wxTextBuffer(); @@ -171,7 +174,7 @@ protected: // ----- // default ctor, use Open(string) - wxTextBuffer() { m_isOpened = false; } + wxTextBuffer() { m_nCurLine = 0; m_isOpened = false; } // ctor from filename wxTextBuffer(const wxString& strBufferName); @@ -183,8 +186,8 @@ protected: virtual bool OnOpen(const wxString &strBufferName, wxTextBufferOpenMode openmode) = 0; virtual bool OnClose() = 0; - virtual bool OnRead(wxMBConv& conv) = 0; - virtual bool OnWrite(wxTextFileType typeNew, wxMBConv& conv) = 0; + virtual bool OnRead(const wxMBConv& conv) = 0; + virtual bool OnWrite(wxTextFileType typeNew, const wxMBConv& conv) = 0; static wxString ms_eof; // dummy string returned at EOF wxString m_strBufferName; // name of the buffer