|
Packit |
1c1d7e |
/****************************************************************************
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Definition of the QString class, and related Unicode
|
|
Packit |
1c1d7e |
** functions.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Created : 920609
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file is part of the tools module of the Qt GUI Toolkit.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file may be distributed under the terms of the Q Public License
|
|
Packit |
1c1d7e |
** as defined by Trolltech AS of Norway and appearing in the file
|
|
Packit |
1c1d7e |
** LICENSE.QPL included in the packaging of this file.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file may be distributed and/or modified under the terms of the
|
|
Packit |
1c1d7e |
** GNU General Public License version 2 as published by the Free Software
|
|
Packit |
1c1d7e |
** Foundation and appearing in the file LICENSE.GPL included in the
|
|
Packit |
1c1d7e |
** packaging of this file.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
|
Packit |
1c1d7e |
** licenses may use this file in accordance with the Qt Commercial License
|
|
Packit |
1c1d7e |
** Agreement provided with the Software.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
|
Packit |
1c1d7e |
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
|
Packit |
1c1d7e |
** information about Qt Commercial License Agreements.
|
|
Packit |
1c1d7e |
** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
|
Packit |
1c1d7e |
** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
** Contact info@trolltech.com if any conditions of this licensing are
|
|
Packit |
1c1d7e |
** not clear to you.
|
|
Packit |
1c1d7e |
**
|
|
Packit |
1c1d7e |
**********************************************************************/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QSTRING_H
|
|
Packit |
1c1d7e |
#define QSTRING_H
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QT_H
|
|
Packit |
1c1d7e |
#include "qcstring.h"
|
|
Packit |
1c1d7e |
#endif // QT_H
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#define QT_NO_ASCII_CAST
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*****************************************************************************
|
|
Packit |
1c1d7e |
QString class
|
|
Packit |
1c1d7e |
*****************************************************************************/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class QRegExp;
|
|
Packit |
1c1d7e |
class QString;
|
|
Packit |
1c1d7e |
class QCharRef;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class Q_EXPORT Q_PACKED QChar {
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QChar();
|
|
Packit |
1c1d7e |
QChar( char c );
|
|
Packit |
1c1d7e |
QChar( uchar c );
|
|
Packit |
1c1d7e |
QChar( uchar c, uchar r );
|
|
Packit |
1c1d7e |
QChar( const QChar& c );
|
|
Packit |
1c1d7e |
QChar( ushort rc );
|
|
Packit |
1c1d7e |
QChar( short rc );
|
|
Packit |
1c1d7e |
QChar( uint rc );
|
|
Packit |
1c1d7e |
QChar( int rc );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QT_STATIC_CONST QChar null; // 0000
|
|
Packit |
1c1d7e |
QT_STATIC_CONST QChar replacement; // FFFD
|
|
Packit |
1c1d7e |
QT_STATIC_CONST QChar byteOrderMark; // FEFF
|
|
Packit |
1c1d7e |
QT_STATIC_CONST QChar byteOrderSwapped; // FFFE
|
|
Packit |
1c1d7e |
QT_STATIC_CONST QChar nbsp; // 00A0
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// Unicode information
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
enum Category
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
NoCategory,
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Mark_NonSpacing, // Mn
|
|
Packit |
1c1d7e |
Mark_SpacingCombining, // Mc
|
|
Packit |
1c1d7e |
Mark_Enclosing, // Me
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Number_DecimalDigit, // Nd
|
|
Packit |
1c1d7e |
Number_Letter, // Nl
|
|
Packit |
1c1d7e |
Number_Other, // No
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Separator_Space, // Zs
|
|
Packit |
1c1d7e |
Separator_Line, // Zl
|
|
Packit |
1c1d7e |
Separator_Paragraph, // Zp
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Other_Control, // Cc
|
|
Packit |
1c1d7e |
Other_Format, // Cf
|
|
Packit |
1c1d7e |
Other_Surrogate, // Cs
|
|
Packit |
1c1d7e |
Other_PrivateUse, // Co
|
|
Packit |
1c1d7e |
Other_NotAssigned, // Cn
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Letter_Uppercase, // Lu
|
|
Packit |
1c1d7e |
Letter_Lowercase, // Ll
|
|
Packit |
1c1d7e |
Letter_Titlecase, // Lt
|
|
Packit |
1c1d7e |
Letter_Modifier, // Lm
|
|
Packit |
1c1d7e |
Letter_Other, // Lo
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Punctuation_Connector, // Pc
|
|
Packit |
1c1d7e |
Punctuation_Dask, // Pd
|
|
Packit |
1c1d7e |
Punctuation_Open, // Ps
|
|
Packit |
1c1d7e |
Punctuation_Close, // Pe
|
|
Packit |
1c1d7e |
Punctuation_InitialQuote, // Pi
|
|
Packit |
1c1d7e |
Punctuation_FinalQuote, // Pf
|
|
Packit |
1c1d7e |
Punctuation_Other, // Po
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Symbol_Math, // Sm
|
|
Packit |
1c1d7e |
Symbol_Currency, // Sc
|
|
Packit |
1c1d7e |
Symbol_Modifier, // Sk
|
|
Packit |
1c1d7e |
Symbol_Other // So
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
enum Direction
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
DirL, DirR, DirEN, DirES, DirET, DirAN, DirCS, DirB, DirS, DirWS, DirON,
|
|
Packit |
1c1d7e |
DirLRE, DirLRO, DirAL, DirRLE, DirRLO, DirPDF, DirNSM, DirBN
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
enum Decomposition
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
Single, Canonical, Font, NoBreak, Initial, Medial,
|
|
Packit |
1c1d7e |
Final, Isolated, Circle, Super, Sub, Vertical,
|
|
Packit |
1c1d7e |
Wide, Narrow, Small, Square, Compat, Fraction
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
enum Joining
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
OtherJoining, Dual, Right, Center
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// ****** WHEN ADDING FUNCTIONS, CONSIDER ADDING TO QCharRef TOO
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int digitValue() const;
|
|
Packit |
1c1d7e |
QChar lower() const;
|
|
Packit |
1c1d7e |
QChar upper() const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Category category() const;
|
|
Packit |
1c1d7e |
Direction direction() const;
|
|
Packit |
1c1d7e |
Joining joining() const;
|
|
Packit |
1c1d7e |
bool mirrored() const;
|
|
Packit |
1c1d7e |
QChar mirroredChar() const;
|
|
Packit |
1c1d7e |
QString decomposition() const;
|
|
Packit |
1c1d7e |
Decomposition decompositionTag() const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
char latin1() const { return rw ? 0 : cl; }
|
|
Packit |
1c1d7e |
ushort unicode() const { return (rw << 8) | cl; }
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CAST_ASCII
|
|
Packit |
1c1d7e |
// like all ifdef'd code this is undocumented
|
|
Packit |
1c1d7e |
operator char() const { return latin1(); }
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
bool isNull() const { return unicode()==0; }
|
|
Packit |
1c1d7e |
bool isPrint() const;
|
|
Packit |
1c1d7e |
bool isPunct() const;
|
|
Packit |
1c1d7e |
bool isSpace() const;
|
|
Packit |
1c1d7e |
bool isMark() const;
|
|
Packit |
1c1d7e |
bool isLetter() const;
|
|
Packit |
1c1d7e |
bool isNumber() const;
|
|
Packit |
1c1d7e |
bool isLetterOrNumber() const;
|
|
Packit |
1c1d7e |
bool isDigit() const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
uchar& cell() { return cl; }
|
|
Packit |
1c1d7e |
uchar& row() { return rw; }
|
|
Packit |
1c1d7e |
uchar cell() const { return cl; }
|
|
Packit |
1c1d7e |
uchar row() const { return rw; }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static bool networkOrdered() { return (int)net_ordered == 1; }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
friend inline int operator==( char ch, QChar c );
|
|
Packit |
1c1d7e |
friend inline int operator==( QChar c, char ch );
|
|
Packit |
1c1d7e |
friend inline int operator==( QChar c1, QChar c2 );
|
|
Packit |
1c1d7e |
friend inline int operator!=( QChar c1, QChar c2 );
|
|
Packit |
1c1d7e |
friend inline int operator!=( char ch, QChar c );
|
|
Packit |
1c1d7e |
friend inline int operator!=( QChar c, char ch );
|
|
Packit |
1c1d7e |
friend inline int operator<=( QChar c, char ch );
|
|
Packit |
1c1d7e |
friend inline int operator<=( char ch, QChar c );
|
|
Packit |
1c1d7e |
friend inline int operator<=( QChar c1, QChar c2 );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
private:
|
|
Packit |
1c1d7e |
#if defined(_WS_X11_) || defined(_OS_WIN32_BYTESWAP_) || defined( _WS_QWS_ )
|
|
Packit |
1c1d7e |
// XChar2b on X11, ushort on _OS_WIN32_BYTESWAP_
|
|
Packit |
1c1d7e |
//### QWS must be defined on a platform by platform basis
|
|
Packit |
1c1d7e |
uchar rw;
|
|
Packit |
1c1d7e |
uchar cl;
|
|
Packit |
1c1d7e |
#if defined(QT_QSTRING_UCS_4)
|
|
Packit |
1c1d7e |
ushort grp;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
enum { net_ordered = 1 };
|
|
Packit |
1c1d7e |
#else
|
|
Packit |
1c1d7e |
// ushort on _OS_WIN32_
|
|
Packit |
1c1d7e |
uchar cl;
|
|
Packit |
1c1d7e |
uchar rw;
|
|
Packit |
1c1d7e |
#if defined(QT_QSTRING_UCS_4)
|
|
Packit |
1c1d7e |
ushort grp;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
enum { net_ordered = 0 };
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QChar::QChar()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
rw = 0; cl = 0;
|
|
Packit |
1c1d7e |
#ifdef QT_QSTRING_UCS_4
|
|
Packit |
1c1d7e |
grp = 0;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
inline QChar::QChar( char c )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
rw = 0; cl = (uchar)c;
|
|
Packit |
1c1d7e |
#ifdef QT_QSTRING_UCS_4
|
|
Packit |
1c1d7e |
grp = 0;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
inline QChar::QChar( uchar c )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
rw = 0; cl = c;
|
|
Packit |
1c1d7e |
#ifdef QT_QSTRING_UCS_4
|
|
Packit |
1c1d7e |
grp = 0;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
inline QChar::QChar( uchar c, uchar r )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
rw = r; cl = c;
|
|
Packit |
1c1d7e |
#ifdef QT_QSTRING_UCS_4
|
|
Packit |
1c1d7e |
grp = 0;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
inline QChar::QChar( const QChar& c )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
rw = c.rw; cl = c.cl;
|
|
Packit |
1c1d7e |
#ifdef QT_QSTRING_UCS_4
|
|
Packit |
1c1d7e |
grp = 0;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
inline QChar::QChar( ushort rc )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
rw = (uchar)((rc>>8)&0xff); cl = (uchar)(rc&0xff);
|
|
Packit |
1c1d7e |
#ifdef QT_QSTRING_UCS_4
|
|
Packit |
1c1d7e |
grp = 0;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
inline QChar::QChar( short rc )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
rw = (uchar)((rc>>8)&0xff); cl = (uchar)(rc&0xff);
|
|
Packit |
1c1d7e |
#ifdef QT_QSTRING_UCS_4
|
|
Packit |
1c1d7e |
grp = 0;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
inline QChar::QChar( uint rc )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
rw = (uchar)((rc>>8)&0xff); cl = (uchar)(rc&0xff);
|
|
Packit |
1c1d7e |
#ifdef QT_QSTRING_UCS_4
|
|
Packit |
1c1d7e |
grp = 0;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
inline QChar::QChar( int rc )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
rw = (uchar)((rc>>8)&0xff); cl = (uchar)(rc&0xff);
|
|
Packit |
1c1d7e |
#ifdef QT_QSTRING_UCS_4
|
|
Packit |
1c1d7e |
grp = 0;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int operator==( char ch, QChar c )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return ch == c.cl && !c.rw;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int operator==( QChar c, char ch )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return ch == c.cl && !c.rw;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int operator==( QChar c1, QChar c2 )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return c1.cl == c2.cl
|
|
Packit |
1c1d7e |
&& c1.rw == c2.rw;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int operator!=( QChar c1, QChar c2 )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return c1.cl != c2.cl
|
|
Packit |
1c1d7e |
|| c1.rw != c2.rw;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int operator!=( char ch, QChar c )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return ch != c.cl || c.rw;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int operator!=( QChar c, char ch )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return ch != c.cl || c.rw;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int operator<=( QChar c, char ch )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return !(ch < c.cl || c.rw);
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int operator<=( char ch, QChar c )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return ch <= c.cl || c.rw;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int operator<=( QChar c1, QChar c2 )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
return c1.rw > c2.rw
|
|
Packit |
1c1d7e |
? FALSE
|
|
Packit |
1c1d7e |
: c1.rw < c2.rw
|
|
Packit |
1c1d7e |
? TRUE
|
|
Packit |
1c1d7e |
: c1.cl <= c2.cl;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int operator>=( QChar c, char ch ) { return ch <= c; }
|
|
Packit |
1c1d7e |
inline int operator>=( char ch, QChar c ) { return c <= ch; }
|
|
Packit |
1c1d7e |
inline int operator>=( QChar c1, QChar c2 ) { return c2 <= c1; }
|
|
Packit |
1c1d7e |
inline int operator<( QChar c, char ch ) { return !(ch<=c); }
|
|
Packit |
1c1d7e |
inline int operator<( char ch, QChar c ) { return !(c<=ch); }
|
|
Packit |
1c1d7e |
inline int operator<( QChar c1, QChar c2 ) { return !(c2<=c1); }
|
|
Packit |
1c1d7e |
inline int operator>( QChar c, char ch ) { return !(ch>=c); }
|
|
Packit |
1c1d7e |
inline int operator>( char ch, QChar c ) { return !(c>=ch); }
|
|
Packit |
1c1d7e |
inline int operator>( QChar c1, QChar c2 ) { return !(c2>=c1); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// internal
|
|
Packit |
1c1d7e |
struct Q_EXPORT QStringData : public QShared {
|
|
Packit |
1c1d7e |
QStringData() :
|
|
Packit |
1c1d7e |
unicode(0), ascii(0), len(0), maxl(0), dirtyascii(0) { ref(); }
|
|
Packit |
1c1d7e |
QStringData(QChar *u, uint l, uint m) :
|
|
Packit |
1c1d7e |
unicode(u), ascii(0), len(l), maxl(m), dirtyascii(0) { }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
~QStringData() { if ( unicode ) delete[] ((char*)unicode);
|
|
Packit |
1c1d7e |
if ( ascii ) delete[] ascii; }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
void deleteSelf();
|
|
Packit |
1c1d7e |
QChar *unicode;
|
|
Packit |
1c1d7e |
char *ascii;
|
|
Packit |
1c1d7e |
uint len;
|
|
Packit |
1c1d7e |
uint maxl:30;
|
|
Packit |
1c1d7e |
uint dirtyascii:1;
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class Q_EXPORT QString
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QString(); // make null string
|
|
Packit |
1c1d7e |
QString( QChar ); // one-char string
|
|
Packit |
1c1d7e |
QString( const QString & ); // impl-shared copy
|
|
Packit |
1c1d7e |
QString( const QByteArray& ); // deep copy
|
|
Packit |
1c1d7e |
QString( const QCString& ); // deep copy
|
|
Packit |
1c1d7e |
QString( const QChar* unicode, uint length ); // deep copy
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CAST_ASCII
|
|
Packit |
1c1d7e |
QString( const char *str ); // deep copy
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
~QString();
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString &operator=( const QString & ); // impl-shared copy
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CAST_ASCII
|
|
Packit |
1c1d7e |
QString &operator=( const char * ); // deep copy
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
QString &operator=( const QCString& ); // deep copy
|
|
Packit |
1c1d7e |
QString &operator=( QChar c );
|
|
Packit |
1c1d7e |
QString &operator=( char c );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
//QT_STATIC_CONST QString null;
|
|
Packit |
1c1d7e |
//bool isNull() const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
struct Null { };
|
|
Packit |
1c1d7e |
static const Null null;
|
|
Packit |
1c1d7e |
inline QString(const Null &): d(shared_null) { d->ref(); }
|
|
Packit |
1c1d7e |
inline QString &operator=(const Null &) { *this = QString(); return *this; }
|
|
Packit |
1c1d7e |
inline bool isNull() const { return d == shared_null; }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
bool isEmpty() const;
|
|
Packit |
1c1d7e |
uint length() const;
|
|
Packit |
1c1d7e |
void truncate( uint pos );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#if QT_VERSION >= 300
|
|
Packit |
1c1d7e |
#error "fill() Should return *this, or QChar constructor should take count=1"
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
void fill( QChar c, int len = -1 );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString copy() const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString arg(long a, int fieldwidth=0, int base=10) const;
|
|
Packit |
1c1d7e |
QString arg(ulong a, int fieldwidth=0, int base=10) const;
|
|
Packit |
1c1d7e |
QString arg(int a, int fieldwidth=0, int base=10) const;
|
|
Packit |
1c1d7e |
QString arg(uint a, int fieldwidth=0, int base=10) const;
|
|
Packit |
1c1d7e |
QString arg(short a, int fieldwidth=0, int base=10) const;
|
|
Packit |
1c1d7e |
QString arg(ushort a, int fieldwidth=0, int base=10) const;
|
|
Packit |
1c1d7e |
QString arg(char a, int fieldwidth=0) const;
|
|
Packit |
1c1d7e |
QString arg(QChar a, int fieldwidth=0) const;
|
|
Packit |
1c1d7e |
QString arg(const QString& a, int fieldwidth=0) const;
|
|
Packit |
1c1d7e |
QString arg(double a, int fieldwidth=0, char fmt='g', int prec=-1) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString &sprintf( const char* format, ... )
|
|
Packit |
1c1d7e |
#if defined(_CC_GNU_) && !defined(__INSURE__)
|
|
Packit |
1c1d7e |
__attribute__ ((format (printf, 2, 3)))
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int find( QChar c, int index=0, bool cs=TRUE ) const;
|
|
Packit |
1c1d7e |
int find( char c, int index=0, bool cs=TRUE ) const;
|
|
Packit |
1c1d7e |
int find( const QString &str, int index=0, bool cs=TRUE ) const;
|
|
Packit |
1c1d7e |
int find( const QRegExp &, int index=0 ) const;
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CAST_ASCII
|
|
Packit |
1c1d7e |
int find( const char* str, int index=0 ) const;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
int findRev( QChar c, int index=-1, bool cs=TRUE) const;
|
|
Packit |
1c1d7e |
int findRev( char c, int index=-1, bool cs=TRUE) const;
|
|
Packit |
1c1d7e |
int findRev( const QString &str, int index=-1, bool cs=TRUE) const;
|
|
Packit |
1c1d7e |
int findRev( const QRegExp &, int index=-1 ) const;
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CAST_ASCII
|
|
Packit |
1c1d7e |
int findRev( const char* str, int index=-1 ) const;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
int contains( QChar c, bool cs=TRUE ) const;
|
|
Packit |
1c1d7e |
int contains( char c, bool cs=TRUE ) const
|
|
Packit |
1c1d7e |
{ return contains(QChar(c), cs); }
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CAST_ASCII
|
|
Packit |
1c1d7e |
int contains( const char* str, bool cs=TRUE ) const;
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
int contains( const QString &str, bool cs=TRUE ) const;
|
|
Packit |
1c1d7e |
int contains( const QRegExp & ) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString left( uint len ) const;
|
|
Packit |
1c1d7e |
QString right( uint len ) const;
|
|
Packit |
1c1d7e |
QString mid( uint index, uint len=0xffffffff) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString leftJustify( uint width, QChar fill=' ', bool trunc=FALSE)const;
|
|
Packit |
1c1d7e |
QString rightJustify( uint width, QChar fill=' ',bool trunc=FALSE)const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString lower() const;
|
|
Packit |
1c1d7e |
QString upper() const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString stripWhiteSpace() const;
|
|
Packit |
1c1d7e |
QString simplifyWhiteSpace() const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString &insert( uint index, const QString & );
|
|
Packit |
1c1d7e |
QString &insert( uint index, const QChar*, uint len );
|
|
Packit |
1c1d7e |
QString &insert( uint index, QChar );
|
|
Packit |
1c1d7e |
QString &insert( uint index, char c ) { return insert(index,QChar(c)); }
|
|
Packit |
1c1d7e |
QString &append( char );
|
|
Packit |
1c1d7e |
QString &append( QChar );
|
|
Packit |
1c1d7e |
QString &append( const QString & );
|
|
Packit |
1c1d7e |
QString &prepend( char );
|
|
Packit |
1c1d7e |
QString &prepend( QChar );
|
|
Packit |
1c1d7e |
QString &prepend( const QString & );
|
|
Packit |
1c1d7e |
QString &remove( uint index, uint len );
|
|
Packit |
1c1d7e |
QString &replace( uint index, uint len, const QString & );
|
|
Packit |
1c1d7e |
QString &replace( uint index, uint len, const QChar*, uint clen );
|
|
Packit |
1c1d7e |
QString &replace( const QRegExp &, const QString & );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
short toShort( bool *ok=0, int base=10 ) const;
|
|
Packit |
1c1d7e |
ushort toUShort( bool *ok=0, int base=10 ) const;
|
|
Packit |
1c1d7e |
int toInt( bool *ok=0, int base=10 ) const;
|
|
Packit |
1c1d7e |
uint toUInt( bool *ok=0, int base=10 ) const;
|
|
Packit |
1c1d7e |
long toLong( bool *ok=0, int base=10 ) const;
|
|
Packit |
1c1d7e |
ulong toULong( bool *ok=0, int base=10 ) const;
|
|
Packit |
1c1d7e |
uint64 toUInt64( bool *ok=0, int base=10 ) const;
|
|
Packit |
1c1d7e |
float toFloat( bool *ok=0 ) const;
|
|
Packit |
1c1d7e |
double toDouble( bool *ok=0 ) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString &setNum( short, int base=10 );
|
|
Packit |
1c1d7e |
QString &setNum( ushort, int base=10 );
|
|
Packit |
1c1d7e |
QString &setNum( int, int base=10 );
|
|
Packit |
1c1d7e |
QString &setNum( uint, int base=10 );
|
|
Packit |
1c1d7e |
QString &setNum( long, int base=10 );
|
|
Packit |
1c1d7e |
QString &setNum( ulong, int base=10 );
|
|
Packit |
1c1d7e |
QString &setNum( float, char f='g', int prec=6 );
|
|
Packit |
1c1d7e |
QString &setNum( double, char f='g', int prec=6 );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static QString number( long, int base=10 );
|
|
Packit |
1c1d7e |
static QString number( ulong, int base=10);
|
|
Packit |
1c1d7e |
static QString number( int, int base=10 );
|
|
Packit |
1c1d7e |
static QString number( uint, int base=10);
|
|
Packit |
1c1d7e |
static QString number( double, char f='g', int prec=6 );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
void setExpand( uint index, QChar c );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString &operator+=( const QString &str );
|
|
Packit |
1c1d7e |
QString &operator+=( QChar c );
|
|
Packit |
1c1d7e |
QString &operator+=( char c );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// Your compiler is smart enough to use the const one if it can.
|
|
Packit |
1c1d7e |
QChar at( uint i ) const
|
|
Packit |
1c1d7e |
{ return i<d->len ? d->unicode[i] : QChar::null; }
|
|
Packit |
1c1d7e |
QChar operator[]( int i ) const { return at((uint)i); }
|
|
Packit |
1c1d7e |
QCharRef at( uint i );
|
|
Packit |
1c1d7e |
QCharRef operator[]( int i );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QChar constref(uint i) const
|
|
Packit |
1c1d7e |
{ return at(i); }
|
|
Packit |
1c1d7e |
QChar& ref(uint i)
|
|
Packit |
1c1d7e |
{ // Optimized for easy-inlining by simple compilers.
|
|
Packit |
1c1d7e |
if (d->count!=1 || i>=d->len)
|
|
Packit |
1c1d7e |
subat(i);
|
|
Packit |
1c1d7e |
d->dirtyascii=1;
|
|
Packit |
1c1d7e |
return d->unicode[i];
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
const QChar* unicode() const { return d->unicode; }
|
|
Packit |
1c1d7e |
const char* ascii() const;
|
|
Packit |
1c1d7e |
const char* latin1() const;
|
|
Packit |
1c1d7e |
static QString fromLatin1(const char*, int len=-1);
|
|
Packit |
1c1d7e |
const unsigned short *ucs2() const;
|
|
Packit |
1c1d7e |
static QString fromUcs2( const unsigned short *ucs2 );
|
|
Packit |
1c1d7e |
#ifndef QT_NO_TEXTCODEC
|
|
Packit |
1c1d7e |
QCString utf8() const;
|
|
Packit |
1c1d7e |
static QString fromUtf8(const char*, int len=-1);
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
QCString local8Bit() const;
|
|
Packit |
1c1d7e |
static QString fromLocal8Bit(const char*, int len=-1);
|
|
Packit |
1c1d7e |
bool operator!() const;
|
|
Packit |
1c1d7e |
#ifndef QT_NO_ASCII_CAST
|
|
Packit |
1c1d7e |
operator const char *() const { return latin1(); }
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QString &setUnicode( const QChar* unicode, uint len );
|
|
Packit |
1c1d7e |
QString &setUnicodeCodes( const ushort* unicode_as_ushorts, uint len );
|
|
Packit |
1c1d7e |
QString &setLatin1( const char*, int len=-1 );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int compare( const QString& s ) const;
|
|
Packit |
1c1d7e |
static int compare( const QString& s1, const QString& s2 )
|
|
Packit |
1c1d7e |
{ return s1.compare(s2); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QT_NO_DATASTREAM
|
|
Packit |
1c1d7e |
friend Q_EXPORT QDataStream &operator>>( QDataStream &, QString & );
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
// new functions for BiDi
|
|
Packit |
1c1d7e |
void compose();
|
|
Packit |
1c1d7e |
QChar::Direction basicDirection();
|
|
Packit |
1c1d7e |
QString visual(int index = 0, int len = -1);
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QT_NO_COMPAT
|
|
Packit |
1c1d7e |
const char* data() const { return latin1(); }
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
bool startsWith( const QString& ) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
private:
|
|
Packit |
1c1d7e |
QString( int size, bool dummy ); // allocate size incl. \0
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
void deref();
|
|
Packit |
1c1d7e |
void real_detach();
|
|
Packit |
1c1d7e |
void setLength( uint pos );
|
|
Packit |
1c1d7e |
void subat( uint );
|
|
Packit |
1c1d7e |
bool findArg(int& pos, int& len) const;
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
static QChar* asciiToUnicode( const char*, uint * len, uint maxlen=(uint)-1 );
|
|
Packit |
1c1d7e |
static QChar* asciiToUnicode( const QByteArray&, uint * len );
|
|
Packit |
1c1d7e |
static char* unicodeToAscii( const QChar*, uint len );
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QStringData *d;
|
|
Packit |
1c1d7e |
static QStringData* shared_null;
|
|
Packit |
1c1d7e |
static QStringData* makeSharedNull();
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
friend class QConstString;
|
|
Packit |
1c1d7e |
QString(QStringData* dd, bool /*dummy*/) : d(dd) { }
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class Q_EXPORT QCharRef {
|
|
Packit |
1c1d7e |
friend class QString;
|
|
Packit |
1c1d7e |
QString& s;
|
|
Packit |
1c1d7e |
uint p;
|
|
Packit |
1c1d7e |
QCharRef(QString* str, uint pos) : s(*str), p(pos) { }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
// Most QChar operations repeated here...
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// all this is not documented: We just say "like QChar" and let it be.
|
|
Packit |
1c1d7e |
#if 1
|
|
Packit |
1c1d7e |
ushort unicode() const { return s.constref(p).unicode(); }
|
|
Packit |
1c1d7e |
char latin1() const { return s.constref(p).latin1(); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// An operator= for each QChar cast constructor...
|
|
Packit |
1c1d7e |
QCharRef operator=(char c ) { s.ref(p)=c; return *this; }
|
|
Packit |
1c1d7e |
QCharRef operator=(uchar c ) { s.ref(p)=c; return *this; }
|
|
Packit |
1c1d7e |
QCharRef operator=(QChar c ) { s.ref(p)=c; return *this; }
|
|
Packit |
1c1d7e |
QCharRef operator=(const QCharRef& c ) { s.ref(p)=c.unicode(); return *this; }
|
|
Packit |
1c1d7e |
QCharRef operator=(ushort rc ) { s.ref(p)=rc; return *this; }
|
|
Packit |
1c1d7e |
QCharRef operator=(short rc ) { s.ref(p)=rc; return *this; }
|
|
Packit |
1c1d7e |
QCharRef operator=(uint rc ) { s.ref(p)=rc; return *this; }
|
|
Packit |
1c1d7e |
QCharRef operator=(int rc ) { s.ref(p)=rc; return *this; }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
operator QChar () const { return s.constref(p); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// each function...
|
|
Packit |
1c1d7e |
bool isNull() const { return unicode()==0; }
|
|
Packit |
1c1d7e |
bool isPrint() const { return s.constref(p).isPrint(); }
|
|
Packit |
1c1d7e |
bool isPunct() const { return s.constref(p).isPunct(); }
|
|
Packit |
1c1d7e |
bool isSpace() const { return s.constref(p).isSpace(); }
|
|
Packit |
1c1d7e |
bool isMark() const { return s.constref(p).isMark(); }
|
|
Packit |
1c1d7e |
bool isLetter() const { return s.constref(p).isLetter(); }
|
|
Packit |
1c1d7e |
bool isNumber() const { return s.constref(p).isNumber(); }
|
|
Packit |
1c1d7e |
bool isLetterOrNumber() { return s.constref(p).isLetterOrNumber(); }
|
|
Packit |
1c1d7e |
bool isDigit() const { return s.constref(p).isDigit(); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
int digitValue() const { return s.constref(p).digitValue(); }
|
|
Packit |
1c1d7e |
QChar lower() { return s.constref(p).lower(); }
|
|
Packit |
1c1d7e |
QChar upper() { return s.constref(p).upper(); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
QChar::Category category() const { return s.constref(p).category(); }
|
|
Packit |
1c1d7e |
QChar::Direction direction() const { return s.constref(p).direction(); }
|
|
Packit |
1c1d7e |
QChar::Joining joining() const { return s.constref(p).joining(); }
|
|
Packit |
1c1d7e |
bool mirrored() const { return s.constref(p).mirrored(); }
|
|
Packit |
1c1d7e |
QChar mirroredChar() const { return s.constref(p).mirroredChar(); }
|
|
Packit |
1c1d7e |
QString decomposition() const { return s.constref(p).decomposition(); }
|
|
Packit |
1c1d7e |
QChar::Decomposition decompositionTag() const { return s.constref(p).decompositionTag(); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// Not the non-const ones of these.
|
|
Packit |
1c1d7e |
uchar cell() const { return s.constref(p).cell(); }
|
|
Packit |
1c1d7e |
uchar row() const { return s.constref(p).row(); }
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QCharRef QString::at( uint i ) { return QCharRef(this,i); }
|
|
Packit |
1c1d7e |
inline QCharRef QString::operator[]( int i ) { return at((uint)i); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
class Q_EXPORT QConstString : private QString {
|
|
Packit |
1c1d7e |
public:
|
|
Packit |
1c1d7e |
QConstString( QChar* unicode, uint length );
|
|
Packit |
1c1d7e |
~QConstString();
|
|
Packit |
1c1d7e |
const QString& string() const { return *this; }
|
|
Packit |
1c1d7e |
};
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*****************************************************************************
|
|
Packit |
1c1d7e |
QString stream functions
|
|
Packit |
1c1d7e |
*****************************************************************************/
|
|
Packit |
1c1d7e |
#ifndef QT_NO_DATASTREAM
|
|
Packit |
1c1d7e |
Q_EXPORT QDataStream &operator<<( QDataStream &, const QString & );
|
|
Packit |
1c1d7e |
Q_EXPORT QDataStream &operator>>( QDataStream &, QString & );
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*****************************************************************************
|
|
Packit |
1c1d7e |
QString inline functions
|
|
Packit |
1c1d7e |
*****************************************************************************/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
// These two move code into makeSharedNull() and deletesData()
|
|
Packit |
1c1d7e |
// to improve cache-coherence (and reduce code bloat), while
|
|
Packit |
1c1d7e |
// keeping the common cases fast.
|
|
Packit |
1c1d7e |
//
|
|
Packit |
1c1d7e |
// No safe way to pre-init shared_null on ALL compilers/linkers.
|
|
Packit |
1c1d7e |
inline QString::QString() :
|
|
Packit |
1c1d7e |
d(shared_null ? shared_null : makeSharedNull())
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
d->ref();
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
//
|
|
Packit |
1c1d7e |
inline QString::~QString()
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
if ( d->deref() ) {
|
|
Packit |
1c1d7e |
if ( d == shared_null )
|
|
Packit |
1c1d7e |
shared_null = 0;
|
|
Packit |
1c1d7e |
d->deleteSelf();
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::operator=( QChar c )
|
|
Packit |
1c1d7e |
{ return *this = QString(c); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::operator=( char c )
|
|
Packit |
1c1d7e |
{ return *this = QString(QChar(c)); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
//inline bool QString::isNull() const
|
|
Packit |
1c1d7e |
//{ return unicode() == 0; }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline bool QString::operator!() const
|
|
Packit |
1c1d7e |
{ return isNull(); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline uint QString::length() const
|
|
Packit |
1c1d7e |
{ return d->len; }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline bool QString::isEmpty() const
|
|
Packit |
1c1d7e |
{ return length() == 0; }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString QString::copy() const
|
|
Packit |
1c1d7e |
{ return QString( *this ); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::prepend( const QString & s )
|
|
Packit |
1c1d7e |
{ return insert(0,s); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::prepend( QChar c )
|
|
Packit |
1c1d7e |
{ return insert(0,c); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::prepend( char c )
|
|
Packit |
1c1d7e |
{ return insert(0,c); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::append( const QString & s )
|
|
Packit |
1c1d7e |
{ return operator+=(s); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::append( QChar c )
|
|
Packit |
1c1d7e |
{ return operator+=(c); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::append( char c )
|
|
Packit |
1c1d7e |
{ return operator+=(c); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::setNum( short n, int base )
|
|
Packit |
1c1d7e |
{ return setNum((long)n, base); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::setNum( ushort n, int base )
|
|
Packit |
1c1d7e |
{ return setNum((ulong)n, base); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::setNum( int n, int base )
|
|
Packit |
1c1d7e |
{ return setNum((long)n, base); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::setNum( uint n, int base )
|
|
Packit |
1c1d7e |
{ return setNum((ulong)n, base); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString &QString::setNum( float n, char f, int prec )
|
|
Packit |
1c1d7e |
{ return setNum((double)n,f,prec); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString QString::arg(int a, int fieldwidth, int base) const
|
|
Packit |
1c1d7e |
{ return arg((long)a, fieldwidth, base); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString QString::arg(uint a, int fieldwidth, int base) const
|
|
Packit |
1c1d7e |
{ return arg((ulong)a, fieldwidth, base); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString QString::arg(short a, int fieldwidth, int base) const
|
|
Packit |
1c1d7e |
{ return arg((long)a, fieldwidth, base); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline QString QString::arg(ushort a, int fieldwidth, int base) const
|
|
Packit |
1c1d7e |
{ return arg((ulong)a, fieldwidth, base); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int QString::find( char c, int index, bool cs ) const
|
|
Packit |
1c1d7e |
{ return find(QChar(c), index, cs); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int QString::findRev( char c, int index, bool cs) const
|
|
Packit |
1c1d7e |
{ return findRev( QChar(c), index, cs ); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CAST_ASCII
|
|
Packit |
1c1d7e |
inline int QString::find( const char* str, int index ) const
|
|
Packit |
1c1d7e |
{ return find(QString::fromLatin1(str), index); }
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
inline int QString::findRev( const char* str, int index ) const
|
|
Packit |
1c1d7e |
{ return findRev(QString::fromLatin1(str), index); }
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
/*****************************************************************************
|
|
Packit |
1c1d7e |
QString non-member operators
|
|
Packit |
1c1d7e |
*****************************************************************************/
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator!=( const QString &s1, const QString &s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator<( const QString &s1, const QString &s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator<=( const QString &s1, const QString &s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator==( const QString &s1, const QString &s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator>( const QString &s1, const QString &s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator>=( const QString &s1, const QString &s2 );
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CAST_ASCII
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator!=( const QString &s1, const char *s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator<( const QString &s1, const char *s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator<=( const QString &s1, const char *s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator==( const QString &s1, const char *s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator>( const QString &s1, const char *s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator>=( const QString &s1, const char *s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator!=( const char *s1, const QString &s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator<( const char *s1, const QString &s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator<=( const char *s1, const QString &s2 );
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator==( const char *s1, const QString &s2 );
|
|
Packit |
1c1d7e |
//Q_EXPORT bool operator>( const char *s1, const QString &s2 ); // MSVC++
|
|
Packit |
1c1d7e |
Q_EXPORT bool operator>=( const char *s1, const QString &s2 );
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Q_EXPORT inline QString operator+( const QString &s1, const QString &s2 )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QString tmp( s1 );
|
|
Packit |
1c1d7e |
tmp += s2;
|
|
Packit |
1c1d7e |
return tmp;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#ifndef QT_NO_CAST_ASCII
|
|
Packit |
1c1d7e |
Q_EXPORT inline QString operator+( const QString &s1, const char *s2 )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QString tmp( s1 );
|
|
Packit |
1c1d7e |
tmp += QString::fromLatin1(s2);
|
|
Packit |
1c1d7e |
return tmp;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Q_EXPORT inline QString operator+( const char *s1, const QString &s2 )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QString tmp = QString::fromLatin1( s1 );
|
|
Packit |
1c1d7e |
tmp += s2;
|
|
Packit |
1c1d7e |
return tmp;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Q_EXPORT inline QString operator+( const QString &s1, QChar c2 )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QString tmp( s1 );
|
|
Packit |
1c1d7e |
tmp += c2;
|
|
Packit |
1c1d7e |
return tmp;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Q_EXPORT inline QString operator+( const QString &s1, char c2 )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QString tmp( s1 );
|
|
Packit |
1c1d7e |
tmp += c2;
|
|
Packit |
1c1d7e |
return tmp;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Q_EXPORT inline QString operator+( QChar c1, const QString &s2 )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QString tmp;
|
|
Packit |
1c1d7e |
tmp += c1;
|
|
Packit |
1c1d7e |
tmp += s2;
|
|
Packit |
1c1d7e |
return tmp;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
Q_EXPORT inline QString operator+( char c1, const QString &s2 )
|
|
Packit |
1c1d7e |
{
|
|
Packit |
1c1d7e |
QString tmp;
|
|
Packit |
1c1d7e |
tmp += c1;
|
|
Packit |
1c1d7e |
tmp += s2;
|
|
Packit |
1c1d7e |
return tmp;
|
|
Packit |
1c1d7e |
}
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#if defined(_OS_WIN32_)
|
|
Packit |
1c1d7e |
extern Q_EXPORT QString qt_winQString(void*);
|
|
Packit |
1c1d7e |
extern Q_EXPORT const void* qt_winTchar(const QString& str, bool addnul);
|
|
Packit |
1c1d7e |
extern Q_EXPORT void* qt_winTchar_new(const QString& str);
|
|
Packit |
1c1d7e |
extern Q_EXPORT QCString qt_winQString2MB( const QString& s, int len=-1 );
|
|
Packit |
1c1d7e |
extern Q_EXPORT QString qt_winMB2QString( const char* mb, int len=-1 );
|
|
Packit |
1c1d7e |
#endif
|
|
Packit |
1c1d7e |
|
|
Packit |
1c1d7e |
#endif // QSTRING_H
|