diff options
Diffstat (limited to 'src/tools/ntqstring.h')
-rw-r--r-- | src/tools/ntqstring.h | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/src/tools/ntqstring.h b/src/tools/ntqstring.h index b91caf83c..4d473e016 100644 --- a/src/tools/ntqstring.h +++ b/src/tools/ntqstring.h @@ -71,6 +71,7 @@ class TQRegExp; class TQString; class TQCharRef; +class TQMutex; template <class T> class TQDeepCopy; class Q_EXPORT TQChar { @@ -359,22 +360,14 @@ inline bool operator>( TQChar c1, TQChar c2 ) { return !(c2>=c1); } // internal struct Q_EXPORT TQStringData : public TQShared { - TQStringData() : - TQShared(), unicode(0), ascii(0), len(0), issimpletext(TRUE), maxl(0), islatin1(FALSE), security_unpaged(FALSE) { ref(); } - TQStringData(TQChar *u, uint l, uint m) : - TQShared(), unicode(u), ascii(0), len(l), issimpletext(FALSE), maxl(m), islatin1(FALSE), security_unpaged(FALSE) { } + TQStringData(); + TQStringData(TQChar *u, uint l, uint m); ~TQStringData(); void deleteSelf(); TQChar *unicode; char *ascii; - void setDirty() { - if ( ascii ) { - delete [] ascii; - ascii = 0; - } - issimpletext = FALSE; - } + void setDirty(); #ifdef Q_OS_MAC9 uint len; #else @@ -390,6 +383,8 @@ struct Q_EXPORT TQStringData : public TQShared { bool security_unpaged : 1; + TQMutex* mutex; + private: #if defined(TQ_DISABLE_COPY) TQStringData( const TQStringData& ); @@ -646,13 +641,7 @@ public: TQChar constref(uint i) const { return at(i); } - TQChar& ref(uint i) - { // Optimized for easy-inlining by simple compilers. - if ( d->count != 1 || i >= d->len ) - subat( i ); - d->setDirty(); - return d->unicode[i]; - } + TQChar& ref(uint i); const TQChar* unicode() const { return d->unicode; } const char* ascii() const; @@ -747,7 +736,7 @@ private: friend class TQConstString; friend class TQTextStream; - TQString( TQStringData* dd, bool /* dummy */ ) : d(dd) { } + TQString( TQStringData* dd, bool /* dummy */ ); // needed for TQDeepCopy void detach(); @@ -839,25 +828,6 @@ Q_EXPORT TQDataStream &operator>>( TQDataStream &, TQString & ); TQString inline functions *****************************************************************************/ -// These two move code into makeSharedNull() and deletesData() -// to improve cache-coherence (and reduce code bloat), while -// keeping the common cases fast. -// -// No safe way to pre-init shared_null on ALL compilers/linkers. -inline TQString::TQString() : - d(shared_null ? shared_null : makeSharedNull()) -{ - d->ref(); -} -// -inline TQString::~TQString() -{ - if ( d->deref() ) { - if ( d != shared_null ) - d->deleteSelf(); - } -} - // needed for TQDeepCopy inline void TQString::detach() { real_detach(); } |