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
utils.h File Reference

(ed191b6afa36aaf47478856fc44b9ebc300ff808)

#include <QStringList>
#include <QMap>
#include <QtCore/QFile>
#include <QtCore/QDir>
#include <QtCore/QDateTime>
#include <QtCore/QJsonArray>
#include <QtCore/QJsonObject>
#include <QtCore/QJsonDocument>
#include <iostream>
+ Include dependency graph for utils.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  JsonOutput
 
class  NameFilterFileEntryFunction
 

Enumerations

enum  PlatformFlag {
  WindowsBased = 0x00001 , IntelBased = 0x00010 , ArmBased = 0x00020 , Msvc = 0x00100 ,
  MinGW = 0x00200 , ClangMsvc = 0x00400 , ClangMinGW = 0x00800 , WindowsDesktopMsvc = WindowsBased + Msvc ,
  WindowsDesktopMsvcIntel = WindowsDesktopMsvc + IntelBased , WindowsDesktopMsvcArm = WindowsDesktopMsvc + ArmBased , WindowsDesktopMinGW = WindowsBased + IntelBased + MinGW , WindowsDesktopClangMsvc = WindowsBased + IntelBased + ClangMsvc ,
  WindowsDesktopClangMinGW = WindowsBased + IntelBased + ClangMinGW , UnknownPlatform
}
 
enum  ListOption {
  ListNone = 0 , ListSource , ListTarget , ListRelative ,
  ListMapping
}
 
enum  DebugMatchMode { MatchDebug , MatchRelease , MatchDebugOrRelease }
 
enum  UpdateFileFlag { ForceUpdateFile = 0x1 , SkipUpdateFile = 0x2 , RemoveEmptyQmlDirectories = 0x4 , SkipQmlDesignerSpecificsDirectories = 0x8 }
 

Functions

bool platformHasDebugSuffix (Platform p)
 
std::wostream & operator<< (std::wostream &str, const QString &s)
 
QString normalizeFileName (const QString &name)
 
QString sharedLibrarySuffix ()
 
bool isBuildDirectory (Platform platform, const QString &dirName)
 
bool createSymbolicLink (const QFileInfo &source, const QString &target, QString *errorMessage)
 
bool createDirectory (const QString &directory, QString *errorMessage, bool dryRun)
 
QString findInPath (const QString &file)
 
QMap< QString, QStringqueryQtPaths (const QString &qmakeBinary, QString *errorMessage)
 
QStringList findSharedLibraries (const QDir &directory, Platform platform, DebugMatchMode debugMatchMode, const QString &prefix=QString())
 
bool updateFile (const QString &sourceFileName, const QStringList &nameFilters, const QString &targetDirectory, unsigned flags, JsonOutput *json, QString *errorMessage)
 
bool runProcess (const QString &binary, const QStringList &args, const QString &workingDirectory=QString(), unsigned long *exitCode=0, QByteArray *stdOut=0, QByteArray *stdErr=0, QString *errorMessage=0)
 
bool readPeExecutable (const QString &peExecutableFileName, QString *errorMessage, QStringList *dependentLibraries=0, unsigned *wordSize=0, bool *isDebug=0, bool isMinGW=false, unsigned short *machineArch=nullptr)
 
QStringList findDependentLibraries (const QString &executableFileName, QString *errorMessage)
 
QString findD3dCompiler (Platform platform, const QString &qtBinDir, unsigned wordSize)
 
QStringList findDxc (Platform platform, const QString &qtBinDir, unsigned wordSize)
 
bool patchQtCore (const QString &path, QString *errorMessage)
 
template<class DirectoryFileEntryFunction >
bool updateFile (const QString &sourceFileName, DirectoryFileEntryFunction directoryFileEntryFunction, const QString &targetDirectory, unsigned flags, JsonOutput *json, QString *errorMessage)
 
bool updateFile (const QString &sourceFileName, const QString &targetDirectory, unsigned flags, JsonOutput *json, QString *errorMessage)
 

Variables

static const char windowsSharedLibrarySuffix [] = ".dll"
 
const char * qmakeInfixKey
 
int optVerboseLevel
 

Enumeration Type Documentation

◆ DebugMatchMode

Enumerator
MatchDebug 
MatchRelease 
MatchDebugOrRelease 

Definition at line 152 of file utils.h.

◆ ListOption

enum ListOption
Enumerator
ListNone 
ListSource 
ListTarget 
ListRelative 
ListMapping 

Definition at line 50 of file utils.h.

◆ PlatformFlag

Enumerator
WindowsBased 
IntelBased 
ArmBased 
Msvc 
MinGW 
ClangMsvc 
ClangMinGW 
WindowsDesktopMsvc 
WindowsDesktopMsvcIntel 
WindowsDesktopMsvcArm 
WindowsDesktopMinGW 
WindowsDesktopClangMsvc 
WindowsDesktopClangMinGW 
UnknownPlatform 

Definition at line 20 of file utils.h.

◆ UpdateFileFlag

Enumerator
ForceUpdateFile 
SkipUpdateFile 
RemoveEmptyQmlDirectories 
SkipQmlDesignerSpecificsDirectories 

Definition at line 198 of file utils.h.

Function Documentation

◆ createDirectory()

bool createDirectory ( const QString & directory,
QString * errorMessage,
bool dryRun )

Definition at line 64 of file utils.cpp.

References arg, dir, directory, errorMessage(), QString::fromLatin1(), optVerboseLevel, and QDir::toNativeSeparators().

Referenced by deploy(), deployWebEngineCore(), and main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createSymbolicLink()

bool createSymbolicLink ( const QFileInfo & source,
const QString & target,
QString * errorMessage )

Definition at line 45 of file utils.cpp.

References QDir::currentPath(), errorMessage(), QIODevice::errorString(), file, QString::fromLatin1(), QFile::link(), QStringLiteral, QDir::setCurrent(), and QDir::toNativeSeparators().

Referenced by updateFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findD3dCompiler()

QString findD3dCompiler ( Platform platform,
const QString & qtBinDir,
unsigned wordSize )

Definition at line 937 of file utils.cpp.

Referenced by deploy().

+ Here is the caller graph for this function:

◆ findDependentLibraries()

QStringList findDependentLibraries ( const QString & executableFileName,
QString * errorMessage )
inline

Definition at line 182 of file utils.h.

References errorMessage(), and readPeExecutable().

Referenced by deploy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findDxc()

QStringList findDxc ( Platform platform,
const QString & qtBinDir,
unsigned wordSize )

Definition at line 942 of file utils.cpp.

Referenced by deploy().

+ Here is the caller graph for this function:

◆ findInPath()

QString findInPath ( const QString & file)

Definition at line 2749 of file main.cpp.

References QDir::cleanPath(), QFileInfo::exists(), file, fileName, QStandardPaths::findExecutable(), QString::fromLocal8Bit(), QString::fromWCharArray(), QFileInfo::isExecutable(), QFileInfo::isFile(), MAX_PATH, qgetenv(), and QFile::size().

Referenced by deploy(), findMinGWRuntimePaths(), and signAAB().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findSharedLibraries()

QStringList findSharedLibraries ( const QDir & directory,
Platform platform,
DebugMatchMode debugMatchMode,
const QString & prefix = QString() )

Definition at line 88 of file utils.cpp.

References directory, errorMessage(), QDir::Files, QString::isEmpty(), MatchDebug, MatchDebugOrRelease, matches(), platform(), platformHasDebugSuffix(), readPeExecutable(), sharedLibrarySuffix(), QDir::toNativeSeparators(), WindowsBased, and WindowsDesktopMinGW.

Referenced by findFFmpegLibs(), findFileRecursion(), findOpenSslLibraries(), findQtPlugins(), DllDirectoryFileEntryFunction::operator()(), and parseArguments().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isBuildDirectory()

bool isBuildDirectory ( Platform platform,
const QString & dirName )

Definition at line 37 of file utils.cpp.

References ClangMsvc, Msvc, and platform().

Referenced by findQmlDirectory(), and qmlDirectoryRecursion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normalizeFileName()

QString normalizeFileName ( const QString & name)
inline

Definition at line 136 of file utils.h.

Referenced by findDependentQtLibraries().

+ Here is the caller graph for this function:

◆ operator<<()

std::wostream & operator<< ( std::wostream & str,
const QString & s )
inline

Definition at line 58 of file utils.h.

References str, and QString::toStdWString().

+ Here is the call graph for this function:

◆ patchQtCore()

bool patchQtCore ( const QString & path,
QString * errorMessage )

Definition at line 950 of file utils.cpp.

References QFileDevice::close(), errorMessage(), QIODevice::errorString(), file, QFileInfo::fileName(), QString::fromLatin1(), QByteArray::indexOf(), QFile::open(), optVerboseLevel, QByteArray(), QIODevice::readAll(), QIODeviceBase::ReadOnly, QByteArray::replace(), QByteArray::size(), QDir::toNativeSeparators(), QIODevice::write(), and QIODeviceBase::WriteOnly.

Referenced by deploy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ platformHasDebugSuffix()

bool platformHasDebugSuffix ( Platform p)
inline

Definition at line 45 of file utils.h.

References ClangMsvc, and Msvc.

Referenced by deployPlugin(), deployWebEngineCore(), findPluginNames(), findSharedLibraries(), and libraryPath().

+ Here is the caller graph for this function:

◆ queryQtPaths()

QMap< QString, QString > queryQtPaths ( const QString & qmakeBinary,
QString * errorMessage )

Definition at line 423 of file utils.cpp.

References errorMessage(), QString::fromLocal8Bit(), QString::fromUtf8(), QString::indexOf(), QString::isEmpty(), line, QString::number(), output, pos, qmakeInfixKey, QStringLiteral, QIODeviceBase::ReadOnly, QString::right(), runProcess(), QString::size(), QString::startsWith(), QIODeviceBase::Text, QDir::toNativeSeparators(), and QString::trimmed().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readPeExecutable()

bool readPeExecutable ( const QString & peExecutableFileName,
QString * errorMessage,
QStringList * dependentLibraries = 0,
unsigned * wordSize = 0,
bool * isDebug = 0,
bool isMinGW = false,
unsigned short * machineArch = nullptr )

Definition at line 930 of file utils.cpp.

References errorMessage(), and QStringLiteral.

Referenced by findDependentLibraries(), findDependentQtLibraries(), findPluginNames(), and findSharedLibraries().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ runProcess()

bool runProcess ( const QString & binary,
const QStringList & args,
const QString & workingDirectory = QString(),
unsigned long * exitCode = 0,
QByteArray * stdOut = 0,
QByteArray * stdErr = 0,
QString * errorMessage = 0 )

Definition at line 311 of file utils.cpp.

References args, encodeFileName(), errorMessage(), QString::fromLocal8Bit(), QStringLiteral, readOutRedirectFile(), QDir::setCurrent(), QList< T >::size(), and tempFilePattern().

Referenced by deployTranslations(), queryQtPaths(), and runQmlImportScanner().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sharedLibrarySuffix()

QString sharedLibrarySuffix ( )
inline

Definition at line 141 of file utils.h.

References windowsSharedLibrarySuffix.

Referenced by determinePluginLibrary(), findMinGWRuntimePaths(), findPluginNames(), findSharedLibraries(), and libraryPath().

+ Here is the caller graph for this function:

◆ updateFile() [1/3]

bool updateFile ( const QString & sourceFileName,
const QString & targetDirectory,
unsigned flags,
JsonOutput * json,
QString * errorMessage )
inline

Definition at line 359 of file utils.h.

References errorMessage(), and updateFile().

+ Here is the call graph for this function:

◆ updateFile() [2/3]

bool updateFile ( const QString & sourceFileName,
const QStringList & nameFilters,
const QString & targetDirectory,
unsigned flags,
JsonOutput * json,
QString * errorMessage )

Definition at line 479 of file utils.cpp.

References JsonOutput::addFile(), QFile::copy(), d, dir, QDir::Dirs, errorMessage(), QIODevice::errorString(), file, QDir::Files, ForceUpdateFile, QString::fromLatin1(), QDir::NoDotAndDotDot, optVerboseLevel, QFile::remove(), SkipUpdateFile, QDir::toNativeSeparators(), and updateFile().

Referenced by updateFile(), updateFile(), and updateFile().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFile() [3/3]

template<class DirectoryFileEntryFunction >
bool updateFile ( const QString & sourceFileName,
DirectoryFileEntryFunction directoryFileEntryFunction,
const QString & targetDirectory,
unsigned flags,
JsonOutput * json,
QString * errorMessage )

Variable Documentation

◆ optVerboseLevel

◆ qmakeInfixKey

const char* qmakeInfixKey
extern

Definition at line 421 of file utils.cpp.

Referenced by deploy(), PluginInformation::generateAvailablePlugins(), and queryQtPaths().

◆ windowsSharedLibrarySuffix

const char windowsSharedLibrarySuffix[] = ".dll"
static

Definition at line 139 of file utils.h.

Referenced by deploy(), and sharedLibrarySuffix().