// memory allocation
// allocates memory for string of length nLen
bool AllocBuffer(size_t nLen);
- // copies data to another string
- bool AllocCopy(wxString&, int, int) const;
// effectively copies data to string
bool AssignCopy(size_t, const wxChar *);
return true;
}
-// ---------------------------------------------------------------------------
-// simple sub-string extraction
-// ---------------------------------------------------------------------------
-
-// helper function: clone the data attached to this string
-bool wxStringBase::AllocCopy(wxString& dest, int nCopyLen, int nCopyIndex) const
-{
- if ( nCopyLen == 0 ) {
- dest.Init();
- }
- else {
- if ( !dest.AllocBuffer(nCopyLen) ) {
- // allocation failure handled by caller
- return false;
- }
- memcpy(dest.m_pchData, m_pchData + nCopyIndex, nCopyLen*sizeof(wxChar));
- }
- return true;
-}
-
#endif // !wxUSE_STL_BASED_WXSTRING
#if !wxUSE_STL_BASED_WXSTRING || !defined(HAVE_STD_STRING_COMPARE)