diff options
Diffstat (limited to 'qtools')
-rw-r--r-- | qtools/qstring.cpp | 9 | ||||
-rw-r--r-- | qtools/qstring.h | 16 |
2 files changed, 19 insertions, 6 deletions
diff --git a/qtools/qstring.cpp b/qtools/qstring.cpp index 5d50060..bc3dfc7 100644 --- a/qtools/qstring.cpp +++ b/qtools/qstring.cpp @@ -12170,13 +12170,20 @@ QString QString::fromUcs2( const unsigned short *str ) */ Q_EXPORT QStringData *QString::shared_null = 0; -QT_STATIC_CONST_IMPL QString QString::null; +//QT_STATIC_CONST_IMPL QString QString::null; QT_STATIC_CONST_IMPL QChar QChar::null; QT_STATIC_CONST_IMPL QChar QChar::replacement((ushort)0xfffd); QT_STATIC_CONST_IMPL QChar QChar::byteOrderMark((ushort)0xfeff); QT_STATIC_CONST_IMPL QChar QChar::byteOrderSwapped((ushort)0xfffe); QT_STATIC_CONST_IMPL QChar QChar::nbsp((ushort)0x00a0); +#if defined(_CC_MSVC_) && _MSC_VER <= 1300 +const QString::Null QString::null; +#else +const QString::Null QString::null = { }; +#endif + + QStringData* QString::makeSharedNull() { return shared_null=new QStringData; diff --git a/qtools/qstring.h b/qtools/qstring.h index 4357809..0dd6352 100644 --- a/qtools/qstring.h +++ b/qtools/qstring.h @@ -368,9 +368,15 @@ public: QString &operator=( QChar c ); QString &operator=( char c ); - QT_STATIC_CONST QString null; - - bool isNull() const; + //QT_STATIC_CONST QString null; + //bool isNull() const; + + struct Null { }; + static const Null null; + inline QString(const Null &): d(shared_null) { d->ref(); } + inline QString &operator=(const Null &) { *this = QString(); return *this; } + inline bool isNull() const { return d == shared_null; } + bool isEmpty() const; uint length() const; void truncate( uint pos ); @@ -662,8 +668,8 @@ inline QString &QString::operator=( QChar c ) inline QString &QString::operator=( char c ) { return *this = QString(QChar(c)); } -inline bool QString::isNull() const -{ return unicode() == 0; } +//inline bool QString::isNull() const +//{ return unicode() == 0; } inline bool QString::operator!() const { return isNull(); } |