1. Empty() now doesn't free memory - Clear() does

2. operator<<(int), (float) and (double) added
3. vsnprintf() is used if available instead of vprintf() (buffer overflows...)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-11-24 16:08:06 +00:00
parent 38c7b3d369
commit 7be07660b4
2 changed files with 92 additions and 4 deletions

View File

@@ -257,14 +257,23 @@ public:
size_t Len() const { return GetStringData()->nDataLength; }
/// string contains any characters?
bool IsEmpty() const { return Len() == 0; }
/// reinitialize string (and free memory)
/// empty string contents
void Empty()
{
if ( !IsEmpty() )
Reinit();
// should be empty
wxASSERT( GetStringData()->nDataLength == 0 );
wxASSERT( GetStringData()->nAllocLength == 0 );
}
/// empty the string and free memory
void Clear()
{
if ( !GetStringData()->IsEmpty() )
Reinit();
wxASSERT( GetStringData()->nDataLength == 0 ); // should be empty
wxASSERT( GetStringData()->nAllocLength == 0 ); // and not own any memory
}
/// Is an ascii value
@@ -372,6 +381,16 @@ public:
//@}
//@}
/** @name stream-like functions */
//@{
/// insert an int into string
wxString& operator<<(int i);
/// insert a float into string
wxString& operator<<(float f);
/// insert a double into string
wxString& operator<<(double d);
//@}
/** @name string comparison */
//@{
/**