@param len If specified, length of the string, otherwise the string
is considered to be NUL-terminated.
*/
- static const wxScopedCharTypeBuffer CreateOwned(const CharType *str, size_t len = wxNO_LEN);
+ static const wxScopedCharTypeBuffer CreateOwned(CharType *str, size_t len = wxNO_LEN);
/**
Copy constructor.
Can only be called on buffers that don't share data with another
buffer (i.e. reference count of the data is 1).
+
+ @see shrink()
*/
bool extend(size_t len);
+
+ /**
+ Shrinks the buffer to have size @a len and NUL-terminates the string
+ at this length.
+
+ Can only be called on buffers that don't share data with another
+ buffer (i.e. reference count of the data is 1).
+
+ @param len Length to shrink to. Must not be larger than current length.
+
+ @note The string is not reallocated to take less memory.
+
+ @since 2.9.0
+
+ @see extend()
+ */
+ bool shrink(size_t len);
};
/**