Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qstring.h File Reference

(a30824a9846a67aa0d6207b4dfcbf925ce8d50e9)

#include <QtCore/qchar.h>
#include <QtCore/qcompare.h>
#include <QtCore/qbytearray.h>
#include <QtCore/qbytearrayview.h>
#include <QtCore/qarraydata.h>
#include <QtCore/qlatin1stringview.h>
#include <QtCore/qnamespace.h>
#include <QtCore/qstringliteral.h>
#include <QtCore/qstringalgorithms.h>
#include <QtCore/qanystringview.h>
#include <QtCore/qstringtokenizer.h>
#include <string>
#include <iterator>
#include <QtCore/q20memory.h>
#include <string_view>
#include <stdarg.h>
#include <QtCore/qstringbuilder.h>
#include <QtCore/qstringconverter.h>
+ Include dependency graph for qstring.h:

Go to the source code of this file.

Classes

class  QString
 \macro QT_RESTRICTED_CAST_FROM_ASCII More...
 
struct  QtPrivate::ArgBase
 
struct  QtPrivate::QStringViewArg
 
struct  QtPrivate::QLatin1StringArg
 

Namespaces

namespace  QtPrivate
 \macro QT_NO_KEYWORDS >
 
namespace  Qt
 
namespace  Qt::Literals
 
namespace  Qt::Literals::StringLiterals
 
namespace  QtLiterals
 

Macros

#define qPrintable(string)   QtPrivate::asString(string).toLocal8Bit().constData()
 
#define qUtf8Printable(string)   QtPrivate::asString(string).toUtf8().constData()
 
#define qUtf16Printable(string)    static_cast<const wchar_t*>(static_cast<const void*>(QtPrivate::asString(string).utf16()))
 

Typedefs

template<typename Char >
using QtPrivate::IsCompatibleChar32TypeHelper
 
template<typename Char >
using QtPrivate::IsCompatibleChar32Type = IsCompatibleChar32TypeHelper<q20::remove_cvref_t<Char>>
 

Functions

QString operator+ (const QString &s1, const QString &s2)
 
QString operator+ (QString &&lhs, const QString &rhs)
 
QString operator+ (const QString &s1, QChar s2)
 
QString operator+ (QString &&lhs, QChar rhs)
 
QString operator+ (QChar s1, const QString &s2)
 
QT_ASCII_CAST_WARN QString operator+ (const QString &s1, const char *s2)
 
QT_ASCII_CAST_WARN QString operator+ (QString &&lhs, const char *rhs)
 
QT_ASCII_CAST_WARN QString operator+ (const char *s1, const QString &s2)
 
QT_ASCII_CAST_WARN QString operator+ (const QByteArray &ba, const QString &s)
 
QT_ASCII_CAST_WARN QString operator+ (const QString &s, const QByteArray &ba)
 
QT_ASCII_CAST_WARN QString operator+ (QString &&lhs, const QByteArray &rhs)
 
Q_CORE_EXPORT QDataStreamoperator<< (QDataStream &, const QString &)
 
Q_CORE_EXPORT QDataStreamoperator>> (QDataStream &, QString &)
 
const QStringQtPrivate::asString (const QString &s)
 
QString && QtPrivate::asString (QString &&s)
 
Q_CORE_EXPORT QString QtPrivate::argToQString (QStringView pattern, size_t n, const ArgBase **args)
 
Q_CORE_EXPORT QString QtPrivate::argToQString (QLatin1StringView pattern, size_t n, const ArgBase **args)
 
template<typename StringView , typename... Args>
Q_ALWAYS_INLINE QString QtPrivate::argToQStringDispatch (StringView pattern, const Args &...args)
 
QStringViewArg QtPrivate::qStringLikeToArg (const QString &s) noexcept
 
constexpr QStringViewArg QtPrivate::qStringLikeToArg (QStringView s) noexcept
 
QStringViewArg QtPrivate::qStringLikeToArg (const QChar &c) noexcept
 
constexpr QLatin1StringArg QtPrivate::qStringLikeToArg (QLatin1StringView s) noexcept
 
template<typename T >
qsizetype erase (QString &s, const T &t)
 
template<typename Predicate >
qsizetype erase_if (QString &s, Predicate pred)
 
QString Qt::Literals::StringLiterals::operator""_s (const char16_t *str, size_t size) noexcept
 

Macro Definition Documentation

◆ qPrintable

#define qPrintable ( string)    QtPrivate::asString(string).toLocal8Bit().constData()

Definition at line 1531 of file qstring.h.

Referenced by BluetoothManagement::BluetoothManagement(), QAndroidPlatformVulkanInstance::QAndroidPlatformVulkanInstance(), QCtfLibImpl::QCtfLibImpl(), QDBusXmlParser::QDBusXmlParser(), QIODevice::QIODevice(), QKmsDevice::QKmsDevice(), QOpenGLEngineSharedShaders::QOpenGLEngineSharedShaders(), QOpenGLProgramBinaryCache::QOpenGLProgramBinaryCache(), QQuickVisualTestUtils::QQuickApplicationHelper::QQuickApplicationHelper(), QSSGShaderCache::QSSGShaderCache(), QWindowsFontEngine::QWindowsFontEngine(), QWindowsMediaDevices::QWindowsMediaDevices(), QXcbSessionManager::QXcbSessionManager(), QDBusBlockingCallWatcher::~QDBusBlockingCallWatcher(), QDBusConnectionPrivate::~QDBusConnectionPrivate(), QQmlJavaScriptExpressionCapture::~QQmlJavaScriptExpressionCapture(), QQuickLayout::_q_dumpLayoutTree(), CPP::WriteInitialization::acceptActionRef(), CPP::WriteInitialization::acceptConnection(), CPP::WriteInitialization::acceptTabStops(), CPP::WriteInitialization::acceptUI(), CPP::WriteInitialization::acceptWidget(), QOpenGLShaderProgram::addCacheableShaderFromSourceFile(), QRhiMetalData::addComputePipelineToBinaryArchive(), QQmlImports::addFileImport(), addFunction(), QQmlImports::addImplicitImport(), QTapTestLogger::addIncident(), Parser::addIncludesRecursive(), QQmlImports::addLibraryImport(), QPlainTestLogger::addMessage(), QTapTestLogger::addMessage(), QFseventsFileSystemWatcherEngine::addPaths(), QRhiMetalData::addRenderPipelineToBinaryArchive(), QtAndroidQuickViewEmbedding::addRootObjectSignalListener(), QQmlNativeDebugConnector::addService(), QQuickControlsTestUtils::addTestRowForEachControl(), QSvgPaintEngine::begin(), QD3D11Buffer::beginFullDynamicBufferUpdateForCurrentFrame(), QRhiD3D11::beginOffscreenFrame(), QQuickContext2DImageTexture::beginPainting(), buildAndroidProject(), Grammar::buildRuleMap(), QTgaHandler::canRead(), QTextMarkdownImporter::cbEnterBlock(), QTextMarkdownImporter::cbText(), collectJson(), QColorOutput::colorify(), QOpenGLShaderPrivate::compile(), QSSGShaderCache::compileForRhi(), QQmlNotifierEndpoint::connect(), QAbstractSocket::connectToHost(), containsApplicationBinary(), contextFactory(), QMacMimePlainTextFallback::convertToMime(), QMacMimeUnicodeText::convertToMime(), QMacMimeTraditionalMacPlainText::convertToMime(), copyAndroidExtraLibs(), copyAndroidExtraResources(), copyAndroidSources(), copyAndroidTemplate(), copyFileIfNewer(), copyFiles(), copyGradleTemplate(), copyQtFiles(), copyStdCpp(), QD3D11Buffer::create(), QD3D11RenderBuffer::create(), QD3D11Texture::create(), QD3D11Sampler::create(), QD3D11TextureRenderTarget::create(), QD3D11GraphicsPipeline::create(), QD3D11ComputePipeline::create(), QMetalComputePipeline::create(), QEvdevMouseHandler::create(), QRhiD3D11::create(), QRhiMetal::create(), ARB::createContext(), QRhiD3D::createDirectCompositionDevice(), createDXGIFactory2(), Graph< Vertex, EdgeData >::createEdge(), QRhiMetalData::createMetalLib(), QD3D11SwapChain::createOrResize(), createProject(), createRcc(), QSGRhiSupport::createRhi(), QLinuxFbDevice::createScreen(), QKmsDevice::createScreenForConnector(), createSequence(), QEglFSKmsVsp2Screen::createSurface(), QEglFSKmsGbmScreen::createSurface(), QMetalGraphicsPipeline::createTessellationPipelines(), QWindowsThemeCache::createTheme(), QQC2::QWindowsXPStylePrivate::createTheme(), createUseNode(), QMetalGraphicsPipeline::createVertexFragmentPipeline(), debugVariantList(), deleteMissingFiles(), QQmlData::destroyed(), detectLatestAndroidPlatform(), QQmlJSAotCompiler::diagnose(), QWindowsNativeOpenFileDialog::dialogResult(), QKmsDevice::discoverPlanes(), Python::WriteImports::doAdd(), QImageData::doImageIO(), QCtfLibImpl::doTracepoint(), QSvgTinyDocument::draw(), QWindowsVistaStylePrivate::drawBackgroundDirectly(), QQC2::QWindowsXPStylePrivate::drawBackgroundDirectly(), QWindowsVistaStylePrivate::drawBackgroundThruNativeBuffer(), QQC2::QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(), QSvgUse::drawCommand(), QPainterPrivate::drawTextItem(), QTextHtmlParser::dumpHtml(), QSimplex::dumpMatrix(), QObject::dumpObjectInfo(), dumpOutput(), QDateTimeEditPrivate::editorCursorPositionChanged(), QRhiD3D11::endFrame(), QRhiD3D11::enqueueResourceUpdates(), QEglFSKmsGbmScreen::ensureModeSet(), enumsToValues(), error(), execCommand(), QRhiD3D11::executeBufferHostWrites(), QCoreTextFontDatabase::fallbacksForFamily(), fileArchitecture(), FileContent(), Parser::findEnumValues(), QRhiD3D11::finishActiveReadbacks(), QD3D11Texture::finishCreate(), QMacMimeRegistry::flavorToMime(), QEglFSKmsGbmScreen::flip(), QWindowsFontDatabaseBase::fontDefToLOGFONT(), QWindowsFontDatabase::fontEngine(), QMacPasteboard::formats(), funcCall(), funcSig(), QmlIR::IRBuilder::generateFromQml(), generateInterfaceXml(), genVulkanFunctionsH(), genVulkanFunctionsPC(), genVulkanFunctionsPH(), Preamble::get(), QSSGShaderLibraryManager::getIncludeContents(), getQtLibsFromElf(), QtAndroidQuickViewEmbedding::getRootObjectProperty(), getShader(), QSSGInputUtil::getStreamForFile(), QSSGInputUtil::getStreamForTextureFile(), QIOSApplicationState::handleApplicationStateChanged(), handleCompileErrors(), QQuickWidgetPrivate::handleContextCreationFailure(), QSGRenderLoop::handleContextCreationFailure(), QTest::handleFailOnWarning(), QQuickSplitViewPrivate::handlePress(), hasBtMgmtPermission(), QMacPasteboard::hasFormat(), QMacPasteboard::hasUti(), QQmlConnectionSlotDispatcher::impl(), QTlsPrivate::X509CertificateSchannel::importPkcs12(), QBasicPlatformVulkanInstance::init(), init_platform(), QEglFSKmsGbmScreen::initCloning(), QIntegrityFbScreen::initialize(), QApplicationPrivate::initialize(), QBsdFbScreen::initialize(), QLinuxFbScreen::initialize(), QQmlDataTest::initTestCase(), QGridLayoutEngine::insertItem(), QQuickSplitViewPrivate::layout(), QSvgTinyDocument::load(), QQsbInMemoryCollection::load(), QSSGBufferManager::loadLightmap(), QSSGBufferManager::loadMeshBVH(), QSSGBufferManager::loadMeshData(), QSSGBufferManager::loadRenderImage(), QBasicPlatformVulkanInstance::loadVulkanLibrary(), QQmlImportDatabase::locateLocalQmldir(), logToFile(), QDnsLookup::lookup(), macQueryInternal(), main(), main(), QIOSContext::makeCurrent(), mergeGradleProperties(), message(), QV4::ConsoleObject::method_assert(), QV4::ConsoleObject::method_count(), QV4::ConsoleObject::method_timeEnd(), QV4::ConsoleObject::method_trace(), QKeySequence::mnemonic(), moc(), monitorData(), QD3D11SwapChain::newColorBuffer(), NodeElements(), QEglFSKmsGbmDevice::open(), QEglFSKmsVsp2Device::open(), QLinuxFbDevice::open(), QPlatformServices::openDocument(), openFile(), openFile(), QCupsPrintEnginePrivate::openPrintDevice(), QPlatformServices::openUrl(), openWebBrowser(), CppGenerator::operator()(), operator<<(), operator<<(), QQmlError::operator<<(), operator<<(), VkSpecParser::parse(), QQmlDebugServerImpl::parseArguments(), parseCmdLine(), parseColorValue(), parseIconEntryInfo(), Parser::parseInstrument(), Parser::parseMetadata(), parseOptions(), Parser::parseParamReplace(), Parser::parsePoint(), Parser::parsePrefix(), parseProvider(), parseTracepoint(), QRhiMetal::pipelineCacheData(), QCoreTextFontDatabase::populateFamilyAliases(), QFreeTypeFontDatabase::populateFontDatabase(), QAndroidPlatformFontDatabase::populateFontDatabase(), QD3D11SwapChainTimestamps::prepare(), QSGRhiGuiThreadShaderEffectManager::prepareShaderCode(), preprocessMetadata(), QQmlJSCompileError::print(), printHelp(), Scanner::process(), QDBusAbstractInterfacePrivate::property(), QTest::qFindTestData(), QQmlEnginePrivate::qmlErrorFromDiagnostics(), QQmlMetaType::qmlInsertModuleRegistration(), QQmlMetaType::qmlRemoveModuleRegistration(), qRegisterNotificationCallbacks(), qRelocateResourceFile(), QTest::qRun(), qSetFontFamilyFromTokens(), qt_qdnsservicerecord_sort(), qtModule(), quick_test_main_with_setup(), readAndroidDependencyXml(), readDependencies(), readDependenciesFromElf(), readDependenciesFromFiles(), readInputFile(), readInputFileDirectory(), QLibInputTouch::registerDevice(), QWindowsMimeRegistry::registerMimeType(), QQmlMetaType::registerPluginTypes(), QWindowsWindow::registerTouchWindow(), QWindowsContext::registerWindowClass(), QDBusAdaptorConnector::relay(), QDBusConnectionPrivate::relaySignal(), QDBusAdaptorConnector::relaySlot(), QQmlXmlListModel::reload(), Graph< Vertex, EdgeData >::removeEdge(), QFseventsFileSystemWatcherEngine::removePaths(), QOffscreenIntegration::resolveConfigFileConfiguration(), QQuickStyleSpec::resolveConfigFilePath(), QSSGShaderUtils::resolveShader(), QSvgGradientStyle::resolveStops_helper(), QMacPasteboard::retrieveData(), QtWaylandClient::QWaylandMimeData::retrieveData_sys(), ThreadedTestHTTPServer::run(), QDBusXmlToCpp::run(), runCommand(), runMoc(), runRcc(), QOpenGLProgramBinaryCache::save(), QQsbInMemoryCollection::save(), scanImports(), QWindowsNativeFileDialogBase::selectNameFilter(), QDBusConnectionPrivate::send(), QQuickContext2DTexture::setCanvasWindow(), QDomDocument::setContent(), QDomDocumentPrivate::setContent(), QQmlDataBlob::setError(), QWindowsWindow::setGeometry(), QQuickRectangle::setGradient(), QGraphicsWidget::setLayout(), QWindowsClipboard::setMimeData(), QMacPasteboard::setMimeData(), QXcbScreen::setMonitor(), QWindowsWindow::setMouseGrabEnabled(), QWidget::setParent(), QObjectPrivate::setParent_helper(), QV4::QObjectWrapper::setProperty(), QDBusPendingCallPrivate::setReplyCallback(), QtAndroidQuickViewEmbedding::setRootObjectProperty(), QSSGRhiShaderPipeline::setUniform(), QSSGRhiShaderPipeline::setUniformArray(), QRhiMetalData::setupBinaryArchive(), QQuickShaderEffectPrivate::shaderCodePrepared(), shellExecute(), QWindowsNativeFileDialogBase::shellItem(), showParserMessage(), signAAB(), QQmlEnginePrivate::singletonInstance(), QSSGRenderShaderMetadata::InputOutput::stageFromString(), QGraphicsFrameCaptureMetal::startCaptureFrame(), QAbstractSocketPrivate::startConnectingByName(), QPlainTestLogger::startLogging(), QQnxCamera::startVideoRecording(), statusCodeFromHttp(), QNetworkReplyWasmImplPrivate::statusCodeFromHttp(), Graph< Vertex, EdgeData >::takeEdge(), QMetalGraphicsPipelineData::Tessellation::tescCompPipeline(), QMetalGraphicsPipelineData::Tessellation::teseFragRenderPipeline(), QGeoTileRequestManagerPrivate::tileError(), QTest::toString(), QTest::toString(), QTest::toString(), QTest::toString(), QTest::toString(), QTest::toString(), QSvgTinyDocument::transformForElement(), uninstallApk(), Driver::unique(), unloadPlugin(), QD3D11Buffer::unorderedAccessView(), QD3D11Texture::unorderedAccessViewForLevel(), updateAndroidManifest(), QQuickWindowPrivate::updateDirtyNodes(), updateFile(), updateLibsXml(), QQmlImports::updateQmldirContent(), updateStringsXml(), QAbstractSpinBoxPrivate::variantCompare(), verifyString(), QV4::QQmlValueTypeWrapper::virtualPut(), QMetalGraphicsPipelineData::Tessellation::vsCompPipeline(), while(), Uic::write(), Uic::write(), writeCtfMacro(), writeDepFile(), and zipalignPath().

◆ qUtf16Printable

#define qUtf16Printable ( string)     static_cast<const wchar_t*>(static_cast<const void*>(QtPrivate::asString(string).utf16()))

Definition at line 1543 of file qstring.h.

Referenced by QEvdevTabletHandler::QEvdevTabletHandler(), QEvdevTouchScreenHandler::QEvdevTouchScreenHandler(), QLayout::QLayout(), QWindowsMessageWindowClassContext::QWindowsMessageWindowClassContext(), QWinSettingsPrivate::~QWinSettingsPrivate(), QDateTimeParser::absoluteMax(), QDateTimeParser::absoluteMin(), QLayout::activate(), QLayout::addChildLayout(), QLayout::addChildWidget(), QSqlDatabasePrivate::addDatabase(), QEvdevTabletManager::addDevice(), QEvdevTouchManager::addDevice(), QWizardPrivate::addField(), QEvdevKeyboardManager::addKeyboard(), QEvdevMouseManager::addMouse(), QCommandLineParserPrivate::aliases(), QString::arg(), argToQStringImpl(), QLayoutPrivate::checkLayout(), QCoreApplicationPrivate::checkReceiverThread(), QLayoutPrivate::checkWidget(), checkXdgRuntimeDir(), QOpenGLShaderPrivate::compile(), QEvdevKeyboardHandler::create(), QPSQLResultPrivate::deallocatePreparedStmt(), QSoundEffectPrivate::decoderError(), deleteChildGroups(), dumpRecursive(), QWizard::field(), QDateTimeParser::fieldInfo(), file_already_open(), findPatternUnloaded(), QOpenGLEngineSharedShaders::findProgramInCache(), findSlot(), QDateTimeParser::SectionNode::format(), generateInterfaceXml(), QDateTimeParser::getDigit(), QRegularExpressionPrivate::getPatternInfo(), QOCIResult::gotoNext(), QSqlDatabasePrivate::init(), installCoverageTool(), QSqlDatabasePrivate::invalidateDb(), QSqlQuery::isNull(), QObject::killTimer(), launchMail(), QOpenGLShaderProgram::link(), QEvdevKeyboardHandler::loadKeymap(), QDateTimeParser::SectionNode::maxChange(), QSqlDatabase::moveToThread(), QMYSQLDriver::open(), QSQLiteDriver::open(), openFile(), QDateTimeParser::parse(), QMimeTypeParserBase::parse(), QSqlQuery::prepare(), qDecodeOCIType(), qOraWarning(), qParseOpts(), qRequireVersion(), qtWarnAboutInvalidRegularExpression(), QEvdevTabletHandler::readData(), QResource::registerResource(), QResource::registerResource(), QWinSettingsPrivate::remove(), QEvdevTabletManager::removeDevice(), QEvdevTouchManager::removeDevice(), QEvdevKeyboardManager::removeKeyboard(), QEvdevMouseManager::removeMouse(), QLayoutPrivate::reparentChildWidgets(), QNetworkRequestFactoryPrivate::requestUrl(), QUrl::resolved(), QWindowsFileSystemWatcherEngineThread::run(), QDnsLookupRunnable::run(), QDockAreaLayoutInfo::saveState(), QDateTimeParser::sectionPos(), QWinSettingsPrivate::set(), QDateTimeParser::setDigit(), QWizard::setField(), setOptionFlag(), setOptionProtocol(), QIBaseDriver::subscribeToNotification(), QSQLiteDriver::subscribeToNotification(), QLockFile::tryLock(), QLockFilePrivate::tryLock_sys(), QIBaseDriver::unsubscribeFromNotification(), QPSQLDriver::unsubscribeFromNotification(), QSQLiteDriver::unsubscribeFromNotification(), QPropertyAnimation::updateState(), QSqlQuery::value(), and QCommandLineParser::values().

◆ qUtf8Printable

Function Documentation

◆ erase()

template<typename T >
qsizetype erase ( QString & s,
const T & t )
related

Definition at line 1601 of file qstring.h.

◆ erase_if()

template<typename Predicate >
qsizetype erase_if ( QString & s,
Predicate pred )
related

Definition at line 1607 of file qstring.h.

◆ operator+() [1/11]

QT_ASCII_CAST_WARN QString operator+ ( const char * s1,
const QString & s2 )
related

Definition at line 1433 of file qstring.h.

◆ operator+() [2/11]

QT_ASCII_CAST_WARN QString operator+ ( const QByteArray & ba,
const QString & s )
inline

Definition at line 1435 of file qstring.h.

References ba, and QString::fromUtf8().

+ Here is the call graph for this function:

◆ operator+() [3/11]

QT_ASCII_CAST_WARN QString operator+ ( const QString & s,
const QByteArray & ba )
inline

Definition at line 1437 of file qstring.h.

References ba.

◆ operator+() [4/11]

QT_ASCII_CAST_WARN QString operator+ ( const QString & s1,
const char * s2 )
related

Definition at line 1429 of file qstring.h.

◆ operator+() [5/11]

QString operator+ ( const QString & s1,
const QString & s2 )
inline

Definition at line 1418 of file qstring.h.

References s2.

◆ operator+() [6/11]

QString operator+ ( const QString & s1,
QChar s2 )
inline

Definition at line 1422 of file qstring.h.

References s2.

◆ operator+() [7/11]

QString operator+ ( QChar s1,
const QString & s2 )
inline

Definition at line 1426 of file qstring.h.

References s2.

◆ operator+() [8/11]

QT_ASCII_CAST_WARN QString operator+ ( QString && lhs,
const char * rhs )
inline

Definition at line 1431 of file qstring.h.

References QT_IGNORE_DEPRECATIONS.

◆ operator+() [9/11]

QT_ASCII_CAST_WARN QString operator+ ( QString && lhs,
const QByteArray & rhs )
inline

Definition at line 1439 of file qstring.h.

References QT_IGNORE_DEPRECATIONS.

◆ operator+() [10/11]

QString operator+ ( QString && lhs,
const QString & rhs )
related

Definition at line 1420 of file qstring.h.

◆ operator+() [11/11]

QString operator+ ( QString && lhs,
QChar rhs )
inline

Definition at line 1424 of file qstring.h.

◆ operator<<()

Q_CORE_EXPORT QDataStream & operator<< ( QDataStream & out,
const QString & str )
related

Definition at line 242 of file qstring.cpp.

◆ operator>>()

Q_CORE_EXPORT QDataStream & operator>> ( QDataStream & in,
QString & str )
related

Definition at line 243 of file qstring.cpp.