⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qstring.h

📁 奇趣公司比较新的qt/emd版本
💻 H
📖 第 1 页 / 共 4 页
字号:
/******************************************************************************** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved.**** This file is part of the QtCore module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file.  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.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#ifndef QSTRING_H#define QSTRING_H#include <QtCore/qchar.h>#include <QtCore/qbytearray.h>#include <QtCore/qatomic.h>#include <QtCore/qnamespace.h>#ifdef QT_INCLUDE_COMPAT#include <Qt3Support/q3cstring.h>#endif#ifndef QT_NO_STL#  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#  ifndef QT_NO_STL_WCHAR// workaround for some headers not typedef'ing std::wstringtypedef std::basic_string<wchar_t> QStdWString;#  endif // QT_NO_STL_WCHAR#endif // QT_NO_STL#include <stdarg.h>#ifdef truncate#error qstring.h must be included before any header file that defines truncate#endifQT_BEGIN_HEADERQT_MODULE(Core)class QCharRef;class QRegExp;class QStringList;class QTextCodec;class QLatin1String;class QStringRef;template <typename T> class QVector;class Q_CORE_EXPORT QString{public:    inline QString();    QString(const QChar *unicode, int size);    QString(QChar c);    QString(int size, QChar c);    inline QString(const QLatin1String &latin1);    inline QString(const QString &);    inline ~QString();    QString &operator=(QChar c);    QString &operator=(const QString &);    inline QString &operator=(const QLatin1String &);    inline int size() const { return d->size; }    inline int count() const { return d->size; }    inline int length() const;    inline bool isEmpty() const;    void resize(int size);    QString &fill(QChar c, int size = -1);    void truncate(int pos);    void chop(int n);    int capacity() const;    inline void reserve(int size);    inline void squeeze() { if (d->size < d->alloc) realloc(); d->capacity = 0;}    inline const QChar *unicode() const;    inline QChar *data();    inline const QChar *data() const;    inline const QChar *constData() const;    inline void detach();    inline bool isDetached() const;    void clear();    inline const QChar at(int i) const;    const QChar operator[](int i) const;    QCharRef operator[](int i);    const QChar operator[](uint i) const;    QCharRef operator[](uint i);    QString arg(qlonglong a, int fieldwidth=0, int base=10,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(qulonglong a, int fieldwidth=0, int base=10,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(long a, int fieldwidth=0, int base=10,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(ulong a, int fieldwidth=0, int base=10,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(int a, int fieldWidth = 0, int base = 10,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(uint a, int fieldWidth = 0, int base = 10,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(short a, int fieldWidth = 0, int base = 10,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(ushort a, int fieldWidth = 0, int base = 10,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(double a, int fieldWidth = 0, char fmt = 'g', int prec = -1,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(char a, int fieldWidth = 0,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(QChar a, int fieldWidth = 0,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(const QString &a, int fieldWidth = 0,                const QChar &fillChar = QLatin1Char(' ')) const Q_REQUIRED_RESULT;    QString arg(const QString &a1, const QString &a2) const Q_REQUIRED_RESULT;    QString arg(const QString &a1, const QString &a2, const QString &a3) const Q_REQUIRED_RESULT;    QString arg(const QString &a1, const QString &a2, const QString &a3,                const QString &a4) const Q_REQUIRED_RESULT;    QString arg(const QString &a1, const QString &a2, const QString &a3,                const QString &a4, const QString &a5) const Q_REQUIRED_RESULT;    QString arg(const QString &a1, const QString &a2, const QString &a3,                const QString &a4, const QString &a5, const QString &a6) const Q_REQUIRED_RESULT;    QString arg(const QString &a1, const QString &a2, const QString &a3,                const QString &a4, const QString &a5, const QString &a6,                const QString &a7) const Q_REQUIRED_RESULT;    QString arg(const QString &a1, const QString &a2, const QString &a3,                const QString &a4, const QString &a5, const QString &a6,                const QString &a7, const QString &a8) const Q_REQUIRED_RESULT;    QString arg(const QString &a1, const QString &a2, const QString &a3,                const QString &a4, const QString &a5, const QString &a6,                const QString &a7, const QString &a8, const QString &a9) const Q_REQUIRED_RESULT;    QString    &vsprintf(const char *format, va_list ap);    QString    &sprintf(const char *format, ...)#if defined(Q_CC_GNU) && !defined(__INSURE__)        __attribute__ ((format (printf, 2, 3)))#endif        ;    int indexOf(QChar c, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    int indexOf(const QString &s, int from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    int lastIndexOf(QChar c, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    int lastIndexOf(const QString &s, int from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    inline QBool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    inline QBool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    int count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    int count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;#ifndef QT_NO_REGEXP    int indexOf(const QRegExp &, int from = 0) const;    int lastIndexOf(const QRegExp &, int from = -1) const;    inline QBool contains(const QRegExp &rx) const { return QBool(indexOf(rx) != -1); }    int count(const QRegExp &) const;#endif    enum SectionFlag {        SectionDefault             = 0x00,        SectionSkipEmpty           = 0x01,        SectionIncludeLeadingSep   = 0x02,        SectionIncludeTrailingSep  = 0x04,        SectionCaseInsensitiveSeps = 0x08    };    Q_DECLARE_FLAGS(SectionFlags, SectionFlag)    QString section(QChar sep, int start, int end = -1, SectionFlags flags = SectionDefault) const;    QString section(const QString &in_sep, int start, int end = -1, SectionFlags flags = SectionDefault) const;#ifndef QT_NO_REGEXP    QString section(const QRegExp &reg, int start, int end = -1, SectionFlags flags = SectionDefault) const;#endif    QString left(int n) const Q_REQUIRED_RESULT;    QString right(int n) const Q_REQUIRED_RESULT;    QString mid(int position, int n = -1) const Q_REQUIRED_RESULT;    bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    bool startsWith(const QLatin1String &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    bool startsWith(const QChar &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    bool endsWith(const QLatin1String &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    bool endsWith(const QChar &c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;    QString leftJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT;    QString rightJustified(int width, QChar fill = QLatin1Char(' '), bool trunc = false) const Q_REQUIRED_RESULT;    QString toLower() const Q_REQUIRED_RESULT;    QString toUpper() const Q_REQUIRED_RESULT;    QString toCaseFolded() const Q_REQUIRED_RESULT;    QString trimmed() const Q_REQUIRED_RESULT;    QString simplified() const Q_REQUIRED_RESULT;    QString &insert(int i, QChar c);    QString &insert(int i, const QChar *uc, int len);    inline QString &insert(int i, const QString &s) { return insert(i, s.constData(), s.length()); }    QString &insert(int i, const QLatin1String &s);    QString &append(QChar c);    QString &append(const QString &s);    QString &append(const QLatin1String &s);    inline QString &prepend(QChar c) { return insert(0, c); }    inline QString &prepend(const QString &s) { return insert(0, s); }    inline QString &prepend(const QLatin1String &s) { return insert(0, s); }    inline QString &operator+=(QChar c) { return append(c); }    inline QString &operator+=(QChar::SpecialCharacter c) { return append(QChar(c)); }    inline QString &operator+=(const QString &s) { return append(s); }    inline QString &operator+=(const QLatin1String &s) { return append(s); }    QString &remove(int i, int len);    QString &remove(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive);    QString &remove(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive);    QString &replace(int i, int len, QChar after);    QString &replace(int i, int len, const QChar *s, int slen);    QString &replace(int i, int len, const QString &after);    QString &replace(QChar before, QChar after, Qt::CaseSensitivity cs = Qt::CaseSensitive);    QString &replace(QChar c, const QString &after, Qt::CaseSensitivity cs = Qt::CaseSensitive);    QString &replace(const QString &before, const QString &after,                     Qt::CaseSensitivity cs = Qt::CaseSensitive);#ifndef QT_NO_REGEXP    QString &replace(const QRegExp &rx, const QString &after);    inline QString &remove(const QRegExp &rx)    { return replace(rx, QString()); }#endif    enum SplitBehavior { KeepEmptyParts, SkipEmptyParts };    QStringList split(const QString &sep, SplitBehavior behavior = KeepEmptyParts,                      Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT;    QStringList split(const QChar &sep, SplitBehavior behavior = KeepEmptyParts,                      Qt::CaseSensitivity cs = Qt::CaseSensitive) const Q_REQUIRED_RESULT;#ifndef QT_NO_REGEXP    QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT;#endif    enum NormalizationForm {        NormalizationForm_D,        NormalizationForm_C,        NormalizationForm_KD,        NormalizationForm_KC    };    QString normalized(NormalizationForm mode) const Q_REQUIRED_RESULT;    QString normalized(NormalizationForm mode, QChar::UnicodeVersion version) const Q_REQUIRED_RESULT;    const ushort *utf16() const;    QByteArray toAscii() const Q_REQUIRED_RESULT;    QByteArray toLatin1() const Q_REQUIRED_RESULT;    QByteArray toUtf8() const Q_REQUIRED_RESULT;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -