Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
Utilities Namespace Reference

This namespace holds QDoc-internal utility methods. More...

Functions

void startDebugging (const QString &message)
 
void stopDebugging (const QString &message)
 
bool debugging ()
 
QString separator (qsizetype wordPosition, qsizetype numberOfWords)
 
QString comma (qsizetype wordPosition, qsizetype numberOfWords)
 
QString asAsciiPrintable (const QString &str)
 Returns an ascii-printable representation of str.
 
QStringList getInternalIncludePaths (const QString &compiler)
 
static void setDebugEnabled (bool value)
 
static bool runProcess (const QString &program, const QStringList &arguments, QByteArray *stdOutIn, QByteArray *stdErrIn)
 
static QByteArray frameworkSuffix ()
 

Detailed Description

This namespace holds QDoc-internal utility methods.

Function Documentation

◆ asAsciiPrintable()

QString Utilities::asAsciiPrintable ( const QString & str)

Returns an ascii-printable representation of str.

Replace non-ascii-printable characters in str from a subset of such characters. The subset includes alphanumeric (alnum) characters ([a-zA-Z0-9]), space, punctuation characters, and common symbols. Non-alnum characters in this subset are replaced by a single hyphen. Leading, trailing, and consecutive hyphens are removed, such that the resulting string does not start or end with a hyphen. All characters are converted to lowercase.

If any character in str is non-latin, or latin and not found in the aforementioned subset (e.g. 'ß', 'å', or 'ö'), a hash of str is appended to the final string.

Returns a string that is normalized for use where ascii-printable strings are required, such as file names or fragment identifiers in URLs.

The implementation is equivalent to:

name.replace(QRegularExpression("[^A-Za-z0-9]+"), " ");
name = name.simplified();
name.replace(QLatin1Char(' '), QLatin1Char('-'));
name = name.toLower();
\inmodule QtCore \reentrant
EGLImageKHR EGLint * name
\inmodule QtCore \reentrant
Definition qchar.h:18

However, it has been measured to be approximately four times faster.

Definition at line 112 of file utilities.cpp.

◆ comma()

QString Utilities::comma ( qsizetype wordPosition,
qsizetype numberOfWords )

Convenience method that's used to get the correct punctuation character for the words at wordPosition in a list of numberOfWords length.

For a list of length one, returns an empty QString. For a list of length two, returns the string " and ". For any length beyond two, returns the string ", " until the last element, which returns ", and ".

See also
comma()

Definition at line 72 of file utilities.cpp.

◆ debugging()

bool Utilities::debugging ( )

Definition at line 38 of file utilities.cpp.

Referenced by processQdocconfFile().

+ Here is the caller graph for this function:

◆ frameworkSuffix()

static QByteArray Utilities::frameworkSuffix ( )
static

Definition at line 198 of file utilities.cpp.

◆ getInternalIncludePaths()

QStringList Utilities::getInternalIncludePaths ( const QString & compiler)

Determine the compiler's internal include paths from the output of

\badcode [clang++|g++] -E -x c++ - -v </dev/null

Output looks like:

\badcode #include <...> search starts here: /usr/local/include /System/Library/Frameworks (framework directory) End of search list.

Definition at line 219 of file utilities.cpp.

◆ runProcess()

static bool Utilities::runProcess ( const QString & program,
const QStringList & arguments,
QByteArray * stdOutIn,
QByteArray * stdErrIn )
static

Definition at line 157 of file utilities.cpp.

◆ separator()

QString Utilities::separator ( qsizetype wordPosition,
qsizetype numberOfWords )

Convenience method that's used to get the correct punctuation character for the words at wordPosition in a list of numberOfWords length. For the last position in the list, returns "." (full stop). For any other word, this method calls comma().

See also
comma()

Definition at line 52 of file utilities.cpp.

◆ setDebugEnabled()

static void Utilities::setDebugEnabled ( bool value)
inlinestatic

Definition at line 20 of file utilities.cpp.

Referenced by startDebugging(), and stopDebugging().

+ Here is the caller graph for this function:

◆ startDebugging()

void Utilities::startDebugging ( const QString & message)

Definition at line 26 of file utilities.cpp.

References setDebugEnabled().

+ Here is the call graph for this function:

◆ stopDebugging()

void Utilities::stopDebugging ( const QString & message)

Definition at line 32 of file utilities.cpp.

References setDebugEnabled().

+ Here is the call graph for this function: