diff options
Diffstat (limited to 'src/tools/qstring.h')
-rw-r--r-- | src/tools/qstring.h | 46 |
1 files changed, 8 insertions, 38 deletions
diff --git a/src/tools/qstring.h b/src/tools/qstring.h index 58830db..8715395 100644 --- a/src/tools/qstring.h +++ b/src/tools/qstring.h @@ -71,6 +71,7 @@ class QRegExp; class QString; class QCharRef; +class QMutex; template <class T> class QDeepCopy; class Q_EXPORT QChar { @@ -359,22 +360,14 @@ inline bool operator>( QChar c1, QChar c2 ) { return !(c2>=c1); } // internal struct Q_EXPORT QStringData : public QShared { - QStringData() : - QShared(), unicode(0), ascii(0), len(0), issimpletext(TRUE), maxl(0), islatin1(FALSE), security_unpaged(FALSE) { ref(); } - QStringData(QChar *u, uint l, uint m) : - QShared(), unicode(u), ascii(0), len(l), issimpletext(FALSE), maxl(m), islatin1(FALSE), security_unpaged(FALSE) { } + QStringData(); + QStringData(QChar *u, uint l, uint m); ~QStringData(); void deleteSelf(); QChar *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 QStringData : public QShared { bool security_unpaged : 1; + QMutex* mutex; + private: #if defined(Q_DISABLE_COPY) QStringData( const QStringData& ); @@ -646,13 +641,7 @@ public: QChar constref(uint i) const { return at(i); } - QChar& 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]; - } + QChar& ref(uint i); const QChar* unicode() const { return d->unicode; } const char* ascii() const; @@ -747,7 +736,7 @@ private: friend class QConstString; friend class QTextStream; - QString( QStringData* dd, bool /* dummy */ ) : d(dd) { } + QString( QStringData* dd, bool /* dummy */ ); // needed for QDeepCopy void detach(); @@ -839,25 +828,6 @@ Q_EXPORT QDataStream &operator>>( QDataStream &, QString & ); QString 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 QString::QString() : - d(shared_null ? shared_null : makeSharedNull()) -{ - d->ref(); -} -// -inline QString::~QString() -{ - if ( d->deref() ) { - if ( d != shared_null ) - d->deleteSelf(); - } -} - // needed for QDeepCopy inline void QString::detach() { real_detach(); } |