+#if wxUSE_STL
+
+class WXDLLIMPEXP_BASE wxStringBuffer
+{
+public:
+ wxStringBuffer(wxString& str, size_t lenWanted = 1024)
+ : m_str(str), m_buf(lenWanted), m_len(lenWanted)
+ { }
+
+ ~wxStringBuffer() { m_str.assign(m_buf.data(), wxStrlen(m_buf.data())); }
+
+ operator wxChar*() { return m_buf.data(); }
+
+private:
+ wxString& m_str;
+#if wxUSE_UNICODE
+ wxWCharBuffer m_buf;
+#else
+ wxCharBuffer m_buf;
+#endif
+ size_t m_len;
+
+ DECLARE_NO_COPY_CLASS(wxStringBuffer)
+};
+
+class WXDLLIMPEXP_BASE wxStringBufferLength
+{
+public:
+ wxStringBufferLength(wxString& str, size_t lenWanted = 1024)
+ : m_str(str), m_buf(lenWanted), m_len(0), m_lenSet(false)
+ { }
+
+ ~wxStringBufferLength()
+ {
+ wxASSERT(m_lenSet);
+ m_str.assign(m_buf.data(), m_len);
+ }
+
+ operator wxChar*() { return m_buf.data(); }
+ void SetLength(size_t length) { m_len = length; m_lenSet = true; }
+
+private:
+ wxString& m_str;
+#if wxUSE_UNICODE
+ wxWCharBuffer m_buf;
+#else
+ wxCharBuffer m_buf;
+#endif
+ size_t m_len;
+ bool m_lenSet;
+
+ DECLARE_NO_COPY_CLASS(wxStringBufferLength)
+};
+
+#else // if !wxUSE_STL
+