]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/string.h
fixed bug with the caret positioning after SetValue() introduced by the last commit
[wxWidgets.git] / include / wx / string.h
index dc244ec1d842e29cee25674439c7a2d5032127c7..6c035428b1b0ba41624afd801551adfd07e18829 100644 (file)
@@ -1082,6 +1082,25 @@ public:
     { Copy(array); }
 };
 
+// ----------------------------------------------------------------------------
+// wxStringBuffer: a tiny class allowing to get a writable pointer into string
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStringBuffer
+{
+public:
+    wxStringBuffer(wxString& str, size_t lenWanted = 1024)
+        : m_str(str) { m_buf = m_str.GetWriteBuf(lenWanted); }
+
+    ~wxStringBuffer() { m_str.UngetWriteBuf(); }
+
+    operator wxChar*() const { return m_buf; }
+
+private:
+    wxString& m_str;
+    wxChar   *m_buf;
+};
+
 // ---------------------------------------------------------------------------
 // wxString comparison functions: operator versions are always case sensitive
 // ---------------------------------------------------------------------------