author | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-07-10 02:40:10 (UTC) |
commit | 155d68c1e7d7dc0fed2534ac43d6d77ce2781f55 (patch) (unidiff) | |
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 | |||
@@ -1,21 +1,20 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | ** $Id$ | 2 | ** $Id$ |
3 | ** | 3 | ** |
4 | ** Definition of the QString class, and related Unicode | 4 | ** Definition of the QString class, and related Unicode functions. |
5 | ** functions. | ||
6 | ** | 5 | ** |
7 | ** Created : 920609 | 6 | ** Created : 920609 |
8 | ** | 7 | ** |
9 | ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. | 8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved. |
10 | ** | 9 | ** |
11 | ** This file is part of the tools module of the Qt GUI Toolkit. | 10 | ** This file is part of the tools module of the Qt GUI Toolkit. |
12 | ** | 11 | ** |
13 | ** This file may be distributed under the terms of the Q Public License | 12 | ** This file may be distributed under the terms of the Q Public License |
14 | ** as defined by Trolltech AS of Norway and appearing in the file | 13 | ** as defined by Trolltech AS of Norway and appearing in the file |
15 | ** LICENSE.QPL included in the packaging of this file. | 14 | ** LICENSE.QPL included in the packaging of this file. |
16 | ** | 15 | ** |
17 | ** This file may be distributed and/or modified under the terms of the | 16 | ** This file may be distributed and/or modified under the terms of the |
18 | ** GNU General Public License version 2 as published by the Free Software | 17 | ** GNU General Public License version 2 as published by the Free Software |
19 | ** Foundation and appearing in the file LICENSE.GPL included in the | 18 | ** Foundation and appearing in the file LICENSE.GPL included in the |
20 | ** packaging of this file. | 19 | ** packaging of this file. |
21 | ** | 20 | ** |
@@ -34,24 +33,31 @@ | |||
34 | ** Contact info@trolltech.com if any conditions of this licensing are | 33 | ** Contact info@trolltech.com if any conditions of this licensing are |
35 | ** not clear to you. | 34 | ** not clear to you. |
36 | ** | 35 | ** |
37 | **********************************************************************/ | 36 | **********************************************************************/ |
38 | 37 | ||
39 | #ifndef QSTRING_H | 38 | #ifndef QSTRING_H |
40 | #define QSTRING_H | 39 | #define QSTRING_H |
41 | 40 | ||
42 | #ifndef QT_H | 41 | #ifndef QT_H |
43 | #include "qcstring.h" | 42 | #include "qcstring.h" |
44 | #endif // QT_H | 43 | #endif // QT_H |
45 | 44 | ||
45 | #ifndef QT_NO_STL | ||
46 | #include <string> | ||
47 | #if defined(Q_WRONG_SB_CTYPE_MACROS) && defined(_SB_CTYPE_MACROS) | ||
48 | #undef _SB_CTYPE_MACROS | ||
49 | #endif | ||
50 | #endif | ||
51 | |||
46 | 52 | ||
47 | /***************************************************************************** | 53 | /***************************************************************************** |
48 | QString class | 54 | QString class |
49 | *****************************************************************************/ | 55 | *****************************************************************************/ |
50 | 56 | ||
51 | class QRegExp; | 57 | class QRegExp; |
52 | class QString; | 58 | class QString; |
53 | class QCharRef; | 59 | class QCharRef; |
54 | template <class T> class QDeepCopy; | 60 | template <class T> class QDeepCopy; |
55 | 61 | ||
56 | class Q_EXPORT QChar { | 62 | class Q_EXPORT QChar { |
57 | public: | 63 | public: |
@@ -327,77 +333,81 @@ inline bool operator>=( QChar c, char ch ) { return ch <= c; } | |||
327 | inline bool operator>=( char ch, QChar c ) { return c <= ch; } | 333 | inline bool operator>=( char ch, QChar c ) { return c <= ch; } |
328 | inline bool operator>=( QChar c1, QChar c2 ) { return c2 <= c1; } | 334 | inline bool operator>=( QChar c1, QChar c2 ) { return c2 <= c1; } |
329 | inline bool operator<( QChar c, char ch ) { return !(ch<=c); } | 335 | inline bool operator<( QChar c, char ch ) { return !(ch<=c); } |
330 | inline bool operator<( char ch, QChar c ) { return !(c<=ch); } | 336 | inline bool operator<( char ch, QChar c ) { return !(c<=ch); } |
331 | inline bool operator<( QChar c1, QChar c2 ) { return !(c2<=c1); } | 337 | inline bool operator<( QChar c1, QChar c2 ) { return !(c2<=c1); } |
332 | inline bool operator>( QChar c, char ch ) { return !(ch>=c); } | 338 | inline bool operator>( QChar c, char ch ) { return !(ch>=c); } |
333 | inline bool operator>( char ch, QChar c ) { return !(c>=ch); } | 339 | inline bool operator>( char ch, QChar c ) { return !(c>=ch); } |
334 | inline bool operator>( QChar c1, QChar c2 ) { return !(c2>=c1); } | 340 | inline bool operator>( QChar c1, QChar c2 ) { return !(c2>=c1); } |
335 | 341 | ||
336 | // internal | 342 | // internal |
337 | struct Q_EXPORT QStringData : public QShared { | 343 | struct Q_EXPORT QStringData : public QShared { |
338 | QStringData() : | 344 | QStringData() : |
339 | QShared(), unicode(0), ascii(0), len(0), simpletext(1), maxl(0), dirty(0) { ref(); } | 345 | QShared(), unicode(0), ascii(0), len(0), issimpletext(TRUE), maxl(0), islatin1(FALSE) { ref(); } |
340 | QStringData(QChar *u, uint l, uint m) : | 346 | QStringData(QChar *u, uint l, uint m) : |
341 | QShared(), unicode(u), ascii(0), len(l), simpletext(1), maxl(m), dirty(1) { } | 347 | QShared(), unicode(u), ascii(0), len(l), issimpletext(FALSE), maxl(m), islatin1(FALSE) { } |
342 | ~QStringData() { if ( unicode ) delete[] ((char*)unicode); | 348 | ~QStringData() { if ( unicode ) delete[] ((char*)unicode); |
343 | if ( ascii ) delete[] ascii; } | 349 | if ( ascii ) delete[] ascii; } |
344 | 350 | ||
345 | void deleteSelf(); | 351 | void deleteSelf(); |
346 | QChar *unicode; | 352 | QChar *unicode; |
347 | char *ascii; | 353 | char *ascii; |
348 | void setDirty() { | 354 | void setDirty() { |
349 | if ( ascii ) { | 355 | if ( ascii ) { |
350 | delete [] ascii; | 356 | delete [] ascii; |
351 | ascii = 0; | 357 | ascii = 0; |
352 | } | 358 | } |
353 | dirty = 1; | 359 | issimpletext = FALSE; |
354 | } | 360 | } |
355 | #ifdef Q_OS_MAC9 | 361 | #ifdef Q_OS_MAC9 |
356 | uint len; | 362 | uint len; |
357 | #else | 363 | #else |
358 | uint len : 30; | 364 | uint len : 30; |
359 | #endif | 365 | #endif |
360 | uint simpletext : 1; | 366 | uint issimpletext : 1; |
361 | #ifdef Q_OS_MAC9 | 367 | #ifdef Q_OS_MAC9 |
362 | uint maxl; | 368 | uint maxl; |
363 | #else | 369 | #else |
364 | uint maxl : 30; | 370 | uint maxl : 30; |
365 | #endif | 371 | #endif |
366 | uint dirty : 1; | 372 | uint islatin1 : 1; |
367 | 373 | ||
368 | private: | 374 | private: |
369 | #if defined(Q_DISABLE_COPY) | 375 | #if defined(Q_DISABLE_COPY) |
370 | QStringData( const QStringData& ); | 376 | QStringData( const QStringData& ); |
371 | QStringData& operator=( const QStringData& ); | 377 | QStringData& operator=( const QStringData& ); |
372 | #endif | 378 | #endif |
373 | }; | 379 | }; |
374 | 380 | ||
375 | 381 | ||
376 | class Q_EXPORT QString | 382 | class Q_EXPORT QString |
377 | { | 383 | { |
378 | public: | 384 | public: |
379 | QString(); // make null string | 385 | QString(); // make null string |
380 | QString( QChar ); // one-char string | 386 | QString( QChar ); // one-char string |
381 | QString( const QString & ); // impl-shared copy | 387 | QString( const QString & ); // impl-shared copy |
382 | QString( const QByteArray& ); // deep copy | 388 | QString( const QByteArray& ); // deep copy |
383 | QString( const QChar* unicode, uint length ); // deep copy | 389 | QString( const QChar* unicode, uint length ); // deep copy |
384 | #ifndef QT_NO_CAST_ASCII | 390 | #ifndef QT_NO_CAST_ASCII |
385 | QString( const char *str ); // deep copy | 391 | QString( const char *str ); // deep copy |
386 | #endif | 392 | #endif |
393 | #ifndef QT_NO_STL | ||
394 | QString( const std::string& ); // deep copy | ||
395 | #endif | ||
387 | ~QString(); | 396 | ~QString(); |
388 | 397 | ||
389 | QString &operator=( const QString & ); // impl-shared copy | 398 | QString &operator=( const QString & ); // impl-shared copy |
390 | #ifndef QT_NO_CAST_ASCII | ||
391 | QString &operator=( const char * ); // deep copy | 399 | QString &operator=( const char * ); // deep copy |
400 | #ifndef QT_NO_STL | ||
401 | QString &operator=( const std::string& ); // deep copy | ||
392 | #endif | 402 | #endif |
393 | QString &operator=( const QCString& ); // deep copy | 403 | QString &operator=( const QCString& ); // deep copy |
394 | QString &operator=( QChar c ); | 404 | QString &operator=( QChar c ); |
395 | QString &operator=( char c ); | 405 | QString &operator=( char c ); |
396 | 406 | ||
397 | QT_STATIC_CONST QString null; | 407 | QT_STATIC_CONST QString null; |
398 | 408 | ||
399 | bool isNull() const; | 409 | bool isNull() const; |
400 | bool isEmpty() const; | 410 | bool isEmpty() const; |
401 | uint length() const; | 411 | uint length() const; |
402 | void truncate( uint pos ); | 412 | void truncate( uint pos ); |
403 | 413 | ||
@@ -485,31 +495,37 @@ public: | |||
485 | 495 | ||
486 | QString &insert( uint index, const QString & ); | 496 | QString &insert( uint index, const QString & ); |
487 | QString &insert( uint index, const QChar*, uint len ); | 497 | QString &insert( uint index, const QChar*, uint len ); |
488 | QString &insert( uint index, QChar ); | 498 | QString &insert( uint index, QChar ); |
489 | QString &insert( uint index, char c ) { return insert(index,QChar(c)); } | 499 | QString &insert( uint index, char c ) { return insert(index,QChar(c)); } |
490 | QString &append( char ); | 500 | QString &append( char ); |
491 | QString &append( QChar ); | 501 | QString &append( QChar ); |
492 | QString &append( const QString & ); | 502 | QString &append( const QString & ); |
493 | #ifndef QT_NO_CAST_ASCII | 503 | #ifndef QT_NO_CAST_ASCII |
494 | QString &append( const QByteArray & ); | 504 | QString &append( const QByteArray & ); |
495 | QString &append( const char * ); | 505 | QString &append( const char * ); |
496 | #endif | 506 | #endif |
507 | #ifndef QT_NO_STL | ||
508 | QString &append( const std::string& ); | ||
509 | #endif | ||
497 | QString &prepend( char ); | 510 | QString &prepend( char ); |
498 | QString &prepend( QChar ); | 511 | QString &prepend( QChar ); |
499 | QString &prepend( const QString & ); | 512 | QString &prepend( const QString & ); |
500 | #ifndef QT_NO_CAST_ASCII | 513 | #ifndef QT_NO_CAST_ASCII |
501 | QString &prepend( const QByteArray & ); | 514 | QString &prepend( const QByteArray & ); |
502 | QString &prepend( const char * ); | 515 | QString &prepend( const char * ); |
503 | #endif | 516 | #endif |
517 | #ifndef QT_NO_STL | ||
518 | QString &prepend( const std::string& ); | ||
519 | #endif | ||
504 | QString &remove( uint index, uint len ); | 520 | QString &remove( uint index, uint len ); |
505 | QString &remove( QChar c ); | 521 | QString &remove( QChar c ); |
506 | QString &remove( char c ) { return remove( QChar(c) ); } | 522 | QString &remove( char c ) { return remove( QChar(c) ); } |
507 | QString &remove( const QString & ); | 523 | QString &remove( const QString & ); |
508 | #ifndef QT_NO_REGEXP | 524 | #ifndef QT_NO_REGEXP |
509 | QString &remove( const QRegExp & ); | 525 | QString &remove( const QRegExp & ); |
510 | #endif | 526 | #endif |
511 | #ifndef QT_NO_CAST_ASCII | 527 | #ifndef QT_NO_CAST_ASCII |
512 | QString &remove( const char * ); | 528 | QString &remove( const char * ); |
513 | #endif | 529 | #endif |
514 | QString &replace( uint index, uint len, const QString & ); | 530 | QString &replace( uint index, uint len, const QString & ); |
515 | QString &replace( uint index, uint len, const QChar*, uint clen ); | 531 | QString &replace( uint index, uint len, const QChar*, uint clen ); |
@@ -547,102 +563,111 @@ public: | |||
547 | static QString number( ulong, int base=10); | 563 | static QString number( ulong, int base=10); |
548 | static QString number( int, int base=10 ); | 564 | static QString number( int, int base=10 ); |
549 | static QString number( uint, int base=10); | 565 | static QString number( uint, int base=10); |
550 | static QString number( double, char f='g', int prec=6 ); | 566 | static QString number( double, char f='g', int prec=6 ); |
551 | 567 | ||
552 | void setExpand( uint index, QChar c ); | 568 | void setExpand( uint index, QChar c ); |
553 | 569 | ||
554 | QString &operator+=( const QString &str ); | 570 | QString &operator+=( const QString &str ); |
555 | #ifndef QT_NO_CAST_ASCII | 571 | #ifndef QT_NO_CAST_ASCII |
556 | QString &operator+=( const QByteArray &str ); | 572 | QString &operator+=( const QByteArray &str ); |
557 | QString &operator+=( const char *str ); | 573 | QString &operator+=( const char *str ); |
558 | #endif | 574 | #endif |
575 | #ifndef QT_NO_STL | ||
576 | QString &operator+=( const std::string& ); | ||
577 | #endif | ||
559 | QString &operator+=( QChar c ); | 578 | QString &operator+=( QChar c ); |
560 | QString &operator+=( char c ); | 579 | QString &operator+=( char c ); |
561 | 580 | ||
562 | QChar at( uint i ) const | 581 | QChar at( uint i ) const |
563 | { return i < d->len ? d->unicode[i] : QChar::null; } | 582 | { return i < d->len ? d->unicode[i] : QChar::null; } |
564 | QChar operator[]( int i ) const { return at((uint)i); } | 583 | QChar operator[]( int i ) const { return at((uint)i); } |
565 | QCharRef at( uint i ); | 584 | QCharRef at( uint i ); |
566 | QCharRef operator[]( int i ); | 585 | QCharRef operator[]( int i ); |
567 | 586 | ||
568 | QChar constref(uint i) const | 587 | QChar constref(uint i) const |
569 | { return at(i); } | 588 | { return at(i); } |
570 | QChar& ref(uint i) | 589 | QChar& ref(uint i) |
571 | { // Optimized for easy-inlining by simple compilers. | 590 | { // Optimized for easy-inlining by simple compilers. |
572 | if ( d->count != 1 || i >= d->len ) | 591 | if ( d->count != 1 || i >= d->len ) |
573 | subat( i ); | 592 | subat( i ); |
574 | d->setDirty(); | 593 | d->setDirty(); |
575 | return d->unicode[i]; | 594 | return d->unicode[i]; |
576 | } | 595 | } |
577 | 596 | ||
578 | const QChar* unicode() const { return d->unicode; } | 597 | const QChar* unicode() const { return d->unicode; } |
579 | const char* ascii() const { return latin1(); } | 598 | const char* ascii() const; |
599 | static QString fromAscii(const char*, int len=-1); | ||
580 | const char* latin1() const; | 600 | const char* latin1() const; |
581 | static QString fromLatin1(const char*, int len=-1); | 601 | static QString fromLatin1(const char*, int len=-1); |
582 | QCString utf8() const; | 602 | QCString utf8() const; |
583 | static QString fromUtf8(const char*, int len=-1); | 603 | static QString fromUtf8(const char*, int len=-1); |
584 | QCString local8Bit() const; | 604 | QCString local8Bit() const; |
585 | static QString fromLocal8Bit(const char*, int len=-1); | 605 | static QString fromLocal8Bit(const char*, int len=-1); |
586 | bool operator!() const; | 606 | bool operator!() const; |
587 | #ifndef QT_NO_ASCII_CAST | 607 | #ifndef QT_NO_ASCII_CAST |
588 | operator const char *() const { return latin1(); } | 608 | operator const char *() const { return ascii(); } |
589 | #endif | 609 | #endif |
610 | #ifndef QT_NO_STL | ||
611 | operator std::string() const { return ascii() ? ascii() : ""; } | ||
612 | #endif | ||
613 | |||
590 | static QString fromUcs2( const unsigned short *ucs2 ); | 614 | static QString fromUcs2( const unsigned short *ucs2 ); |
591 | const unsigned short *ucs2() const; | 615 | const unsigned short *ucs2() const; |
592 | 616 | ||
593 | QString &setUnicode( const QChar* unicode, uint len ); | 617 | QString &setUnicode( const QChar* unicode, uint len ); |
594 | QString &setUnicodeCodes( const ushort* unicode_as_ushorts, uint len ); | 618 | QString &setUnicodeCodes( const ushort* unicode_as_ushorts, uint len ); |
619 | QString &setAscii( const char*, int len=-1 ); | ||
595 | QString &setLatin1( const char*, int len=-1 ); | 620 | QString &setLatin1( const char*, int len=-1 ); |
596 | 621 | ||
597 | int compare( const QString& s ) const; | 622 | int compare( const QString& s ) const; |
598 | static int compare( const QString& s1, const QString& s2 ) | 623 | static int compare( const QString& s1, const QString& s2 ) |
599 | { return s1.compare( s2 ); } | 624 | { return s1.compare( s2 ); } |
600 | 625 | ||
601 | int localeAwareCompare( const QString& s ) const; | 626 | int localeAwareCompare( const QString& s ) const; |
602 | static int localeAwareCompare( const QString& s1, const QString& s2 ) | 627 | static int localeAwareCompare( const QString& s1, const QString& s2 ) |
603 | { return s1.localeAwareCompare( s2 ); } | 628 | { return s1.localeAwareCompare( s2 ); } |
604 | 629 | ||
605 | #ifndef QT_NO_DATASTREAM | 630 | #ifndef QT_NO_DATASTREAM |
606 | friend Q_EXPORT QDataStream &operator>>( QDataStream &, QString & ); | 631 | friend Q_EXPORT QDataStream &operator>>( QDataStream &, QString & ); |
607 | #endif | 632 | #endif |
608 | 633 | ||
609 | void compose(); | 634 | void compose(); |
610 | 635 | ||
611 | #ifndef QT_NO_COMPAT | 636 | #ifndef QT_NO_COMPAT |
612 | const char* data() const { return latin1(); } | 637 | const char* data() const { return ascii(); } |
613 | #endif | 638 | #endif |
614 | 639 | ||
615 | bool startsWith( const QString& ) const; | 640 | bool startsWith( const QString& ) const; |
616 | bool endsWith( const QString& ) const; | 641 | bool endsWith( const QString& ) const; |
617 | 642 | ||
618 | void setLength( uint newLength ); | 643 | void setLength( uint newLength ); |
619 | 644 | ||
620 | bool simpleText() const { if ( d->dirty ) checkSimpleText(); return (bool)d->simpletext; } | 645 | bool simpleText() const { if ( !d->issimpletext ) checkSimpleText(); return (bool)d->issimpletext; } |
621 | bool isRightToLeft() const; | 646 | bool isRightToLeft() const; |
622 | 647 | ||
623 | 648 | ||
624 | private: | 649 | private: |
625 | QString( int size, bool /* dummy */ );// allocate size incl. \0 | 650 | QString( int size, bool /* dummy */ );// allocate size incl. \0 |
626 | 651 | ||
627 | void deref(); | 652 | void deref(); |
628 | void real_detach(); | 653 | void real_detach(); |
629 | void subat( uint ); | 654 | void subat( uint ); |
630 | bool findArg(int& pos, int& len) const; | 655 | bool findArg(int& pos, int& len) const; |
631 | 656 | ||
632 | void checkSimpleText() const; | 657 | void checkSimpleText() const; |
633 | 658 | ||
634 | static QChar* asciiToUnicode( const char*, uint * len, uint maxlen=(uint)-1 ); | 659 | static QChar* latin1ToUnicode( const char*, uint * len, uint maxlen=(uint)-1 ); |
635 | static QChar* asciiToUnicode( const QByteArray&, uint * len ); | 660 | static QChar* latin1ToUnicode( const QByteArray&, uint * len ); |
636 | static char* unicodeToAscii( const QChar*, uint len ); | 661 | static char* unicodeToLatin1( const QChar*, uint len ); |
637 | 662 | ||
638 | QStringData *d; | 663 | QStringData *d; |
639 | static QStringData* shared_null; | 664 | static QStringData* shared_null; |
640 | static QStringData* makeSharedNull(); | 665 | static QStringData* makeSharedNull(); |
641 | 666 | ||
642 | friend class QConstString; | 667 | friend class QConstString; |
643 | friend class QTextStream; | 668 | friend class QTextStream; |
644 | QString( QStringData* dd, bool /* dummy */ ) : d(dd) { } | 669 | QString( QStringData* dd, bool /* dummy */ ) : d(dd) { } |
645 | 670 | ||
646 | // needed for QDeepCopy | 671 | // needed for QDeepCopy |
647 | void detach(); | 672 | void detach(); |
648 | friend class QDeepCopy<QString>; | 673 | friend class QDeepCopy<QString>; |
@@ -785,47 +810,59 @@ inline QString QString::copy() const | |||
785 | 810 | ||
786 | inline QString &QString::prepend( const QString & s ) | 811 | inline QString &QString::prepend( const QString & s ) |
787 | { return insert(0,s); } | 812 | { return insert(0,s); } |
788 | 813 | ||
789 | inline QString &QString::prepend( QChar c ) | 814 | inline QString &QString::prepend( QChar c ) |
790 | { return insert(0,c); } | 815 | { return insert(0,c); } |
791 | 816 | ||
792 | inline QString &QString::prepend( char c ) | 817 | inline QString &QString::prepend( char c ) |
793 | { return insert(0,c); } | 818 | { return insert(0,c); } |
794 | 819 | ||
795 | #ifndef QT_NO_CAST_ASCII | 820 | #ifndef QT_NO_CAST_ASCII |
796 | inline QString &QString::prepend( const QByteArray & s ) | 821 | inline QString &QString::prepend( const QByteArray & s ) |
797 | { return insert(0,s.data()); } | 822 | { return insert(0,QString(s)); } |
823 | #endif | ||
824 | |||
825 | #ifndef QT_NO_STL | ||
826 | inline QString &QString::prepend( const std::string& s ) | ||
827 | { return insert(0, s); } | ||
828 | #endif | ||
829 | |||
830 | #ifndef QT_NO_CAST_ASCII | ||
831 | inline QString &QString::operator+=( const QByteArray &s ) | ||
832 | { return operator+=(QString(s)); } | ||
798 | #endif | 833 | #endif |
799 | 834 | ||
800 | inline QString &QString::append( const QString & s ) | 835 | inline QString &QString::append( const QString & s ) |
801 | { return operator+=(s); } | 836 | { return operator+=(s); } |
802 | 837 | ||
803 | #ifndef QT_NO_CAST_ASCII | 838 | #ifndef QT_NO_CAST_ASCII |
804 | inline QString &QString::append( const QByteArray &s ) | 839 | inline QString &QString::append( const QByteArray &s ) |
805 | { return operator+=(s.data()); } | 840 | { return operator+=(s); } |
806 | 841 | ||
807 | inline QString &QString::append( const char * s ) | 842 | inline QString &QString::append( const char * s ) |
808 | { return operator+=(s); } | 843 | { return operator+=(s); } |
809 | #endif | 844 | #endif |
810 | 845 | ||
811 | inline QString &QString::append( QChar c ) | 846 | inline QString &QString::append( QChar c ) |
812 | { return operator+=(c); } | 847 | { return operator+=(c); } |
813 | 848 | ||
814 | inline QString &QString::append( char c ) | 849 | inline QString &QString::append( char c ) |
815 | { return operator+=(c); } | 850 | { return operator+=(c); } |
816 | 851 | ||
817 | #ifndef QT_NO_CAST_ASCII | 852 | #ifndef QT_NO_STL |
818 | inline QString &QString::operator+=( const QByteArray &s ) | 853 | inline QString &QString::operator+=( const std::string& s ) |
819 | { return operator+=(s.data()); } | 854 | { return operator+=(s.c_str()); } |
855 | inline QString &QString::append( const std::string& s ) | ||
856 | { return operator+=(s); } | ||
820 | #endif | 857 | #endif |
821 | 858 | ||
822 | inline QString &QString::setNum( short n, int base ) | 859 | inline QString &QString::setNum( short n, int base ) |
823 | { return setNum((long)n, base); } | 860 | { return setNum((long)n, base); } |
824 | 861 | ||
825 | inline QString &QString::setNum( ushort n, int base ) | 862 | inline QString &QString::setNum( ushort n, int base ) |
826 | { return setNum((ulong)n, base); } | 863 | { return setNum((ulong)n, base); } |
827 | 864 | ||
828 | inline QString &QString::setNum( int n, int base ) | 865 | inline QString &QString::setNum( int n, int base ) |
829 | { return setNum((long)n, base); } | 866 | { return setNum((long)n, base); } |
830 | 867 | ||
831 | inline QString &QString::setNum( uint n, int base ) | 868 | inline QString &QString::setNum( uint n, int base ) |
@@ -845,28 +882,28 @@ inline QString QString::arg(short a, int fieldwidth, int base) const | |||
845 | 882 | ||
846 | inline QString QString::arg(ushort a, int fieldwidth, int base) const | 883 | inline QString QString::arg(ushort a, int fieldwidth, int base) const |
847 | { return arg((ulong)a, fieldwidth, base); } | 884 | { return arg((ulong)a, fieldwidth, base); } |
848 | 885 | ||
849 | inline int QString::find( char c, int index, bool cs ) const | 886 | inline int QString::find( char c, int index, bool cs ) const |
850 | { return find(QChar(c), index, cs); } | 887 | { return find(QChar(c), index, cs); } |
851 | 888 | ||
852 | inline int QString::findRev( char c, int index, bool cs) const | 889 | inline int QString::findRev( char c, int index, bool cs) const |
853 | { return findRev( QChar(c), index, cs ); } | 890 | { return findRev( QChar(c), index, cs ); } |
854 | 891 | ||
855 | #ifndef QT_NO_CAST_ASCII | 892 | #ifndef QT_NO_CAST_ASCII |
856 | inline int QString::find( const char* str, int index ) const | 893 | inline int QString::find( const char* str, int index ) const |
857 | { return find(QString::fromLatin1(str), index); } | 894 | { return find(QString::fromAscii(str), index); } |
858 | 895 | ||
859 | inline int QString::findRev( const char* str, int index ) const | 896 | inline int QString::findRev( const char* str, int index ) const |
860 | { return findRev(QString::fromLatin1(str), index); } | 897 | { return findRev(QString::fromAscii(str), index); } |
861 | #endif | 898 | #endif |
862 | 899 | ||
863 | 900 | ||
864 | /***************************************************************************** | 901 | /***************************************************************************** |
865 | QString non-member operators | 902 | QString non-member operators |
866 | *****************************************************************************/ | 903 | *****************************************************************************/ |
867 | 904 | ||
868 | Q_EXPORT bool operator!=( const QString &s1, const QString &s2 ); | 905 | Q_EXPORT bool operator!=( const QString &s1, const QString &s2 ); |
869 | Q_EXPORT bool operator<( const QString &s1, const QString &s2 ); | 906 | Q_EXPORT bool operator<( const QString &s1, const QString &s2 ); |
870 | Q_EXPORT bool operator<=( const QString &s1, const QString &s2 ); | 907 | Q_EXPORT bool operator<=( const QString &s1, const QString &s2 ); |
871 | Q_EXPORT bool operator==( const QString &s1, const QString &s2 ); | 908 | Q_EXPORT bool operator==( const QString &s1, const QString &s2 ); |
872 | Q_EXPORT bool operator>( const QString &s1, const QString &s2 ); | 909 | Q_EXPORT bool operator>( const QString &s1, const QString &s2 ); |
@@ -888,31 +925,31 @@ Q_EXPORT bool operator>=( const char *s1, const QString &s2 ); | |||
888 | 925 | ||
889 | Q_EXPORT inline const QString operator+( const QString &s1, const QString &s2 ) | 926 | Q_EXPORT inline const QString operator+( const QString &s1, const QString &s2 ) |
890 | { | 927 | { |
891 | QString tmp( s1 ); | 928 | QString tmp( s1 ); |
892 | tmp += s2; | 929 | tmp += s2; |
893 | return tmp; | 930 | return tmp; |
894 | } | 931 | } |
895 | 932 | ||
896 | #ifndef QT_NO_CAST_ASCII | 933 | #ifndef QT_NO_CAST_ASCII |
897 | Q_EXPORT inline const QString operator+( const QString &s1, const char *s2 ) | 934 | Q_EXPORT inline const QString operator+( const QString &s1, const char *s2 ) |
898 | { | 935 | { |
899 | QString tmp( s1 ); | 936 | QString tmp( s1 ); |
900 | tmp += QString::fromLatin1(s2); | 937 | tmp += QString::fromAscii(s2); |
901 | return tmp; | 938 | return tmp; |
902 | } | 939 | } |
903 | 940 | ||
904 | Q_EXPORT inline const QString operator+( const char *s1, const QString &s2 ) | 941 | Q_EXPORT inline const QString operator+( const char *s1, const QString &s2 ) |
905 | { | 942 | { |
906 | QString tmp = QString::fromLatin1( s1 ); | 943 | QString tmp = QString::fromAscii( s1 ); |
907 | tmp += s2; | 944 | tmp += s2; |
908 | return tmp; | 945 | return tmp; |
909 | } | 946 | } |
910 | #endif | 947 | #endif |
911 | 948 | ||
912 | Q_EXPORT inline const QString operator+( const QString &s1, QChar c2 ) | 949 | Q_EXPORT inline const QString operator+( const QString &s1, QChar c2 ) |
913 | { | 950 | { |
914 | QString tmp( s1 ); | 951 | QString tmp( s1 ); |
915 | tmp += c2; | 952 | tmp += c2; |
916 | return tmp; | 953 | return tmp; |
917 | } | 954 | } |
918 | 955 | ||
@@ -938,13 +975,17 @@ Q_EXPORT inline const QString operator+( char c1, const QString &s2 ) | |||
938 | tmp += s2; | 975 | tmp += s2; |
939 | return tmp; | 976 | return tmp; |
940 | } | 977 | } |
941 | 978 | ||
942 | #if defined(Q_OS_WIN32) | 979 | #if defined(Q_OS_WIN32) |
943 | extern Q_EXPORT QString qt_winQString(void*); | 980 | extern Q_EXPORT QString qt_winQString(void*); |
944 | extern Q_EXPORT const void* qt_winTchar(const QString& str, bool addnul); | 981 | extern Q_EXPORT const void* qt_winTchar(const QString& str, bool addnul); |
945 | extern Q_EXPORT void* qt_winTchar_new(const QString& str); | 982 | extern Q_EXPORT void* qt_winTchar_new(const QString& str); |
946 | extern Q_EXPORT QCString qt_winQString2MB( const QString& s, int len=-1 ); | 983 | extern Q_EXPORT QCString qt_winQString2MB( const QString& s, int len=-1 ); |
947 | extern Q_EXPORT QString qt_winMB2QString( const char* mb, int len=-1 ); | 984 | extern Q_EXPORT QString qt_winMB2QString( const char* mb, int len=-1 ); |
948 | #endif | 985 | #endif |
949 | 986 | ||
987 | #ifdef QT_QWINEXPORT | ||
988 | #define Q_DEFINED_QSTRING | ||
989 | #include "qwinexport.h" | ||
990 | #endif /* QT_QWINEXPORT */ | ||
950 | #endif // QSTRING_H | 991 | #endif // QSTRING_H |