You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1161 lines
39 KiB
1161 lines
39 KiB
13 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
6 months ago
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/tqstring.h:1 -->
|
||
13 years ago
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
6 months ago
|
<title>tqstring.h Include File</title>
|
||
13 years ago
|
<style type="text/css"><!--
|
||
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
||
|
a:link { color: #004faf; text-decoration: none }
|
||
|
a:visited { color: #672967; text-decoration: none }
|
||
|
body { background: #ffffff; color: black; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||
|
<tr bgcolor="#E5E5E5">
|
||
|
<td valign=center>
|
||
|
<a href="index.html">
|
||
|
<font color="#004faf">Home</font></a>
|
||
|
| <a href="classes.html">
|
||
|
<font color="#004faf">All Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped Classes</font></a>
|
||
|
| <a href="functions.html">
|
||
|
<font color="#004faf">Functions</font></a>
|
||
|
</td>
|
||
6 months ago
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>tqstring.h</h1>
|
||
13 years ago
|
|
||
6 months ago
|
<p>This is the verbatim text of the tqstring.h include file. It is provided only for illustration; the copyright remains with Trolltech.
|
||
13 years ago
|
<hr>
|
||
|
<pre>
|
||
|
/****************************************************************************
|
||
6 months ago
|
** $Id: qt/tqstring.h 3.3.8 edited Jan 11 14:38 $
|
||
13 years ago
|
**
|
||
|
** Definition of the TQString class, and related Unicode functions.
|
||
|
**
|
||
|
** Created : 920609
|
||
|
**
|
||
|
** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.
|
||
|
**
|
||
|
** 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 file LICENSE.GPL 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
|
||
13 years ago
|
** Public Licensing requirements will be met:
|
||
13 years ago
|
** 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
|
||
|
|
||
|
#ifndef QT_H
|
||
13 years ago
|
#include "ntqcstring.h"
|
||
13 years ago
|
#endif // QT_H
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
#include <limits.h>
|
||
|
#endif
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_STL
|
||
13 years ago
|
#if defined ( Q_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(Q_WRONG_SB_CTYPE_MACROS) && defined(_SB_CTYPE_MACROS)
|
||
|
#undef _SB_CTYPE_MACROS
|
||
|
#endif
|
||
|
#endif
|
||
|
|
||
|
|
||
|
/*****************************************************************************
|
||
|
TQString class
|
||
|
*****************************************************************************/
|
||
|
|
||
|
class TQRegExp;
|
||
|
class TQString;
|
||
|
class TQCharRef;
|
||
|
template <class T> class TQDeepCopy;
|
||
|
|
||
1 year ago
|
class TQ_EXPORT TQChar {
|
||
13 years ago
|
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 );
|
||
|
|
||
10 months ago
|
static const TQChar null; // 0000
|
||
|
static const TQChar replacement; // FFFD
|
||
|
static const TQChar byteOrderMark; // FEFF
|
||
|
static const TQChar byteOrderSwapped; // FFFE
|
||
|
static const TQChar nbsp; // 00A0
|
||
13 years ago
|
|
||
|
// 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 unicode() const { return ucs; }
|
||
|
#ifdef Q_NO_PACKED_REFERENCE
|
||
|
ushort &unicode() { return *(&ucs); }
|
||
|
#else
|
||
|
ushort &unicode() { return ucs; }
|
||
|
#endif
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
// like all ifdef'd code this is undocumented
|
||
|
operator char() const { return latin1(); }
|
||
|
#endif
|
||
|
|
||
|
bool isNull() const { return unicode()==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;
|
||
13 years ago
|
tqSysInfo( &wordSize, &bigEndian );
|
||
13 years ago
|
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(QT_QSTRING_UCS_4)
|
||
|
ushort grp;
|
||
|
#endif
|
||
13 years ago
|
} TQ_PACKED;
|
||
13 years ago
|
|
||
|
inline TQChar::TQChar() : ucs( 0 )
|
||
|
#ifdef QT_QSTRING_UCS_4
|
||
|
, grp( 0 )
|
||
|
#endif
|
||
|
{
|
||
|
}
|
||
|
inline TQChar::TQChar( char c ) : ucs( (uchar)c )
|
||
|
#ifdef QT_QSTRING_UCS_4
|
||
|
, grp( 0 )
|
||
|
#endif
|
||
|
{
|
||
|
}
|
||
|
inline TQChar::TQChar( uchar c ) : ucs( c )
|
||
|
#ifdef QT_QSTRING_UCS_4
|
||
|
, grp( 0 )
|
||
|
#endif
|
||
|
{
|
||
|
}
|
||
|
inline TQChar::TQChar( uchar c, uchar r ) : ucs( (r << 8) | c )
|
||
|
#ifdef QT_QSTRING_UCS_4
|
||
|
, grp( 0 )
|
||
|
#endif
|
||
|
{
|
||
|
}
|
||
|
inline TQChar::TQChar( const TQChar& c ) : ucs( c.ucs )
|
||
|
#ifdef QT_QSTRING_UCS_4
|
||
|
, grp( c.grp )
|
||
|
#endif
|
||
|
{
|
||
|
}
|
||
|
|
||
|
inline TQChar::TQChar( ushort rc ) : ucs( rc )
|
||
|
#ifdef QT_QSTRING_UCS_4
|
||
|
, grp( 0 )
|
||
|
#endif
|
||
|
{
|
||
|
}
|
||
|
inline TQChar::TQChar( short rc ) : ucs( (ushort) rc )
|
||
|
#ifdef QT_QSTRING_UCS_4
|
||
|
, grp( 0 )
|
||
|
#endif
|
||
|
{
|
||
|
}
|
||
|
inline TQChar::TQChar( uint rc ) : ucs( (ushort ) (rc & 0xffff) )
|
||
|
#ifdef QT_QSTRING_UCS_4
|
||
|
, grp( (ushort) ((rc >> 16) & 0xffff) )
|
||
|
#endif
|
||
|
{
|
||
|
}
|
||
|
inline TQChar::TQChar( int rc ) : ucs( (ushort) (rc & 0xffff) )
|
||
|
#ifdef QT_QSTRING_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
|
||
1 year ago
|
struct TQ_EXPORT TQStringData : public TQShared {
|
||
13 years ago
|
TQStringData() :
|
||
|
TQShared(), unicode(0), ascii(0), len(0), issimpletext(TRUE), maxl(0), islatin1(FALSE) { ref(); }
|
||
|
TQStringData(TQChar *u, uint l, uint m) :
|
||
|
TQShared(), unicode(u), ascii(0), len(l), issimpletext(FALSE), maxl(m), islatin1(FALSE) { }
|
||
|
~TQStringData() { if ( unicode ) delete[] ((char*)unicode);
|
||
|
if ( ascii ) delete[] ascii; }
|
||
|
|
||
|
void deleteSelf();
|
||
|
TQChar *unicode;
|
||
|
char *ascii;
|
||
|
void setDirty() {
|
||
|
if ( ascii ) {
|
||
|
delete [] ascii;
|
||
|
ascii = 0;
|
||
|
}
|
||
|
issimpletext = FALSE;
|
||
|
}
|
||
|
#ifdef Q_OS_MAC9
|
||
|
uint len;
|
||
|
#else
|
||
|
uint len : 30;
|
||
|
#endif
|
||
|
uint issimpletext : 1;
|
||
|
#ifdef Q_OS_MAC9
|
||
|
uint maxl;
|
||
|
#else
|
||
|
uint maxl : 30;
|
||
|
#endif
|
||
|
uint islatin1 : 1;
|
||
|
|
||
|
private:
|
||
13 years ago
|
#if defined(TQ_DISABLE_COPY)
|
||
13 years ago
|
TQStringData( const TQStringData& );
|
||
|
TQStringData& operator=( const TQStringData& );
|
||
|
#endif
|
||
|
};
|
||
|
|
||
|
|
||
1 year ago
|
class TQ_EXPORT TQString
|
||
13 years ago
|
{
|
||
|
public:
|
||
|
TQString(); // make null string
|
||
|
TQString( TQChar ); // one-char string
|
||
|
TQString( const TQString & ); // impl-shared copy
|
||
|
TQString( const TQByteArray& ); // deep copy
|
||
|
TQString( const TQChar* unicode, uint length ); // deep copy
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
TQString( const char *str ); // deep copy
|
||
|
#endif
|
||
6 years ago
|
#ifndef TQT_NO_STL
|
||
13 years ago
|
TQString( const std::string& ); // deep copy
|
||
|
#endif
|
||
|
~TQString();
|
||
|
|
||
|
TQString &operator=( const TQString & ); // impl-shared copy
|
||
|
TQString &operator=( const char * ); // deep copy
|
||
6 years ago
|
#ifndef TQT_NO_STL
|
||
13 years ago
|
TQString &operator=( const std::string& ); // deep copy
|
||
|
#endif
|
||
|
TQString &operator=( const TQCString& ); // deep copy
|
||
|
TQString &operator=( TQChar c );
|
||
|
TQString &operator=( char c );
|
||
|
|
||
10 months ago
|
static const TQString null;
|
||
13 years ago
|
|
||
|
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;
|
||
13 years ago
|
TQString arg( TQ_LLONG a, int fieldwidth=0, int base=10 ) const;
|
||
|
TQString arg( TQ_ULLONG a, int fieldwidth=0, int base=10 ) const;
|
||
13 years ago
|
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;
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_SPRINTF
|
||
13 years ago
|
TQString &sprintf( const char* format, ... )
|
||
|
#if defined(Q_CC_GNU) && !defined(__INSURE__)
|
||
|
__attribute__ ((format (printf, 2, 3)))
|
||
|
#endif
|
||
|
;
|
||
|
#endif
|
||
|
|
||
|
int find( TQChar c, int index=0, bool cs=TRUE ) const;
|
||
|
int find( char c, int index=0, bool cs=TRUE ) const;
|
||
|
int find( const TQString &str, int index=0, bool cs=TRUE ) const;
|
||
6 years ago
|
#ifndef TQT_NO_REGEXP
|
||
13 years ago
|
int find( const TQRegExp &, int index=0 ) const;
|
||
|
#endif
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
int find( const char* str, int index=0 ) const;
|
||
|
#endif
|
||
|
int findRev( TQChar c, int index=-1, bool cs=TRUE) const;
|
||
|
int findRev( char c, int index=-1, bool cs=TRUE) const;
|
||
|
int findRev( const TQString &str, int index=-1, bool cs=TRUE) const;
|
||
6 years ago
|
#ifndef TQT_NO_REGEXP
|
||
13 years ago
|
int findRev( const TQRegExp &, int index=-1 ) const;
|
||
|
#endif
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
int findRev( const char* str, int index=-1 ) const;
|
||
|
#endif
|
||
|
int contains( TQChar c, bool cs=TRUE ) const;
|
||
|
int contains( char c, bool cs=TRUE ) const
|
||
|
{ return contains(TQChar(c), cs); }
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
int contains( const char* str, bool cs=TRUE ) const;
|
||
|
#endif
|
||
|
int contains( const TQString &str, bool cs=TRUE ) const;
|
||
6 years ago
|
#ifndef TQT_NO_REGEXP
|
||
13 years ago
|
int contains( 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;
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
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;
|
||
6 years ago
|
#ifndef TQT_NO_REGEXP
|
||
13 years ago
|
TQString section( const TQRegExp &reg, 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 & );
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
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 & );
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
TQString &append( const TQByteArray & );
|
||
|
TQString &append( const char * );
|
||
|
#endif
|
||
6 years ago
|
#if !defined(TQT_NO_STL) && !defined(TQT_NO_CAST_ASCII)
|
||
13 years ago
|
TQString &append( const std::string& );
|
||
|
#endif
|
||
|
TQString &prepend( char );
|
||
|
TQString &prepend( TQChar );
|
||
|
TQString &prepend( const TQString & );
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
TQString &prepend( const TQByteArray & );
|
||
|
TQString &prepend( const char * );
|
||
|
#endif
|
||
6 years ago
|
#if !defined(TQT_NO_STL) && !defined(TQT_NO_CAST_ASCII)
|
||
13 years ago
|
TQString &prepend( const std::string& );
|
||
|
#endif
|
||
|
TQString &remove( uint index, uint len );
|
||
|
#if defined(Q_QDOC)
|
||
|
TQString &remove( const TQString & str, bool cs = TRUE );
|
||
|
#else
|
||
|
// ### TQt 4.0: merge these two into one, and remove Q_QDOC hack
|
||
|
TQString &remove( const TQString & );
|
||
|
TQString &remove( const TQString &, bool cs );
|
||
|
#endif
|
||
|
TQString &remove( TQChar c );
|
||
|
TQString &remove( char c )
|
||
|
{ return remove( TQChar(c) ); }
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
TQString &remove( const char * );
|
||
|
#endif
|
||
6 years ago
|
#ifndef TQT_NO_REGEXP
|
||
13 years ago
|
TQString &remove( const TQRegExp & );
|
||
|
#endif
|
||
|
TQString &replace( uint index, uint len, const TQString & );
|
||
|
TQString &replace( uint index, uint len, const TQChar*, uint clen );
|
||
|
TQString &replace( uint index, uint len, TQChar );
|
||
|
TQString &replace( uint index, uint len, char c )
|
||
|
{ return replace( index, len, TQChar(c) ); }
|
||
|
#if defined(Q_QDOC)
|
||
|
TQString &replace( TQChar c, const TQString & after, bool cs = TRUE );
|
||
|
TQString &replace( char c, const TQString & after, bool cs = TRUE );
|
||
|
TQString &replace( const TQString & before, const TQString & after,
|
||
|
bool cs = TRUE );
|
||
|
#else
|
||
|
// ### TQt 4.0: merge these two into one, and remove Q_QDOC hack
|
||
|
TQString &replace( TQChar c, const TQString & );
|
||
|
TQString &replace( TQChar c, const TQString &, bool );
|
||
|
|
||
|
// ### TQt 4.0: merge these two into one, and remove Q_QDOC hack
|
||
|
TQString &replace( char c, const TQString & after )
|
||
|
{ return replace( TQChar(c), after, TRUE ); }
|
||
|
TQString &replace( char c, const TQString & after, bool cs )
|
||
|
{ return replace( TQChar(c), after, cs ); }
|
||
|
|
||
|
// ### TQt 4.0: merge these two into one, and remove Q_QDOC hack
|
||
|
TQString &replace( const TQString &, const TQString & );
|
||
|
TQString &replace( const TQString &, const TQString &, bool );
|
||
|
#endif
|
||
6 years ago
|
#ifndef TQT_NO_REGEXP_CAPTURE
|
||
13 years ago
|
TQString &replace( const TQRegExp &, const TQString & );
|
||
|
#endif
|
||
|
TQString &replace( 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;
|
||
13 years ago
|
TQ_LLONG toLongLong( bool *ok=0, int base=10 ) const;
|
||
|
TQ_ULLONG toULongLong( bool *ok=0, int base=10 ) const;
|
||
13 years ago
|
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 );
|
||
13 years ago
|
TQString &setNum( TQ_LLONG, int base=10 );
|
||
|
TQString &setNum( TQ_ULLONG, int base=10 );
|
||
13 years ago
|
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);
|
||
13 years ago
|
static TQString number( TQ_LLONG, int base=10 );
|
||
|
static TQString number( TQ_ULLONG, int base=10);
|
||
13 years ago
|
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 );
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
TQString &operator+=( const TQByteArray &str );
|
||
|
TQString &operator+=( const char *str );
|
||
|
#endif
|
||
6 years ago
|
#if !defined(TQT_NO_STL) && !defined(TQT_NO_CAST_ASCII)
|
||
13 years ago
|
TQString &operator+=( const std::string& );
|
||
|
#endif
|
||
|
TQString &operator+=( TQChar c );
|
||
|
TQString &operator+=( char c );
|
||
|
|
||
|
TQChar at( uint i ) const
|
||
|
{ return i < d->len ? d->unicode[i] : TQChar::null; }
|
||
|
TQChar operator[]( int i ) const { 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->unicode[i];
|
||
|
}
|
||
|
|
||
|
const TQChar* unicode() const { return d->unicode; }
|
||
|
const char* ascii() const;
|
||
|
static TQString fromAscii(const char*, int len=-1);
|
||
|
const char* latin1() const;
|
||
|
static TQString fromLatin1(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;
|
||
6 years ago
|
#ifndef TQT_NO_ASCII_CAST
|
||
13 years ago
|
operator const char *() const { return ascii(); }
|
||
|
#endif
|
||
6 years ago
|
#ifndef TQT_NO_STL
|
||
13 years ago
|
operator std::string() const { return ascii() ? ascii() : ""; }
|
||
|
#endif
|
||
|
|
||
|
static TQString fromUcs2( const unsigned short *ucs2 );
|
||
|
const unsigned short *ucs2() const;
|
||
|
|
||
|
TQString &setUnicode( const TQChar* unicode, uint len );
|
||
|
TQString &setUnicodeCodes( const ushort* unicode_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 ); }
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_DATASTREAM
|
||
1 year ago
|
friend TQ_EXPORT TQDataStream &operator>>( TQDataStream &, TQString & );
|
||
13 years ago
|
#endif
|
||
|
|
||
|
void compose();
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_COMPAT
|
||
13 years ago
|
const char* data() const { return ascii(); }
|
||
|
#endif
|
||
|
|
||
|
#if defined(Q_QDOC)
|
||
|
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 Q_QDOC 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 Q_QDOC 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 );
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
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* unicodeToLatin1( 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>;
|
||
|
};
|
||
|
|
||
1 year ago
|
class TQ_EXPORT TQCharRef {
|
||
13 years ago
|
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 Q_QDOC
|
||
|
ushort unicode() const { return s.constref(p).unicode(); }
|
||
|
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.unicode(); 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 unicode()==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 at((uint)i); }
|
||
|
|
||
|
|
||
1 year ago
|
class TQ_EXPORT TQConstString : private TQString {
|
||
13 years ago
|
public:
|
||
|
TQConstString( const TQChar* unicode, uint length );
|
||
|
~TQConstString();
|
||
|
const TQString& string() const { return *this; }
|
||
|
};
|
||
|
|
||
|
|
||
|
/*****************************************************************************
|
||
|
TQString stream functions
|
||
|
*****************************************************************************/
|
||
6 years ago
|
#ifndef TQT_NO_DATASTREAM
|
||
1 year ago
|
TQ_EXPORT TQDataStream &operator<<( TQDataStream &, const TQString & );
|
||
|
TQ_EXPORT TQDataStream &operator>>( TQDataStream &, TQString & );
|
||
13 years ago
|
#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); }
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
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 unicode() == 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 ); }
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
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.find( 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); }
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
inline TQString &TQString::prepend( const TQByteArray & s )
|
||
|
{ return insert(0,s); }
|
||
|
#endif
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
inline TQString &TQString::operator+=( const TQByteArray &s )
|
||
|
{
|
||
|
int pos = s.find( 0 );
|
||
|
return operatorPlusEqHelper( s, pos==-1 ? s.size() : pos );
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
inline TQString &TQString::append( const TQString & s )
|
||
|
{ return operator+=(s); }
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
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); }
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_STL
|
||
13 years ago
|
inline TQString &TQString::operator=( const std::string& str )
|
||
|
{ return operator=(str.c_str()); }
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
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 )
|
||
13 years ago
|
{ return setNum((TQ_LLONG)n, base); }
|
||
13 years ago
|
|
||
|
inline TQString &TQString::setNum( ushort n, int base )
|
||
13 years ago
|
{ return setNum((TQ_ULLONG)n, base); }
|
||
13 years ago
|
|
||
|
inline TQString &TQString::setNum( int n, int base )
|
||
13 years ago
|
{ return setNum((TQ_LLONG)n, base); }
|
||
13 years ago
|
|
||
|
inline TQString &TQString::setNum( uint n, int base )
|
||
13 years ago
|
{ return setNum((TQ_ULLONG)n, base); }
|
||
13 years ago
|
|
||
|
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
|
||
13 years ago
|
{ return arg( (TQ_LLONG)a, fieldWidth, base ); }
|
||
13 years ago
|
|
||
|
inline TQString TQString::arg( uint a, int fieldWidth, int base ) const
|
||
13 years ago
|
{ return arg( (TQ_ULLONG)a, fieldWidth, base ); }
|
||
13 years ago
|
|
||
|
inline TQString TQString::arg( short a, int fieldWidth, int base ) const
|
||
13 years ago
|
{ return arg( (TQ_LLONG)a, fieldWidth, base ); }
|
||
13 years ago
|
|
||
|
inline TQString TQString::arg( ushort a, int fieldWidth, int base ) const
|
||
13 years ago
|
{ return arg( (TQ_ULLONG)a, fieldWidth, base ); }
|
||
13 years ago
|
|
||
|
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::find( char c, int index, bool cs ) const
|
||
|
{ return find(TQChar(c), index, cs); }
|
||
|
|
||
|
inline int TQString::findRev( char c, int index, bool cs ) const
|
||
|
{ return findRev( TQChar(c), index, cs ); }
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
13 years ago
|
inline int TQString::find( const char* str, int index ) const
|
||
|
{ return find(TQString::fromAscii(str), index); }
|
||
|
|
||
|
inline int TQString::findRev( const char* str, int index ) const
|
||
|
{ return findRev(TQString::fromAscii(str), index); }
|
||
|
#endif
|
||
|
|
||
|
|
||
|
/*****************************************************************************
|
||
|
TQString non-member operators
|
||
|
*****************************************************************************/
|
||
|
|
||
1 year ago
|
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 );
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
1 year ago
|
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
|
||
|
|
||
|
TQ_EXPORT inline const TQString operator+( const TQString &s1, const TQString &s2 )
|
||
13 years ago
|
{
|
||
|
TQString tmp( s1 );
|
||
|
tmp += s2;
|
||
|
return tmp;
|
||
|
}
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_CAST_ASCII
|
||
1 year ago
|
TQ_EXPORT inline const TQString operator+( const TQString &s1, const char *s2 )
|
||
13 years ago
|
{
|
||
|
TQString tmp( s1 );
|
||
|
tmp += TQString::fromAscii(s2);
|
||
|
return tmp;
|
||
|
}
|
||
|
|
||
1 year ago
|
TQ_EXPORT inline const TQString operator+( const char *s1, const TQString &s2 )
|
||
13 years ago
|
{
|
||
|
TQString tmp = TQString::fromAscii( s1 );
|
||
|
tmp += s2;
|
||
|
return tmp;
|
||
|
}
|
||
|
#endif
|
||
|
|
||
1 year ago
|
TQ_EXPORT inline const TQString operator+( const TQString &s1, TQChar c2 )
|
||
13 years ago
|
{
|
||
|
TQString tmp( s1 );
|
||
|
tmp += c2;
|
||
|
return tmp;
|
||
|
}
|
||
|
|
||
1 year ago
|
TQ_EXPORT inline const TQString operator+( const TQString &s1, char c2 )
|
||
13 years ago
|
{
|
||
|
TQString tmp( s1 );
|
||
|
tmp += c2;
|
||
|
return tmp;
|
||
|
}
|
||
|
|
||
1 year ago
|
TQ_EXPORT inline const TQString operator+( TQChar c1, const TQString &s2 )
|
||
13 years ago
|
{
|
||
|
TQString tmp;
|
||
|
tmp += c1;
|
||
|
tmp += s2;
|
||
|
return tmp;
|
||
|
}
|
||
|
|
||
1 year ago
|
TQ_EXPORT inline const TQString operator+( char c1, const TQString &s2 )
|
||
13 years ago
|
{
|
||
|
TQString tmp;
|
||
|
tmp += c1;
|
||
|
tmp += s2;
|
||
|
return tmp;
|
||
|
}
|
||
|
|
||
6 years ago
|
#ifndef TQT_NO_STL
|
||
1 year ago
|
TQ_EXPORT inline const TQString operator+(const TQString& s1, const std::string& s2)
|
||
13 years ago
|
{
|
||
|
return s1 + TQString(s2);
|
||
|
}
|
||
|
|
||
1 year ago
|
TQ_EXPORT inline const TQString operator+(const std::string& s1, const TQString& s2)
|
||
13 years ago
|
{
|
||
|
TQString tmp(s2);
|
||
|
return TQString(tmp.prepend(s1));
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
|
||
|
#if defined(Q_OS_WIN32)
|
||
1 year ago
|
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 );
|
||
13 years ago
|
#endif
|
||
|
|
||
|
#define Q_DEFINED_QSTRING
|
||
13 years ago
|
#include "ntqwinexport.h"
|
||
13 years ago
|
#endif // TQSTRING_H
|
||
|
</pre>
|
||
|
<!-- eof -->
|
||
|
<p><address><hr><div align=center>
|
||
|
<table width=100% cellspacing=0 border=0><tr>
|
||
|
<td>Copyright © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>TQt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|