+ // NB: special care was taken in arrangin the member functions in such order
+ // that all inline functions can be effectively inlined
+private:
+ // points to data preceded by wxStringData structure with ref count info
+ char *m_pchData;
+
+ // accessor to string data
+ wxStringData* GetStringData() const { return (wxStringData*)m_pchData - 1; }
+
+ // string (re)initialization functions
+ // initializes the string to the empty value (must be called only from
+ // ctors, use Reinit() otherwise)
+ void Init() { m_pchData = (char *)g_szNul; }
+ // initializaes the string with (a part of) C-string
+ void InitWith(const char *psz, size_t nPos = 0, size_t nLen = STRING_MAXLEN);
+ // as Init, but also frees old data
+ void Reinit() { GetStringData()->Unlock(); Init(); }
+
+ // memory allocation
+ // allocates memory for string of lenght nLen
+ void AllocBuffer(size_t nLen);
+ // copies data to another string
+ void AllocCopy(wxString&, int, int) const;
+ // effectively copies data to string
+ void AssignCopy(size_t, const char *);
+
+ // append a (sub)string
+ void ConcatSelf(int nLen, const char *src);
+
+ // functions called before writing to the string: they copy it if there
+ // are other references to our data (should be the only owner when writing)
+ void CopyBeforeWrite();
+ void AllocBeforeWrite(size_t);
+