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
qtpaths.cpp File Reference

(9f464716b0ce55b09c96e4e68b778a8ed57690b7)

#include <QCoreApplication>
#include <QCommandLineParser>
#include <QStandardPaths>
#include <QHash>
#include <QLibraryInfo>
#include <algorithm>
#include <stdio.h>
+ Include dependency graph for qtpaths.cpp:

Go to the source code of this file.

Classes

class  StringEnum
 

Functions

static QT_USE_NAMESPACE void message (const QString &string)
 
static Q_NORETURN void error (const QString &message)
 
static QStringList types ()
 
static const StringEnumparseLocationOrError (const QString &locationString)
 
static QString searchStringOrError (QCommandLineParser *parser)
 
int main (int argc, char **argv)
 [0]
 

Variables

static const StringEnum lookupTableData []
 

Function Documentation

◆ error()

static Q_NORETURN void error ( const QString & message)
static

Writes error message and exits 1

Parameters
messageto write

Definition at line 36 of file qtpaths.cpp.

References qPrintable.

◆ main()

int main ( int argc,
char ** argv )

◆ message()

static QT_USE_NAMESPACE void message ( const QString & string)
static

Prints the string on stdout and appends a newline

Parameters
stringprintable string

Definition at line 27 of file qtpaths.cpp.

References qPrintable.

◆ parseLocationOrError()

static const StringEnum & parseLocationOrError ( const QString & locationString)
static

Tries to parse the location string into a reference to a StringEnum entry or alternatively calls error with a error message

Definition at line 99 of file qtpaths.cpp.

References error, lookupTableData, and QStringLiteral.

Referenced by main().

+ Here is the caller graph for this function:

◆ searchStringOrError()

static QString searchStringOrError ( QCommandLineParser * parser)
static

searches for exactly one remaining argument and returns it. If not found, error is called with a error message.

Parameters
parserto ask for remaining arguments
Returns
one extra argument

Definition at line 115 of file qtpaths.cpp.

References error, QCommandLineParser::positionalArguments(), and QStringLiteral.

Referenced by main().

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

◆ types()

static QStringList types ( )
static
Returns
available types as a QStringList.

Definition at line 86 of file qtpaths.cpp.

References QString::fromLatin1(), and lookupTableData.

Referenced by main().

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

Variable Documentation

◆ lookupTableData

const StringEnum lookupTableData[]
static
Initial value:
= {
{ "AppConfigLocation", QStandardPaths::AppConfigLocation, true },
{ "AppDataLocation", QStandardPaths::AppDataLocation, true },
{ "AppLocalDataLocation", QStandardPaths::AppLocalDataLocation, true },
{ "ApplicationsLocation", QStandardPaths::ApplicationsLocation, false },
{ "CacheLocation", QStandardPaths::CacheLocation, true },
{ "ConfigLocation", QStandardPaths::ConfigLocation, false },
{ "DesktopLocation", QStandardPaths::DesktopLocation, false },
{ "DocumentsLocation", QStandardPaths::DocumentsLocation, false },
{ "DownloadLocation", QStandardPaths::DownloadLocation, false },
{ "FontsLocation", QStandardPaths::FontsLocation, false },
{ "GenericCacheLocation", QStandardPaths::GenericCacheLocation, false },
{ "GenericConfigLocation", QStandardPaths::GenericConfigLocation, false },
{ "GenericDataLocation", QStandardPaths::GenericDataLocation, false },
{ "GenericStateLocation", QStandardPaths::GenericStateLocation, false },
{ "HomeLocation", QStandardPaths::HomeLocation, false },
{ "MoviesLocation", QStandardPaths::MoviesLocation, false },
{ "MusicLocation", QStandardPaths::MusicLocation, false },
{ "PicturesLocation", QStandardPaths::PicturesLocation, false },
{ "PublicShareLocation", QStandardPaths::PublicShareLocation, false },
{ "RuntimeLocation", QStandardPaths::RuntimeLocation, false },
{ "StateLocation", QStandardPaths::StateLocation, true },
{ "TemplatesLocation", QStandardPaths::TemplatesLocation, false },
{ "TempLocation", QStandardPaths::TempLocation, false }
}

Definition at line 57 of file qtpaths.cpp.

Referenced by parseLocationOrError(), and types().