1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
|
/****************************************************************************
**
** Definition of the TQString class, and related Unicode functions.
**
** Created : 920609
**
** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
**
** This file is part of the tools module of the TQt GUI Toolkit.
**
** This file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free
** Software Foundation and appearing in the files LICENSE.GPL2
** and LICENSE.GPL3 included in the packaging of this file.
** Alternatively you may (at your option) use any later version
** of the GNU General Public License if such license has been
** publicly approved by Trolltech ASA (or its successors, if any)
** and the KDE Free TQt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** This file may be used under the terms of the Q Public License as
** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
** included in the packaging of this file. Licensees holding valid TQt
** Commercial licenses may use this file in accordance with the TQt
** Commercial License Agreement provided with the Software.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
** herein.
**
**********************************************************************/
#ifndef TQSTRING_H
#define TQSTRING_H
#include "tqtglobaldefines.h"
#ifndef TQT_H
#include "tqcstring.h"
#endif // TQT_H
#ifdef USE_QT4
#include <Qt/qstring.h>
#include <Qt/qmetatype.h>
#endif // USE_QT4
#ifndef TQT_NO_CAST_ASCII
#include <limits.h>
#include <string>
#endif
#ifndef TQT_NO_STL
#if defined ( TQ_CC_MSVC_NET ) && _MSC_VER < 1310 // Avoids nasty warning for xlocale, line 450
# pragma warning ( push )
# pragma warning ( disable : 4189 )
# include <string>
# pragma warning ( pop )
#else
# include <string>
#endif
#if defined(TQ_WRONG_SB_CTYPE_MACROS) && defined(_SB_CTYPE_MACROS)
#undef _SB_CTYPE_MACROS
#endif
#endif
#ifdef USE_QT4
class TQCharRef;
class TQ_EXPORT TQChar : public QChar
{
public:
enum SpecialCharacter {
Null = Null,
Nbsp = Nbsp,
ReplacementCharacter = ReplacementCharacter,
ObjectReplacementCharacter = ObjectReplacementCharacter,
ByteOrderMark = ByteOrderMark,
ByteOrderSwapped = ByteOrderSwapped,
// null = Null,
// tqreplacement = ReplacementCharacter,
// byteOrderMark = ByteOrderMark,
// byteOrderSwapped = ByteOrderSwapped,
// nbsp = Nbsp,
ParagraphSeparator = ParagraphSeparator,
LineSeparator = LineSeparator
};
TQT_STATIC_CONST TQChar null;
TQT_STATIC_CONST TQChar tqreplacement;
TQT_STATIC_CONST TQChar byteOrderMark;
TQT_STATIC_CONST TQChar byteOrderSwapped;
TQT_STATIC_CONST TQChar nbsp;
TQChar() : QChar() {}
TQChar( char c ) : QChar( c ) {}
TQChar( uchar c ) : QChar( c ) {}
TQChar( uchar c, uchar r ) : QChar( c, r ) {}
TQChar( const QChar& c ) : QChar( c ) {}
TQChar( ushort rc ) : QChar( rc ) {}
TQChar( short rc ) : QChar( rc ) {}
TQChar( uint rc ) : QChar( rc ) {}
TQChar( int rc ) : QChar( rc ) {}
TQChar(TQChar::SpecialCharacter sc) : QChar( (QChar::SpecialCharacter)sc ) {}
inline TQChar lower() const { return toLower(); }
inline TQChar upper() const { return toUpper(); }
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
inline const char latin1() const { return toLatin1(); }
inline const char ascii() const { return toAscii(); }
#else
inline char latin1() const { return toLatin1(); }
inline char ascii() const { return toAscii(); }
#endif
#ifndef TQT_NO_CAST_ASCII
inline operator char() const { return latin1(); }
#endif
static inline bool networkOrdered() {
return QSysInfo::ByteOrder == QSysInfo::BigEndian;
}
inline TQChar &operator=( char ch ) { this->QChar::operator=(ch); return *this; }
inline ushort tqunicode() const { return unicode(); }
inline bool mirrored() const { return hasMirrored(); }
using QChar::operator=;
};
Q_DECLARE_METATYPE(TQChar)
inline bool operator==( char ch, QChar c ) { return (TQChar(ch) == c); }
inline bool operator==( QChar c, char ch ) { return (TQChar(ch) == c); }
inline bool operator!=( char ch, QChar c ) { return (TQChar(ch) != c); }
inline bool operator!=( QChar c, char ch ) { return (TQChar(ch) != c); }
inline bool operator==( int ch, QChar c ) { return (TQChar(ch) == c); }
inline bool operator==( QChar c, int ch ) { return (TQChar(ch) == c); }
inline bool operator!=( int ch, QChar c ) { return (TQChar(ch) == c); }
inline bool operator!=( QChar c, int ch ) { return (TQChar(ch) == c); }
class TQ_EXPORT TQString : public QString
{
public:
TQString() : QString() {}
TQString( QChar tc ) : QString( tc ) {}
TQString( const QString &ts ) : QString( ts ) {}
TQString( const QByteArray &ba ) : QString( ba ) { int slen = int(strlen(ba)); if (length() > slen) truncate(slen); }
TQString( const QChar* tqunicode, uint length ) : QString( tqunicode, length ) {}
#ifndef TQT_NO_CAST_ASCII
TQString( const char *str ) : QString( str ) {}
#endif
#ifndef TQT_NO_STL
TQString( const std::string &str ) : QString(str.c_str()) {}
#endif
int tqfind( QChar c, int index=0, bool cs=TRUE ) const { return indexOf(c, index, (Qt::CaseSensitivity)cs); }
int tqfind( char c, int index=0, bool cs=TRUE ) const { return indexOf(c, index, (Qt::CaseSensitivity)cs); }
int tqfind( const QString &str, int index=0, bool cs=TRUE ) const { return indexOf(str, index, (Qt::CaseSensitivity)cs); }
#ifndef TQT_NO_REGEXP
int tqfind( const QRegExp &qr, int index=0 ) const { return indexOf(qr, index); }
#endif
#ifndef TQT_NO_CAST_ASCII
int tqfind( const char* str, int index=0 ) const { return indexOf(str, index); }
#endif
int tqfindRev( QChar c, int index=-1, bool cs=TRUE) const { return lastIndexOf(c, index, (Qt::CaseSensitivity)cs); }
int tqfindRev( char c, int index=-1, bool cs=TRUE) const { return lastIndexOf(c, index, (Qt::CaseSensitivity)cs); }
int tqfindRev( const QString &str, int index=-1, bool cs=TRUE) const { return lastIndexOf(str, index, (Qt::CaseSensitivity)cs); }
#ifndef TQT_NO_REGEXP
int tqfindRev( const QRegExp &qr, int index=-1 ) const { return lastIndexOf(qr, index); }
#endif
#ifndef TQT_NO_CAST_ASCII
int tqfindRev( const char* str, int index=-1 ) const { return lastIndexOf(str, index); }
#endif
const char* latin1() const { return latin1_helper(); }
const char* ascii() const { return ascii_helper(); }
bool simpleText() const;
void checkSimpleText() const;
TQString copy() const;
inline TQString lower() const { return toLower(); }
inline TQString upper() const { return toUpper(); }
inline TQString stripWhiteSpace() const { return trimmed(); }
inline TQString simplifyWhiteSpace() const { return simplified(); }
inline TQString fill( TQChar c, int len = -1 ) { return QString::fill(c, len); }
// QString::Null compatibility
struct Null { };
static const Null null;
inline TQString(const Null &) : QString() {}
inline TQString &operator=(const Null &) { *this = TQString(); return *this; }
int tqcontains( QChar c, bool cs=TRUE ) const { return count(c, (Qt::CaseSensitivity)cs); }
int tqcontains( char c, bool cs=TRUE ) const { return tqcontains(TQChar(c), cs); }
#ifndef TQT_NO_CAST_ASCII
int tqcontains( const char* str, bool cs=TRUE ) const { return count(str, (Qt::CaseSensitivity)cs); }
#endif
int tqcontains( const QString &str, bool cs=TRUE ) const { return count(str, (Qt::CaseSensitivity)cs); }
#ifndef TQT_NO_REGEXP
int tqcontains( const QRegExp &re ) const { return count(re); }
#endif
#ifndef QT_NO_CAST_TO_ASCII
inline operator const char *() const { return ascii_helper(); }
#endif
inline bool tqstartsWith( const TQString& str ) const { return startsWith(str); }
inline bool tqstartsWith( const TQString& str, bool cs ) const { return startsWith(str, (cs)?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline bool tqendsWith( const TQString& str ) const { return endsWith(str); }
inline bool tqendsWith( const TQString& str, bool cs ) const { return endsWith(str, (cs)?Qt::CaseSensitive:Qt::CaseInsensitive); }
TQCString utf8() const;
inline TQChar constref(uint i) const { return tqat(i); }
inline TQString leftJustify(int width, QChar aFill = QLatin1Char(' '), bool trunc=false) const { return leftJustified(width, aFill, trunc); }
inline TQString rightJustify(int width, QChar aFill = QLatin1Char(' '), bool trunc=false) const { return rightJustified(width, aFill, trunc); }
inline const TQChar* tqunicode() const { if (length() > 0) return static_cast<const TQChar*>(unicode()); else return static_cast<const TQChar*>(QString().unicode()); }
TQCString local8Bit() const;
inline TQString tqreplace(int i, int len, QChar after) { return tqreplace( i, len, &after, 1 ); }
inline TQString tqreplace(int i, int len, const QChar *s, int slen) {
// Mimic the old (undocumented) behavior
int newindex = i;
if (newindex > length()) newindex = length();
return replace( newindex, len, s, slen );
}
inline TQString tqreplace(int i, int len, const QString &after) { return tqreplace( i, len, TQString(after).tqunicode(), after.length() ); }
inline TQString tqreplace(QChar before, QChar after, Qt::CaseSensitivity cs = Qt::CaseSensitive) { return replace( before, after, cs ); }
inline TQString tqreplace(const QChar *before, int blen, const QChar *after, int alen, Qt::CaseSensitivity cs = Qt::CaseSensitive) { return replace( before, blen, after, alen, cs ); }
inline TQString tqreplace(const QLatin1String &before, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive) { return replace( before, after, cs ); }
inline TQString tqreplace(const QLatin1String &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive) { return replace( before, after, cs ); }
inline TQString tqreplace(const QString &before, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive) { return replace( before, after, cs ); }
inline TQString tqreplace(const QString &before, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive) { return replace( before, after, cs ); }
inline TQString tqreplace(QChar c, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive) { return replace( c, after, cs ); }
inline TQString tqreplace(QChar c, const QLatin1String &after, Qt::CaseSensitivity cs = Qt::CaseSensitive) { return replace( c, after, cs ); }
#ifndef QT_NO_REGEXP
inline TQString tqreplace(const QRegExp &rx, const QString &after) { return replace( rx, after ); }
#endif
inline TQString tqreplace(const QString &before, const QString &after, bool cs) { return tqreplace(before, after, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline TQString tqsetNum( short a, int base=10 ) { return setNum(a, base); }
inline TQString tqsetNum( ushort a, int base=10 ) { return setNum(a, base); }
inline TQString tqsetNum( int a, int base=10 ) { return setNum(a, base); }
inline TQString tqsetNum( uint a, int base=10 ) { return setNum(a, base); }
inline TQString tqsetNum( long a, int base=10 ) { return setNum(a, base); }
inline TQString tqsetNum( ulong a, int base=10 ) { return setNum(a, base); }
inline TQString tqsetNum( TQ_LLONG a, int base=10 ) { return setNum(a, base); }
inline TQString tqsetNum( TQ_ULLONG a, int base=10 ) { return setNum(a, base); }
inline TQString tqsetNum( float a, char f='g', int prec=6 ) { return setNum(a, f, prec); }
inline TQString tqsetNum( double a, char f='g', int prec=6 ) { return setNum(a, f, prec); }
inline TQString remove( uint index, uint len ) { if (index<=((uint)length())) return QString::remove(index, len); return *this; }
inline TQString remove( const QString &qs ) { return QString::remove(qs); }
inline TQString remove( const QString &qs, bool cs ) { return QString::remove(qs, cs?Qt::CaseSensitive:Qt::CaseInsensitive); }
inline TQString remove( QChar c ) { return QString::remove(c); }
inline TQString remove( char c ) { return remove( QChar(c) ); }
#ifndef TQT_NO_CAST_ASCII
inline TQString remove( const char *ch ) { return QString::remove(ch); }
#endif
#ifndef TQT_NO_REGEXP
inline TQString remove( const QRegExp &re ) { return QString::remove(re); }
#endif
inline TQString section( TQChar sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const { return QString::section(sep, start, end, (QString::SectionFlags)flags); }
inline TQString section( char sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const { return QString::section(sep, start, end, (QString::SectionFlags)flags); }
#ifndef TQT_NO_CAST_ASCII
inline TQString section( const char *in_sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const { return QString::section(in_sep, start, end, (QString::SectionFlags)flags); }
#endif
inline TQString section( const QString in_sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const { return QString::section(in_sep, start, end, (QString::SectionFlags)flags); }
#ifndef TQT_NO_REGEXP
inline TQString section( const QRegExp reg, int start, int end = 0xffffffff, int flags = SectionDefault ) const { return QString::section(reg, start, end, (QString::SectionFlags)flags); }
#endif
inline static TQString fromUcs2(const ushort *unicode, int size = -1) { return fromUtf16(unicode, size); }
inline const unsigned short *ucs2() const { return utf16(); }
inline TQString left( uint len ) const { return TQString(QString::left(len)); }
inline TQString right( uint len ) const { return TQString(QString::right(len)); }
inline TQString mid( uint index, uint len=0xffffffff) const { return TQString(QString::mid(index, len)); }
inline static TQString number( long n, int base=10 ) { return TQString(QString::number(n, base)); }
inline static TQString number( ulong n, int base=10) { return TQString(QString::number(n, base)); }
inline static TQString number( TQ_LLONG n, int base=10 ) { return TQString(QString::number(n, base)); }
inline static TQString number( TQ_ULLONG n, int base=10) { return TQString(QString::number(n, base)); }
inline static TQString number( int n, int base=10 ) { return TQString(QString::number(n, base)); }
inline static TQString number( uint n, int base=10) { return TQString(QString::number(n, base)); }
inline static TQString number( double n, char f='g', int prec=6 ) { return TQString(QString::number(n, f, prec)); }
TQString &setAscii( const char*, int len=-1 );
TQString &setLatin1( const char *ch, int len=-1 );
// inline TQString tqarg( long a, int fieldWidth = 0, int base = 10 ) const { return TQString(this->arg(a, fieldWidth, base)); }
// inline TQString tqarg( ulong a, int fieldWidth = 0, int base = 10 ) const { return TQString(this->arg(a, fieldWidth, base)); }
// inline TQString tqarg( TQ_LLONG a, int fieldwidth=0, int base=10 ) const { return TQString(this->arg(a, fieldwidth, base)); }
// inline TQString tqarg( TQ_ULLONG a, int fieldwidth=0, int base=10 ) const { return TQString(this->arg(a, fieldwidth, base)); }
// inline TQString tqarg( int a, int fieldWidth = 0, int base = 10 ) const { return TQString(this->arg(a, fieldWidth, base)); }
// inline TQString tqarg( uint a, int fieldWidth = 0, int base = 10 ) const { return TQString(this->arg(a, fieldWidth, base)); }
// inline TQString tqarg( short a, int fieldWidth = 0, int base = 10 ) const { return TQString(this->arg(a, fieldWidth, base)); }
// inline TQString tqarg( ushort a, int fieldWidth = 0, int base = 10 ) const { return TQString(this->arg(a, fieldWidth, base)); }
// inline TQString tqarg( double a, int fieldWidth = 0, char fmt = 'g', int prec = -1 ) const { return TQString(this->arg(a, fieldWidth, fmt, prec)); }
// inline TQString tqarg( char a, int fieldWidth = 0 ) const { return TQString(this->arg(a, fieldWidth)); }
// inline TQString tqarg( TQChar a, int fieldWidth = 0 ) const { return TQString(this->arg(a, fieldWidth)); }
// inline TQString tqarg( const TQString& a, int fieldWidth = 0 ) const { return TQString(this->arg(a, fieldWidth)); }
// inline TQString tqarg( const TQString& a1, const TQString& a2 ) const { return TQString(this->arg(a1, a2)); }
// inline TQString tqarg( const TQString& a1, const TQString& a2, const TQString& a3 ) const { return TQString(this->arg(a1, a2, a3)); }
// inline TQString tqarg( const TQString& a1, const TQString& a2, const TQString& a3, const TQString& a4 ) const { return TQString(this->arg(a1, a2, a3, a4)); }
TQString tqarg( long a, int fieldWidth = 0, int base = 10 ) const;
TQString tqarg( ulong a, int fieldWidth = 0, int base = 10 ) const;
TQString tqarg( TQ_LLONG a, int fieldwidth=0, int base=10 ) const;
TQString tqarg( TQ_ULLONG a, int fieldwidth=0, int base=10 ) const;
TQString tqarg( int a, int fieldWidth = 0, int base = 10 ) const;
TQString tqarg( uint a, int fieldWidth = 0, int base = 10 ) const;
TQString tqarg( short a, int fieldWidth = 0, int base = 10 ) const;
TQString tqarg( ushort a, int fieldWidth = 0, int base = 10 ) const;
TQString tqarg( double a, int fieldWidth = 0, char fmt = 'g', int prec = -1 ) const;
TQString tqarg( char a, int fieldWidth = 0 ) const;
TQString tqarg( TQChar a, int fieldWidth = 0 ) const;
TQString tqarg( const TQString& a, int fieldWidth = 0 ) const;
TQString tqarg( const TQString& a1, const TQString& a2 ) const;
TQString tqarg( const TQString& a1, const TQString& a2, const TQString& a3 ) const;
TQString tqarg( const TQString& a1, const TQString& a2, const TQString& a3, const TQString& a4 ) const;
TQString setUnicodeCodes( const ushort* tqunicode_as_ushorts, uint len );
inline void setLength(int nl) { resize(nl); }
TQCharRef tqat( uint i );
TQCharRef operator[]( int i );
static TQString fromLatin1(const char *ch, int len=-1);
static inline TQString tqfromLatin1(const char *ch, int len=-1) { return fromLatin1(ch, len); }
static TQString fromUtf8(const char*, int len=-1);
// FIXME
inline void compose() { /*printf("[FIXME] void TQString::compose() unimplemented\n\r");*/ }
TQChar tqat( uint i ) const { return i < (uint)length() ? unicode()[i] : TQChar::null; }
TQChar operator[]( int i ) const { if ((i<0) || (i>=length())) return TQChar::null; else return tqat((uint)i); }
// TQChar constref(uint i) const { return tqat(i); }
QChar& ref(uint i);
// inline QChar ref(uint i) { return (*this)[i]; }
TQString &operator+=( const TQString &str );
#ifndef TQT_NO_CAST_ASCII
TQString &operator+=( const TQByteArray &str );
TQString &operator+=( const char *str );
#endif
#ifndef TQT_NO_CAST_ASCII
TQString &operator+=( const std::string& );
#endif
TQString &operator+=( TQChar c );
TQString &operator+=( char c );
TQString &operator+=( const QStringRef &s);
TQString &operator+=( const QLatin1String &s);
TQString &operator+=( QChar c );
using QString::operator=;
friend class TQObject;
friend class TQWidget;
friend class TQStyle;
protected:
const char *ascii_helper() const;
const char *latin1_helper() const;
public:
static char* tqunicodeToLatin1( const TQChar*, uint len );
private:
mutable QByteArray tqstring_ascii_ba;
mutable QByteArray tqstring_latin1_ba;
mutable bool tqstring_issimpletext;
private:
#ifndef TQT_NO_CAST_ASCII
// TQString &insertHelper( uint index, const char *s, uint len=UINT_MAX );
TQString &operatorPlusEqHelper( const char *s, uint len2=UINT_MAX );
#endif
private:
void subat( uint );
TQString tqmultiArg( int numArgs, const TQString& a1, const TQString& a2, const TQString& a3 = TQString(), const TQString& a4 = TQString() ) const;
public:
// Interoperability
static const TQString& convertFromQString( QString& qstr );
};
Q_DECLARE_METATYPE(TQString)
// Interoperability
inline static const TQString& convertFromQString( const QString& qstr ) {
return (*static_cast<const TQString*>(&qstr));
}
inline TQString TQString::tqarg( int a, int fieldWidth, int base ) const { return tqarg( (TQ_LLONG)a, fieldWidth, base ); }
inline TQString TQString::tqarg( uint a, int fieldWidth, int base ) const { return tqarg( (TQ_ULLONG)a, fieldWidth, base ); }
inline TQString TQString::tqarg( short a, int fieldWidth, int base ) const { return tqarg( (TQ_LLONG)a, fieldWidth, base ); }
inline TQString TQString::tqarg( ushort a, int fieldWidth, int base ) const { return tqarg( (TQ_ULLONG)a, fieldWidth, base ); }
inline TQString TQString::tqarg( const TQString& a1, const TQString& a2 ) const { return tqmultiArg( 2, a1, a2 ); }
inline TQString TQString::tqarg( const TQString& a1, const TQString& a2, const TQString& a3 ) const { return tqmultiArg( 3, a1, a2, a3 ); }
inline TQString TQString::tqarg( const TQString& a1, const TQString& a2, const TQString& a3, const TQString& a4 ) const { return tqmultiArg( 4, a1, a2, a3, a4 ); }
inline TQString TQString::copy() const { return TQString( *this ); }
inline bool operator==(TQString::Null, TQString::Null) { return true; }
inline bool operator==(TQString::Null, const TQString &s) { return s.isNull(); }
inline bool operator==(const TQString &s, TQString::Null) { return s.isNull(); }
inline bool operator!=(TQString::Null, TQString::Null) { return false; }
inline bool operator!=(TQString::Null, const TQString &s) { return !s.isNull(); }
inline bool operator!=(const TQString &s, TQString::Null) { return !s.isNull(); }
#ifndef TQT_NO_CAST_ASCII
inline TQString &TQString::operator+=( const TQByteArray &s )
{
int pos = s.tqfind( 0 );
return operatorPlusEqHelper( s, pos==-1 ? s.size() : pos );
}
#endif
#ifndef TQT_NO_CAST_ASCII
inline TQString &TQString::operator+=( const std::string& s )
{ return operator+=(s.c_str()); }
#endif
// [FIXME] The following operator+ functions spew a ridiculous number of (harmless) warnings
// due to the very similar QString operator+ functions. Can this be fixed???
TQ_EXPORT inline const TQString operator+( const TQString &s1, const TQString &s2 )
{
TQString tmp( s1 );
tmp += s2;
return tmp;
}
#ifndef TQT_NO_CAST_ASCII
TQ_EXPORT inline const TQString operator+( const TQString &s1, const char *s2 )
{
TQString tmp( s1 );
tmp += TQString::fromAscii(s2);
return tmp;
}
TQ_EXPORT inline const TQString operator+( const char *s1, const TQString &s2 )
{
TQString tmp = TQString::fromAscii( s1 );
tmp += s2;
return tmp;
}
#endif
TQ_EXPORT inline const TQString operator+( const TQString &s1, TQChar c2 )
{
TQString tmp( s1 );
tmp += c2;
return tmp;
}
TQ_EXPORT inline const TQString operator+( const TQString &s1, char c2 )
{
TQString tmp( s1 );
tmp += c2;
return tmp;
}
TQ_EXPORT inline const TQString operator+( TQChar c1, const TQString &s2 )
{
TQString tmp;
tmp += c1;
tmp += s2;
return tmp;
}
TQ_EXPORT inline const TQString operator+( char c1, const TQString &s2 )
{
TQString tmp;
tmp += c1;
tmp += s2;
return tmp;
}
#ifndef TQT_NO_STL
TQ_EXPORT inline const TQString operator+(const TQString& s1, const std::string& s2)
{
return s1 + TQString(s2);
}
TQ_EXPORT inline const TQString operator+(const std::string& s1, const TQString& s2)
{
TQString tmp(s2);
return TQString(tmp.prepend(s1.c_str()));
}
#endif
class TQConstString : public TQString
{
public:
inline TQConstString(const QChar *aUnicode, int aSize) : TQString(aUnicode, aSize) {} // cannot use fromRawData() due to changed semantics
inline const TQString &string() const { return *this; }
};
class TQ_EXPORT TQCharRef {
friend class TQString;
TQString& s;
uint p;
TQCharRef(TQString* str, uint pos) : s(*str), p(pos) { }
public:
// most TQChar operations repeated here
// all this is not documented: We just say "like TQChar" and let it be.
#ifndef TQ_TQDOC
ushort unicode() const { return s.constref(p).tqunicode(); }
ushort tqunicode() const { return s.constref(p).tqunicode(); }
char latin1() const { return s.constref(p).latin1(); }
// An operator= for each TQChar cast constructors
TQCharRef operator=(char c ) { s.ref(p)=c; return *this; }
TQCharRef operator=(uchar c ) { s.ref(p)=c; return *this; }
TQCharRef operator=(TQChar c ) { s.ref(p)=c; return *this; }
TQCharRef operator=(const TQCharRef& c ) { s.ref(p)=c.tqunicode(); return *this; }
TQCharRef operator=(ushort rc ) { s.ref(p)=rc; return *this; }
TQCharRef operator=(short rc ) { s.ref(p)=rc; return *this; }
TQCharRef operator=(uint rc ) { s.ref(p)=rc; return *this; }
TQCharRef operator=(int rc ) { s.ref(p)=rc; return *this; }
operator TQChar () const { return s.constref(p); }
// each function...
bool isNull() const { return tqunicode()==0; }
bool isPrint() const { return s.constref(p).isPrint(); }
bool isPunct() const { return s.constref(p).isPunct(); }
bool isSpace() const { return s.constref(p).isSpace(); }
bool isMark() const { return s.constref(p).isMark(); }
bool isLetter() const { return s.constref(p).isLetter(); }
bool isNumber() const { return s.constref(p).isNumber(); }
bool isLetterOrNumber() { return s.constref(p).isLetterOrNumber(); }
bool isDigit() const { return s.constref(p).isDigit(); }
int digitValue() const { return s.constref(p).digitValue(); }
TQChar lower() const { return s.constref(p).lower(); }
TQChar upper() const { return s.constref(p).upper(); }
TQChar::Category category() const { return s.constref(p).category(); }
TQChar::Direction direction() const { return s.constref(p).direction(); }
TQChar::Joining joining() const { return s.constref(p).joining(); }
bool mirrored() const { return s.constref(p).mirrored(); }
TQChar mirroredChar() const { return s.constref(p).mirroredChar(); }
// const TQString &decomposition() const { return s.constref(p).decomposition(); }
TQChar::Decomposition decompositionTag() const { return s.constref(p).decompositionTag(); }
unsigned char combiningClass() const { return s.constref(p).combiningClass(); }
// Not the non-const ones of these.
uchar cell() const { return s.constref(p).cell(); }
uchar row() const { return s.constref(p).row(); }
#endif
};
// inline TQChar& TQString::ref(uint i)
inline QChar& TQString::ref(uint i)
{ // Optimized for easy-inlining by simple compilers.
if ( count() != 1 || i >= (uint)length() )
subat( i );
// d->setDirty();
// return tqunicode()[i];
// const QCharRef& ref = QString::operator[](i);
// return *const_cast<TQChar*>(static_cast<const TQChar*>(&reinterpret_cast<const QChar&>(ref))); // [FIXME] Will this work the same as data->unicode did in Qt3? Will it work at all???
QChar *tdata = data();
return tdata[i]; // [FIXME] Will this work the same as data->unicode did in Qt3? Will it work at all???
}
inline TQCharRef TQString::tqat( uint i ) { return TQCharRef(this,i); }
inline TQCharRef TQString::operator[]( int i ) { return tqat((uint)i); }
/*****************************************************************************
TQString stream functions
*****************************************************************************/
#ifndef TQT_NO_DATASTREAM
TQ_EXPORT TQDataStream &operator<<( TQDataStream &, const TQString & );
TQ_EXPORT TQDataStream &operator>>( TQDataStream &, TQString & );
#endif
/*****************************************************************************
TQString non-member operators
*****************************************************************************/
inline TQ_EXPORT bool operator!=( const TQString &s1, const TQString &s2 ) {
if (s1.isNull() != s2.isNull()) return true;
return (static_cast<const QString&>(s1) != static_cast<const QString&>(s2));
}
inline TQ_EXPORT bool operator==( const TQString &s1, const TQString &s2 ) {
if (s1.isNull() != s2.isNull()) return false;
return (static_cast<const QString&>(s1) == static_cast<const QString&>(s2));
}
#else // USE_QT4
/*****************************************************************************
TQString class
*****************************************************************************/
class TQRegExp;
class TQString;
class TQCharRef;
template <class T> class TQDeepCopy;
class TQ_EXPORT TQChar {
public:
TQChar();
TQChar( char c );
TQChar( uchar c );
TQChar( uchar c, uchar r );
TQChar( const TQChar& c ); // ### remove in 4.0 to allow compiler optimization
TQChar( ushort rc );
TQChar( short rc );
TQChar( uint rc );
TQChar( int rc );
TQT_STATIC_CONST TQChar null; // 0000
TQT_STATIC_CONST TQChar tqreplacement; // FFFD
TQT_STATIC_CONST TQChar byteOrderMark; // FEFF
TQT_STATIC_CONST TQChar byteOrderSwapped; // FFFE
TQT_STATIC_CONST TQChar nbsp; // 00A0
// Unicode information
enum Category
{
NoCategory,
Mark_NonSpacing, // Mn
Mark_SpacingCombining, // Mc
Mark_Enclosing, // Me
Number_DecimalDigit, // Nd
Number_Letter, // Nl
Number_Other, // No
Separator_Space, // Zs
Separator_Line, // Zl
Separator_Paragraph, // Zp
Other_Control, // Cc
Other_Format, // Cf
Other_Surrogate, // Cs
Other_PrivateUse, // Co
Other_NotAssigned, // Cn
Letter_Uppercase, // Lu
Letter_Lowercase, // Ll
Letter_Titlecase, // Lt
Letter_Modifier, // Lm
Letter_Other, // Lo
Punctuation_Connector, // Pc
Punctuation_Dash, // Pd
Punctuation_Dask = Punctuation_Dash, // oops
Punctuation_Open, // Ps
Punctuation_Close, // Pe
Punctuation_InitialQuote, // Pi
Punctuation_FinalQuote, // Pf
Punctuation_Other, // Po
Symbol_Math, // Sm
Symbol_Currency, // Sc
Symbol_Modifier, // Sk
Symbol_Other // So
};
enum Direction
{
DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON,
DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN
};
enum Decomposition
{
Single, Canonical, Font, NoBreak, Initial, Medial,
Final, Isolated, Circle, Super, Sub, Vertical,
Wide, Narrow, Small, Square, Compat, Fraction
};
enum Joining
{
OtherJoining, Dual, Right, Center
};
enum CombiningClass
{
Combining_BelowLeftAttached = 200,
Combining_BelowAttached = 202,
Combining_BelowRightAttached = 204,
Combining_LeftAttached = 208,
Combining_RightAttached = 210,
Combining_AboveLeftAttached = 212,
Combining_AboveAttached = 214,
Combining_AboveRightAttached = 216,
Combining_BelowLeft = 218,
Combining_Below = 220,
Combining_BelowRight = 222,
Combining_Left = 224,
Combining_Right = 226,
Combining_AboveLeft = 228,
Combining_Above = 230,
Combining_AboveRight = 232,
Combining_DoubleBelow = 233,
Combining_DoubleAbove = 234,
Combining_IotaSubscript = 240
};
// ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO TQCharRef TOO
int digitValue() const;
TQChar lower() const;
TQChar upper() const;
Category category() const;
Direction direction() const;
Joining joining() const;
bool mirrored() const;
TQChar mirroredChar() const;
const TQString &decomposition() const; // ### return just TQString in 4.0
Decomposition decompositionTag() const;
unsigned char combiningClass() const;
char latin1() const { return ucs > 0xff ? 0 : (char) ucs; }
ushort tqunicode() const { return ucs; }
#ifdef TQ_NO_PACKED_REFERENCE
ushort &tqunicode() { return *((ushort*)&ucs); }
#else
ushort &tqunicode() { return ucs; }
#endif
#ifndef TQT_NO_CAST_ASCII
// like all ifdef'd code this is undocumented
operator char() const { return latin1(); }
#endif
bool isNull() const { return tqunicode()==0; }
bool isPrint() const;
bool isPunct() const;
bool isSpace() const;
bool isMark() const;
bool isLetter() const;
bool isNumber() const;
bool isLetterOrNumber() const;
bool isDigit() const;
bool isSymbol() const;
uchar cell() const { return ((uchar) ucs & 0xff); }
uchar row() const { return ((uchar) (ucs>>8)&0xff); }
void setCell( uchar cell ) { ucs = (ucs & 0xff00) + cell; }
void setRow( uchar row ) { ucs = (((ushort) row)<<8) + (ucs&0xff); }
static bool networkOrdered() {
int wordSize;
bool bigEndian = FALSE;
qSysInfo( &wordSize, &bigEndian );
return bigEndian;
}
friend inline bool operator==( char ch, TQChar c );
friend inline bool operator==( TQChar c, char ch );
friend inline bool operator==( TQChar c1, TQChar c2 );
friend inline bool operator!=( TQChar c1, TQChar c2 );
friend inline bool operator!=( char ch, TQChar c );
friend inline bool operator!=( TQChar c, char ch );
friend inline bool operator<=( TQChar c, char ch );
friend inline bool operator<=( char ch, TQChar c );
friend inline bool operator<=( TQChar c1, TQChar c2 );
private:
ushort ucs;
#if defined(TQT_TQSTRING_UCS_4)
ushort grp;
#endif
} TQ_PACKED;
inline TQChar::TQChar() : ucs( 0 )
#ifdef TQT_TQSTRING_UCS_4
, grp( 0 )
#endif
{
}
inline TQChar::TQChar( char c ) : ucs( (uchar)c )
#ifdef TQT_TQSTRING_UCS_4
, grp( 0 )
#endif
{
}
inline TQChar::TQChar( uchar c ) : ucs( c )
#ifdef TQT_TQSTRING_UCS_4
, grp( 0 )
#endif
{
}
inline TQChar::TQChar( uchar c, uchar r ) : ucs( (r << 8) | c )
#ifdef TQT_TQSTRING_UCS_4
, grp( 0 )
#endif
{
}
inline TQChar::TQChar( const TQChar& c ) : ucs( c.ucs )
#ifdef TQT_TQSTRING_UCS_4
, grp( c.grp )
#endif
{
}
inline TQChar::TQChar( ushort rc ) : ucs( rc )
#ifdef TQT_TQSTRING_UCS_4
, grp( 0 )
#endif
{
}
inline TQChar::TQChar( short rc ) : ucs( (ushort) rc )
#ifdef TQT_TQSTRING_UCS_4
, grp( 0 )
#endif
{
}
inline TQChar::TQChar( uint rc ) : ucs( (ushort ) (rc & 0xffff) )
#ifdef TQT_TQSTRING_UCS_4
, grp( (ushort) ((rc >> 16) & 0xffff) )
#endif
{
}
inline TQChar::TQChar( int rc ) : ucs( (ushort) (rc & 0xffff) )
#ifdef TQT_TQSTRING_UCS_4
, grp( (ushort) ((rc >> 16) & 0xffff) )
#endif
{
}
inline bool operator==( char ch, TQChar c )
{
return ((uchar) ch) == c.ucs;
}
inline bool operator==( TQChar c, char ch )
{
return ((uchar) ch) == c.ucs;
}
inline bool operator==( TQChar c1, TQChar c2 )
{
return c1.ucs == c2.ucs;
}
inline bool operator!=( TQChar c1, TQChar c2 )
{
return c1.ucs != c2.ucs;
}
inline bool operator!=( char ch, TQChar c )
{
return ((uchar)ch) != c.ucs;
}
inline bool operator!=( TQChar c, char ch )
{
return ((uchar) ch) != c.ucs;
}
inline bool operator<=( TQChar c, char ch )
{
return c.ucs <= ((uchar) ch);
}
inline bool operator<=( char ch, TQChar c )
{
return ((uchar) ch) <= c.ucs;
}
inline bool operator<=( TQChar c1, TQChar c2 )
{
return c1.ucs <= c2.ucs;
}
inline bool operator>=( TQChar c, char ch ) { return ch <= c; }
inline bool operator>=( char ch, TQChar c ) { return c <= ch; }
inline bool operator>=( TQChar c1, TQChar c2 ) { return c2 <= c1; }
inline bool operator<( TQChar c, char ch ) { return !(ch<=c); }
inline bool operator<( char ch, TQChar c ) { return !(c<=ch); }
inline bool operator<( TQChar c1, TQChar c2 ) { return !(c2<=c1); }
inline bool operator>( TQChar c, char ch ) { return !(ch>=c); }
inline bool operator>( char ch, TQChar c ) { return !(c>=ch); }
inline bool operator>( TQChar c1, TQChar c2 ) { return !(c2>=c1); }
// internal
struct TQ_EXPORT TQStringData : public TQShared {
TQStringData() :
TQShared(), tqunicode(0), ascii(0), len(0), issimpletext(TRUE), maxl(0), islatin1(FALSE) { ref(); }
TQStringData(TQChar *u, uint l, uint m) :
TQShared(), tqunicode(u), ascii(0), len(l), issimpletext(FALSE), maxl(m), islatin1(FALSE) { }
~TQStringData() { if ( tqunicode ) delete[] ((char*)tqunicode);
if ( ascii ) delete[] ascii; }
void deleteSelf();
TQChar *tqunicode;
char *ascii;
void setDirty() {
if ( ascii ) {
delete [] ascii;
ascii = 0;
}
issimpletext = FALSE;
}
#ifdef TQ_OS_MAC9
uint len;
#else
uint len : 30;
#endif
uint issimpletext : 1;
#ifdef TQ_OS_MAC9
uint maxl;
#else
uint maxl : 30;
#endif
uint islatin1 : 1;
private:
#if defined(TQ_DISABLE_COPY)
TQStringData( const TQStringData& );
TQStringData& operator=( const TQStringData& );
#endif
};
class TQ_EXPORT TQString
{
public:
TQString(); // make null string
TQString( TQChar ); // one-char string
TQString( const TQString & ); // impl-shared copy
TQString( const TQByteArray& ); // deep copy
TQString( const TQChar* tqunicode, uint length ); // deep copy
#ifndef TQT_NO_CAST_ASCII
TQString( const char *str ); // deep copy
#endif
#ifndef TQT_NO_STL
TQString( const std::string& ); // deep copy
#endif
~TQString();
#ifdef USE_QT4
// Interoperability
TQString( const QString &qs );
operator QString() const;
TQString &operator=( const QString &qs );
#endif // USE_QT4
TQString &operator=( const TQString & ); // impl-shared copy
TQString &operator=( const char * ); // deep copy
#ifndef TQT_NO_STL
TQString &operator=( const std::string& ); // deep copy
#endif
TQString &operator=( const TQCString& ); // deep copy
TQString &operator=( TQChar c );
TQString &operator=( char c );
TQT_STATIC_CONST TQString null;
bool isNull() const;
bool isEmpty() const;
uint length() const;
void truncate( uint pos );
TQString & fill( TQChar c, int len = -1 );
TQString copy() const;
TQString arg( long a, int fieldWidth = 0, int base = 10 ) const;
TQString arg( ulong a, int fieldWidth = 0, int base = 10 ) const;
TQString arg( TQ_LLONG a, int fieldwidth=0, int base=10 ) const;
TQString arg( TQ_ULLONG a, int fieldwidth=0, int base=10 ) const;
TQString arg( int a, int fieldWidth = 0, int base = 10 ) const;
TQString arg( uint a, int fieldWidth = 0, int base = 10 ) const;
TQString arg( short a, int fieldWidth = 0, int base = 10 ) const;
TQString arg( ushort a, int fieldWidth = 0, int base = 10 ) const;
TQString arg( double a, int fieldWidth = 0, char fmt = 'g',
int prec = -1 ) const;
TQString arg( char a, int fieldWidth = 0 ) const;
TQString arg( TQChar a, int fieldWidth = 0 ) const;
TQString arg( const TQString& a, int fieldWidth = 0 ) const;
TQString arg( const TQString& a1, const TQString& a2 ) const;
TQString arg( const TQString& a1, const TQString& a2,
const TQString& a3 ) const;
TQString arg( const TQString& a1, const TQString& a2, const TQString& a3,
const TQString& a4 ) const;
#ifndef TQT_NO_SPRINTF
TQString &sprintf( const char* format, ... )
#if defined(TQ_CC_GNU) && !defined(__INSURE__)
__attribute__ ((format (printf, 2, 3)))
#endif
;
#endif
int tqfind( TQChar c, int index=0, bool cs=TRUE ) const;
int tqfind( char c, int index=0, bool cs=TRUE ) const;
int tqfind( const TQString &str, int index=0, bool cs=TRUE ) const;
#ifndef TQT_NO_REGEXP
int tqfind( const TQRegExp &, int index=0 ) const;
#endif
#ifndef TQT_NO_CAST_ASCII
int tqfind( const char* str, int index=0 ) const;
#endif
int tqfindRev( TQChar c, int index=-1, bool cs=TRUE) const;
int tqfindRev( char c, int index=-1, bool cs=TRUE) const;
int tqfindRev( const TQString &str, int index=-1, bool cs=TRUE) const;
#ifndef TQT_NO_REGEXP
int tqfindRev( const TQRegExp &, int index=-1 ) const;
#endif
#ifndef TQT_NO_CAST_ASCII
int tqfindRev( const char* str, int index=-1 ) const;
#endif
int tqcontains( TQChar c, bool cs=TRUE ) const;
int tqcontains( char c, bool cs=TRUE ) const
{ return tqcontains(TQChar(c), cs); }
#ifndef TQT_NO_CAST_ASCII
int tqcontains( const char* str, bool cs=TRUE ) const;
#endif
int tqcontains( const TQString &str, bool cs=TRUE ) const;
#ifndef TQT_NO_REGEXP
int tqcontains( const TQRegExp & ) const;
#endif
enum SectionFlags {
SectionDefault = 0x00,
SectionSkipEmpty = 0x01,
SectionIncludeLeadingSep = 0x02,
SectionIncludeTrailingSep = 0x04,
SectionCaseInsensitiveSeps = 0x08
};
TQString section( TQChar sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const;
TQString section( char sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const;
#ifndef TQT_NO_CAST_ASCII
TQString section( const char *in_sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const;
#endif
TQString section( const TQString &in_sep, int start, int end = 0xffffffff, int flags = SectionDefault ) const;
#ifndef TQT_NO_REGEXP
TQString section( const TQRegExp ®, int start, int end = 0xffffffff, int flags = SectionDefault ) const;
#endif
TQString left( uint len ) const;
TQString right( uint len ) const;
TQString mid( uint index, uint len=0xffffffff) const;
TQString leftJustify( uint width, TQChar fill=' ', bool trunc=FALSE)const;
TQString rightJustify( uint width, TQChar fill=' ',bool trunc=FALSE)const;
TQString lower() const;
TQString upper() const;
TQString stripWhiteSpace() const;
TQString simplifyWhiteSpace() const;
TQString &insert( uint index, const TQString & );
#ifndef TQT_NO_CAST_ASCII
TQString &insert( uint index, const TQByteArray & );
TQString &insert( uint index, const char * );
#endif
TQString &insert( uint index, const TQChar*, uint len );
TQString &insert( uint index, TQChar );
TQString &insert( uint index, char c ) { return insert(index,TQChar(c)); }
TQString &append( char );
TQString &append( TQChar );
TQString &append( const TQString & );
#ifndef TQT_NO_CAST_ASCII
TQString &append( const TQByteArray & );
TQString &append( const char * );
#endif
#if !defined(TQT_NO_STL) && !defined(TQT_NO_CAST_ASCII)
TQString &append( const std::string& );
#endif
TQString &prepend( char );
TQString &prepend( TQChar );
TQString &prepend( const TQString & );
#ifndef TQT_NO_CAST_ASCII
TQString &prepend( const TQByteArray & );
TQString &prepend( const char * );
#endif
#if !defined(TQT_NO_STL) && !defined(TQT_NO_CAST_ASCII)
TQString &prepend( const std::string& );
#endif
TQString &remove( uint index, uint len );
#if defined(TQ_TQDOC)
TQString &remove( const TQString & str, bool cs = TRUE );
#else
// ### TQt 4.0: merge these two into one, and remove TQ_TQDOC hack
TQString &remove( const TQString & );
TQString &remove( const TQString &, bool cs );
#endif
TQString &remove( TQChar c );
TQString &remove( char c )
{ return remove( TQChar(c) ); }
#ifndef TQT_NO_CAST_ASCII
TQString &remove( const char * );
#endif
#ifndef TQT_NO_REGEXP
TQString &remove( const TQRegExp & );
#endif
TQString &tqreplace( uint index, uint len, const TQString & );
TQString &tqreplace( uint index, uint len, const TQChar*, uint clen );
TQString &tqreplace( uint index, uint len, TQChar );
TQString &tqreplace( uint index, uint len, char c )
{ return tqreplace( index, len, TQChar(c) ); }
#if defined(TQ_TQDOC)
TQString &tqreplace( TQChar c, const TQString & after, bool cs = TRUE );
TQString &tqreplace( char c, const TQString & after, bool cs = TRUE );
TQString &tqreplace( const TQString & before, const TQString & after,
bool cs = TRUE );
#else
// ### TQt 4.0: merge these two into one, and remove TQ_TQDOC hack
TQString &tqreplace( TQChar c, const TQString & );
TQString &tqreplace( TQChar c, const TQString &, bool );
// ### TQt 4.0: merge these two into one, and remove TQ_TQDOC hack
TQString &tqreplace( char c, const TQString & after )
{ return tqreplace( TQChar(c), after, TRUE ); }
TQString &tqreplace( char c, const TQString & after, bool cs )
{ return tqreplace( TQChar(c), after, cs ); }
// ### TQt 4.0: merge these two into one, and remove TQ_TQDOC hack
TQString &tqreplace( const TQString &, const TQString & );
TQString &tqreplace( const TQString &, const TQString &, bool );
#endif
#ifndef TQT_NO_REGEXP_CAPTURE
TQString &tqreplace( const TQRegExp &, const TQString & );
#endif
TQString &tqreplace( TQChar, TQChar );
short toShort( bool *ok=0, int base=10 ) const;
ushort toUShort( bool *ok=0, int base=10 ) const;
int toInt( bool *ok=0, int base=10 ) const;
uint toUInt( bool *ok=0, int base=10 ) const;
long toLong( bool *ok=0, int base=10 ) const;
ulong toULong( bool *ok=0, int base=10 ) const;
TQ_LLONG toLongLong( bool *ok=0, int base=10 ) const;
TQ_ULLONG toULongLong( bool *ok=0, int base=10 ) const;
float toFloat( bool *ok=0 ) const;
double toDouble( bool *ok=0 ) const;
TQString &setNum( short, int base=10 );
TQString &setNum( ushort, int base=10 );
TQString &setNum( int, int base=10 );
TQString &setNum( uint, int base=10 );
TQString &setNum( long, int base=10 );
TQString &setNum( ulong, int base=10 );
TQString &setNum( TQ_LLONG, int base=10 );
TQString &setNum( TQ_ULLONG, int base=10 );
TQString &setNum( float, char f='g', int prec=6 );
TQString &setNum( double, char f='g', int prec=6 );
static TQString number( long, int base=10 );
static TQString number( ulong, int base=10);
static TQString number( TQ_LLONG, int base=10 );
static TQString number( TQ_ULLONG, int base=10);
static TQString number( int, int base=10 );
static TQString number( uint, int base=10);
static TQString number( double, char f='g', int prec=6 );
void setExpand( uint index, TQChar c );
TQString &operator+=( const TQString &str );
#ifndef TQT_NO_CAST_ASCII
TQString &operator+=( const TQByteArray &str );
TQString &operator+=( const char *str );
#endif
#if !defined(TQT_NO_STL) && !defined(TQT_NO_CAST_ASCII)
TQString &operator+=( const std::string& );
#endif
TQString &operator+=( TQChar c );
TQString &operator+=( char c );
TQChar at( uint i ) const
{ return i < d->len ? d->tqunicode[i] : TQChar::null; }
TQChar operator[]( int i ) const { if ((i<0) || (i>=length())) return TQChar::null; else return at((uint)i); }
TQCharRef at( uint i );
TQCharRef operator[]( int i );
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->tqunicode[i];
}
const TQChar* tqunicode() const { return d->tqunicode; }
const char* ascii() const;
static TQString fromAscii(const char*, int len=-1);
const char* latin1() const;
static TQString tqfromLatin1(const char*, int len=-1);
TQCString utf8() const;
static TQString fromUtf8(const char*, int len=-1);
TQCString local8Bit() const;
static TQString fromLocal8Bit(const char*, int len=-1);
bool operator!() const;
#ifndef TQT_NO_ASCII_CAST
operator const char *() const { return ascii(); }
#endif
#ifndef TQT_NO_STL
operator std::string() const { return ascii() ? ascii() : ""; }
#endif
static TQString fromUcs2( const unsigned short *ucs2 );
const unsigned short *ucs2() const;
TQString &setUnicode( const TQChar* tqunicode, uint len );
TQString &setUnicodeCodes( const ushort* tqunicode_as_ushorts, uint len );
TQString &setAscii( const char*, int len=-1 );
TQString &setLatin1( const char*, int len=-1 );
int compare( const TQString& s ) const;
static int compare( const TQString& s1, const TQString& s2 )
{ return s1.compare( s2 ); }
int localeAwareCompare( const TQString& s ) const;
static int localeAwareCompare( const TQString& s1, const TQString& s2 )
{ return s1.localeAwareCompare( s2 ); }
#ifndef TQT_NO_DATASTREAM
friend TQ_EXPORT TQDataStream &operator>>( TQDataStream &, TQString & );
#endif
void compose();
#ifndef TQT_NO_COMPAT
const char* data() const { return ascii(); }
#endif
#if defined(TQ_TQDOC)
bool startsWith( const TQString& str, bool cs = TRUE ) const;
bool endsWith( const TQString& str, bool cs = TRUE ) const;
#else
// ### TQt 4.0: merge these two into one, and remove TQ_TQDOC hack
bool startsWith( const TQString& str ) const;
bool startsWith( const TQString& str, bool cs ) const;
// ### TQt 4.0: merge these two into one, and remove TQ_TQDOC hack
bool endsWith( const TQString& str ) const;
bool endsWith( const TQString& str, bool cs ) const;
#endif
void setLength( uint newLength );
uint capacity() const;
void reserve( uint minCapacity );
void squeeze();
bool simpleText() const { if ( !d->issimpletext ) checkSimpleText(); return (bool)d->issimpletext; }
bool isRightToLeft() const;
private:
TQString( int size, bool /* dummy */ ); // allocate size incl. \0
void deref();
void real_detach();
void subat( uint );
TQString multiArg( int numArgs, const TQString& a1, const TQString& a2,
const TQString& a3 = TQString::null,
const TQString& a4 = TQString::null ) const;
void checkSimpleText() const;
void grow( uint newLength );
#ifndef TQT_NO_CAST_ASCII
TQString &insertHelper( uint index, const char *s, uint len=UINT_MAX );
TQString &operatorPlusEqHelper( const char *s, uint len2=UINT_MAX );
#endif
static TQChar* latin1ToUnicode( const char*, uint * len, uint maxlen=(uint)-1 );
static TQChar* latin1ToUnicode( const TQByteArray&, uint * len );
static char* tqunicodeToLatin1( const TQChar*, uint len );
TQStringData *d;
static TQStringData* shared_null;
static TQStringData* makeSharedNull();
friend class TQConstString;
friend class TQTextStream;
TQString( TQStringData* dd, bool /* dummy */ ) : d(dd) { }
// needed for TQDeepCopy
void detach();
friend class TQDeepCopy<TQString>;
};
class TQ_EXPORT TQCharRef {
friend class TQString;
TQString& s;
uint p;
TQCharRef(TQString* str, uint pos) : s(*str), p(pos) { }
public:
// most TQChar operations repeated here
// all this is not documented: We just say "like TQChar" and let it be.
#ifndef TQ_TQDOC
ushort tqunicode() const { return s.constref(p).tqunicode(); }
char latin1() const { return s.constref(p).latin1(); }
// An operator= for each TQChar cast constructors
TQCharRef operator=(char c ) { s.ref(p)=c; return *this; }
TQCharRef operator=(uchar c ) { s.ref(p)=c; return *this; }
TQCharRef operator=(TQChar c ) { s.ref(p)=c; return *this; }
TQCharRef operator=(const TQCharRef& c ) { s.ref(p)=c.tqunicode(); return *this; }
TQCharRef operator=(ushort rc ) { s.ref(p)=rc; return *this; }
TQCharRef operator=(short rc ) { s.ref(p)=rc; return *this; }
TQCharRef operator=(uint rc ) { s.ref(p)=rc; return *this; }
TQCharRef operator=(int rc ) { s.ref(p)=rc; return *this; }
operator TQChar () const { return s.constref(p); }
// each function...
bool isNull() const { return tqunicode()==0; }
bool isPrint() const { return s.constref(p).isPrint(); }
bool isPunct() const { return s.constref(p).isPunct(); }
bool isSpace() const { return s.constref(p).isSpace(); }
bool isMark() const { return s.constref(p).isMark(); }
bool isLetter() const { return s.constref(p).isLetter(); }
bool isNumber() const { return s.constref(p).isNumber(); }
bool isLetterOrNumber() { return s.constref(p).isLetterOrNumber(); }
bool isDigit() const { return s.constref(p).isDigit(); }
int digitValue() const { return s.constref(p).digitValue(); }
TQChar lower() const { return s.constref(p).lower(); }
TQChar upper() const { return s.constref(p).upper(); }
TQChar::Category category() const { return s.constref(p).category(); }
TQChar::Direction direction() const { return s.constref(p).direction(); }
TQChar::Joining joining() const { return s.constref(p).joining(); }
bool mirrored() const { return s.constref(p).mirrored(); }
TQChar mirroredChar() const { return s.constref(p).mirroredChar(); }
const TQString &decomposition() const { return s.constref(p).decomposition(); }
TQChar::Decomposition decompositionTag() const { return s.constref(p).decompositionTag(); }
unsigned char combiningClass() const { return s.constref(p).combiningClass(); }
// Not the non-const ones of these.
uchar cell() const { return s.constref(p).cell(); }
uchar row() const { return s.constref(p).row(); }
#endif
};
inline TQCharRef TQString::at( uint i ) { return TQCharRef(this,i); }
inline TQCharRef TQString::operator[]( int i ) { return tqat((uint)i); }
class TQ_EXPORT TQConstString : private TQString {
public:
TQConstString( const TQChar* tqunicode, uint length );
~TQConstString();
const TQString& string() const { return *this; }
};
/*****************************************************************************
TQString stream functions
*****************************************************************************/
#ifndef TQT_NO_DATASTREAM
TQ_EXPORT TQDataStream &operator<<( TQDataStream &, const TQString & );
TQ_EXPORT TQDataStream &operator>>( TQDataStream &, TQString & );
#endif
/*****************************************************************************
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(); }
inline TQString TQString::section( TQChar sep, int start, int end, int flags ) const
{ return section(TQString(sep), start, end, flags); }
inline TQString TQString::section( char sep, int start, int end, int flags ) const
{ return section(TQChar(sep), start, end, flags); }
#ifndef TQT_NO_CAST_ASCII
inline TQString TQString::section( const char *in_sep, int start, int end, int flags ) const
{ return section(TQString(in_sep), start, end, flags); }
#endif
inline TQString &TQString::operator=( TQChar c )
{ *this = TQString(c); return *this; }
inline TQString &TQString::operator=( char c )
{ *this = TQString(TQChar(c)); return *this; }
inline bool TQString::isNull() const
{ return tqunicode() == 0; }
inline bool TQString::operator!() const
{ return isNull(); }
inline uint TQString::length() const
{ return d->len; }
inline uint TQString::capacity() const
{ return d->maxl; }
inline bool TQString::isEmpty() const
{ return length() == 0; }
inline TQString TQString::copy() const
{ return TQString( *this ); }
#ifndef TQT_NO_CAST_ASCII
inline TQString &TQString::insert( uint index, const char *s )
{ return insertHelper( index, s ); }
inline TQString &TQString::insert( uint index, const TQByteArray &s )
{
int pos = s.tqfind( 0 );
return insertHelper( index, s, pos==-1 ? s.size() : pos );
}
#endif
inline TQString &TQString::prepend( const TQString & s )
{ return insert(0,s); }
inline TQString &TQString::prepend( TQChar c )
{ return insert(0,c); }
inline TQString &TQString::prepend( char c )
{ return insert(0,c); }
#ifndef TQT_NO_CAST_ASCII
inline TQString &TQString::prepend( const TQByteArray & s )
{ return insert(0,s); }
#endif
#ifndef TQT_NO_CAST_ASCII
inline TQString &TQString::operator+=( const TQByteArray &s )
{
int pos = s.tqfind( 0 );
return operatorPlusEqHelper( s, pos==-1 ? s.size() : pos );
}
#endif
inline TQString &TQString::append( const TQString & s )
{ return operator+=(s); }
#ifndef TQT_NO_CAST_ASCII
inline TQString &TQString::append( const TQByteArray &s )
{ return operator+=(s); }
inline TQString &TQString::append( const char * s )
{ return operator+=(s); }
#endif
inline TQString &TQString::append( TQChar c )
{ return operator+=(c); }
inline TQString &TQString::append( char c )
{ return operator+=(c); }
#ifndef TQT_NO_STL
inline TQString &TQString::operator=( const std::string& str )
{ return operator=(str.c_str()); }
#ifndef TQT_NO_CAST_ASCII
inline TQString &TQString::operator+=( const std::string& s )
{ return operator+=(s.c_str()); }
inline TQString &TQString::append( const std::string& s )
{ return operator+=(s); }
inline TQString &TQString::prepend( const std::string& s )
{ return insert(0, s); }
#endif
#endif
inline TQString &TQString::setNum( short n, int base )
{ return setNum((TQ_LLONG)n, base); }
inline TQString &TQString::setNum( ushort n, int base )
{ return setNum((TQ_ULLONG)n, base); }
inline TQString &TQString::setNum( int n, int base )
{ return setNum((TQ_LLONG)n, base); }
inline TQString &TQString::setNum( uint n, int base )
{ return setNum((TQ_ULLONG)n, base); }
inline TQString &TQString::setNum( float n, char f, int prec )
{ return setNum((double)n,f,prec); }
inline TQString TQString::arg( int a, int fieldWidth, int base ) const
{ return arg( (TQ_LLONG)a, fieldWidth, base ); }
inline TQString TQString::arg( uint a, int fieldWidth, int base ) const
{ return arg( (TQ_ULLONG)a, fieldWidth, base ); }
inline TQString TQString::arg( short a, int fieldWidth, int base ) const
{ return arg( (TQ_LLONG)a, fieldWidth, base ); }
inline TQString TQString::arg( ushort a, int fieldWidth, int base ) const
{ return arg( (TQ_ULLONG)a, fieldWidth, base ); }
inline TQString TQString::arg( const TQString& a1, const TQString& a2 ) const {
return multiArg( 2, a1, a2 );
}
inline TQString TQString::arg( const TQString& a1, const TQString& a2,
const TQString& a3 ) const {
return multiArg( 3, a1, a2, a3 );
}
inline TQString TQString::arg( const TQString& a1, const TQString& a2,
const TQString& a3, const TQString& a4 ) const {
return multiArg( 4, a1, a2, a3, a4 );
}
inline int TQString::tqfind( char c, int index, bool cs ) const
{ return tqfind(TQChar(c), index, cs); }
inline int TQString::tqfindRev( char c, int index, bool cs ) const
{ return tqfindRev( TQChar(c), index, cs ); }
#ifndef TQT_NO_CAST_ASCII
inline int TQString::tqfind( const char* str, int index ) const
{ return tqfind(TQString::fromAscii(str), index); }
inline int TQString::tqfindRev( const char* str, int index ) const
{ return tqfindRev(TQString::fromAscii(str), index); }
#endif
/*****************************************************************************
TQString non-member operators
*****************************************************************************/
TQ_EXPORT bool operator!=( const TQString &s1, const TQString &s2 );
TQ_EXPORT bool operator<( const TQString &s1, const TQString &s2 );
TQ_EXPORT bool operator<=( const TQString &s1, const TQString &s2 );
TQ_EXPORT bool operator==( const TQString &s1, const TQString &s2 );
TQ_EXPORT bool operator>( const TQString &s1, const TQString &s2 );
TQ_EXPORT bool operator>=( const TQString &s1, const TQString &s2 );
#ifndef TQT_NO_CAST_ASCII
TQ_EXPORT bool operator!=( const TQString &s1, const char *s2 );
TQ_EXPORT bool operator<( const TQString &s1, const char *s2 );
TQ_EXPORT bool operator<=( const TQString &s1, const char *s2 );
TQ_EXPORT bool operator==( const TQString &s1, const char *s2 );
TQ_EXPORT bool operator>( const TQString &s1, const char *s2 );
TQ_EXPORT bool operator>=( const TQString &s1, const char *s2 );
TQ_EXPORT bool operator!=( const char *s1, const TQString &s2 );
TQ_EXPORT bool operator<( const char *s1, const TQString &s2 );
TQ_EXPORT bool operator<=( const char *s1, const TQString &s2 );
TQ_EXPORT bool operator==( const char *s1, const TQString &s2 );
//TQ_EXPORT bool operator>( const char *s1, const TQString &s2 ); // MSVC++
TQ_EXPORT bool operator>=( const char *s1, const TQString &s2 );
#endif
// Interoperability
TQ_EXPORT bool operator==( const QString &s1, const TQString &s2 );
TQ_EXPORT inline const TQString operator+( const TQString &s1, const TQString &s2 )
{
TQString tmp( s1 );
tmp += s2;
return tmp;
}
#ifndef TQT_NO_CAST_ASCII
TQ_EXPORT inline const TQString operator+( const TQString &s1, const char *s2 )
{
TQString tmp( s1 );
tmp += TQString::fromAscii(s2);
return tmp;
}
TQ_EXPORT inline const TQString operator+( const char *s1, const TQString &s2 )
{
TQString tmp = TQString::fromAscii( s1 );
tmp += s2;
return tmp;
}
#endif
TQ_EXPORT inline const TQString operator+( const TQString &s1, TQChar c2 )
{
TQString tmp( s1 );
tmp += c2;
return tmp;
}
TQ_EXPORT inline const TQString operator+( const TQString &s1, char c2 )
{
TQString tmp( s1 );
tmp += c2;
return tmp;
}
TQ_EXPORT inline const TQString operator+( TQChar c1, const TQString &s2 )
{
TQString tmp;
tmp += c1;
tmp += s2;
return tmp;
}
TQ_EXPORT inline const TQString operator+( char c1, const TQString &s2 )
{
TQString tmp;
tmp += c1;
tmp += s2;
return tmp;
}
#ifndef TQT_NO_STL
TQ_EXPORT inline const TQString operator+(const TQString& s1, const std::string& s2)
{
return s1 + TQString(s2);
}
TQ_EXPORT inline const TQString operator+(const std::string& s1, const TQString& s2)
{
TQString tmp(s2);
return TQString(tmp.prepend(s1));
}
#endif
#if defined(TQ_OS_WIN32)
extern TQ_EXPORT TQString qt_winTQString(void*);
extern TQ_EXPORT const void* qt_winTchar(const TQString& str, bool addnul);
extern TQ_EXPORT void* qt_winTchar_new(const TQString& str);
extern TQ_EXPORT TQCString qt_winTQString2MB( const TQString& s, int len=-1 );
extern TQ_EXPORT TQString qt_winMB2TQString( const char* mb, int len=-1 );
#endif
#endif // USE_QT4
#define TQ_DEFINED_TQSTRING
#include "tqwinexport.h"
#endif // TQSTRING_H
|