author | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
commit | 155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (side-by-side diff) | |
tree | e6edaa5a7040fe6c224c3943d1094dcf02e4f74c /qmake/include/qstring.h | |
parent | 86703e8a5527ef114facd02c005b6b3a7e62e263 (diff) | |
download | opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.zip opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.gz opie-155d68c1e7d7dc0fed2534ac43d6d77ce2781f55.tar.bz2 |
update qmake to 1.05a
-rw-r--r-- | qmake/include/qstring.h | 91 |
1 files changed, 66 insertions, 25 deletions
diff --git a/qmake/include/qstring.h b/qmake/include/qstring.h index 2a87a5a..c1d6740 100644 --- a/qmake/include/qstring.h +++ b/qmake/include/qstring.h @@ -3,4 +3,3 @@ ** -** Definition of the QString class, and related Unicode -** functions. +** Definition of the QString class, and related Unicode functions. ** @@ -8,3 +7,3 @@ ** -** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. +** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. ** @@ -45,2 +44,9 @@ +#ifndef QT_NO_STL +#include <string> +#if defined(Q_WRONG_SB_CTYPE_MACROS) && defined(_SB_CTYPE_MACROS) +#undef _SB_CTYPE_MACROS +#endif +#endif + @@ -338,5 +344,5 @@ struct Q_EXPORT QStringData : public QShared { QStringData() : - QShared(), unicode(0), ascii(0), len(0), simpletext(1), maxl(0), dirty(0) { ref(); } + QShared(), unicode(0), ascii(0), len(0), issimpletext(TRUE), maxl(0), islatin1(FALSE) { ref(); } QStringData(QChar *u, uint l, uint m) : - QShared(), unicode(u), ascii(0), len(l), simpletext(1), maxl(m), dirty(1) { } + QShared(), unicode(u), ascii(0), len(l), issimpletext(FALSE), maxl(m), islatin1(FALSE) { } ~QStringData() { if ( unicode ) delete[] ((char*)unicode); @@ -352,3 +358,3 @@ struct Q_EXPORT QStringData : public QShared { } - dirty = 1; + issimpletext = FALSE; } @@ -359,3 +365,3 @@ struct Q_EXPORT QStringData : public QShared { #endif - uint simpletext : 1; + uint issimpletext : 1; #ifdef Q_OS_MAC9 @@ -365,3 +371,3 @@ struct Q_EXPORT QStringData : public QShared { #endif - uint dirty : 1; + uint islatin1 : 1; @@ -386,2 +392,5 @@ public: #endif +#ifndef QT_NO_STL + QString( const std::string& ); // deep copy +#endif ~QString(); @@ -389,4 +398,5 @@ public: QString &operator=( const QString & ); // impl-shared copy -#ifndef QT_NO_CAST_ASCII QString &operator=( const char * ); // deep copy +#ifndef QT_NO_STL + QString &operator=( const std::string& ); // deep copy #endif @@ -496,2 +506,5 @@ public: #endif +#ifndef QT_NO_STL + QString &append( const std::string& ); +#endif QString &prepend( char ); @@ -503,2 +516,5 @@ public: #endif +#ifndef QT_NO_STL + QString &prepend( const std::string& ); +#endif QString &remove( uint index, uint len ); @@ -558,2 +574,5 @@ public: #endif +#ifndef QT_NO_STL + QString &operator+=( const std::string& ); +#endif QString &operator+=( QChar c ); @@ -578,3 +597,4 @@ public: const QChar* unicode() const { return d->unicode; } - const char* ascii() const { return latin1(); } + const char* ascii() const; + static QString fromAscii(const char*, int len=-1); const char* latin1() const; @@ -587,4 +607,8 @@ public: #ifndef QT_NO_ASCII_CAST - operator const char *() const { return latin1(); } + operator const char *() const { return ascii(); } #endif +#ifndef QT_NO_STL + operator std::string() const { return ascii() ? ascii() : ""; } +#endif + static QString fromUcs2( const unsigned short *ucs2 ); @@ -594,2 +618,3 @@ public: QString &setUnicodeCodes( const ushort* unicode_as_ushorts, uint len ); + QString &setAscii( const char*, int len=-1 ); QString &setLatin1( const char*, int len=-1 ); @@ -611,3 +636,3 @@ public: #ifndef QT_NO_COMPAT - const char* data() const { return latin1(); } + const char* data() const { return ascii(); } #endif @@ -619,3 +644,3 @@ public: - bool simpleText() const { if ( d->dirty ) checkSimpleText(); return (bool)d->simpletext; } + bool simpleText() const { if ( !d->issimpletext ) checkSimpleText(); return (bool)d->issimpletext; } bool isRightToLeft() const; @@ -633,5 +658,5 @@ private: - static QChar* asciiToUnicode( const char*, uint * len, uint maxlen=(uint)-1 ); - static QChar* asciiToUnicode( const QByteArray&, uint * len ); - static char* unicodeToAscii( const QChar*, uint len ); + static QChar* latin1ToUnicode( const char*, uint * len, uint maxlen=(uint)-1 ); + static QChar* latin1ToUnicode( const QByteArray&, uint * len ); + static char* unicodeToLatin1( const QChar*, uint len ); @@ -796,3 +821,13 @@ inline QString &QString::prepend( char c ) inline QString &QString::prepend( const QByteArray & s ) -{ return insert(0,s.data()); } +{ return insert(0,QString(s)); } +#endif + +#ifndef QT_NO_STL +inline QString &QString::prepend( const std::string& s ) +{ return insert(0, s); } +#endif + +#ifndef QT_NO_CAST_ASCII +inline QString &QString::operator+=( const QByteArray &s ) +{ return operator+=(QString(s)); } #endif @@ -804,3 +839,3 @@ inline QString &QString::append( const QString & s ) inline QString &QString::append( const QByteArray &s ) -{ return operator+=(s.data()); } +{ return operator+=(s); } @@ -816,5 +851,7 @@ inline QString &QString::append( char c ) -#ifndef QT_NO_CAST_ASCII -inline QString &QString::operator+=( const QByteArray &s ) -{ return operator+=(s.data()); } +#ifndef QT_NO_STL +inline QString &QString::operator+=( const std::string& s ) +{ return operator+=(s.c_str()); } +inline QString &QString::append( const std::string& s ) +{ return operator+=(s); } #endif @@ -856,6 +893,6 @@ inline int QString::findRev( char c, int index, bool cs) const inline int QString::find( const char* str, int index ) const -{ return find(QString::fromLatin1(str), index); } +{ return find(QString::fromAscii(str), index); } inline int QString::findRev( const char* str, int index ) const -{ return findRev(QString::fromLatin1(str), index); } +{ return findRev(QString::fromAscii(str), index); } #endif @@ -899,3 +936,3 @@ Q_EXPORT inline const QString operator+( const QString &s1, const char *s2 ) QString tmp( s1 ); - tmp += QString::fromLatin1(s2); + tmp += QString::fromAscii(s2); return tmp; @@ -905,3 +942,3 @@ Q_EXPORT inline const QString operator+( const char *s1, const QString &s2 ) { - QString tmp = QString::fromLatin1( s1 ); + QString tmp = QString::fromAscii( s1 ); tmp += s2; @@ -949,2 +986,6 @@ extern Q_EXPORT QString qt_winMB2QString( const char* mb, int len=-1 ); +#ifdef QT_QWINEXPORT +#define Q_DEFINED_QSTRING +#include "qwinexport.h" +#endif /* QT_QWINEXPORT */ #endif // QSTRING_H |