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
Config Class Reference

The Config class contains the configuration variables for controlling how qdoc produces documentation. More...

#include <config.h>

+ Inheritance diagram for Config:
+ Collaboration diagram for Config:

Classes

struct  ExcludedPaths
 
struct  HeaderFilePath
 

Public Types

enum  QDocPass { Neither , Prepare , Generate }
 
enum  PathFlags : unsigned char { None = 0x0 , Validate = 0x1 , IncludePaths = 0x2 }
 Flags used for retrieving canonicalized paths from Config. More...
 

Public Member Functions

 ~Config ()
 
void init (const QString &programName, const QStringList &args)
 Initializes the Config with programName and sets all internal state variables to either default values or to ones defined in command line arguments args.
 
bool getDebug () const
 
bool getAtomsDump () const
 
bool showInternal () const
 
void clear ()
 Clears the location and internal maps for config variables.
 
void reset ()
 Resets the Config instance - used by load()
 
void load (const QString &fileName)
 Loads and parses the qdoc configuration file fileName.
 
void setStringList (const QString &var, const QStringList &values)
 Sets the values of a configuration variable var from a string list.
 
void insertStringList (const QString &var, const QStringList &values)
 Adds the values from a string list to the configuration variable var.
 
void showHelp (int exitCode=0)
 
QStringList qdocFiles () const
 
const QStringprogramName () const
 
const Locationlocation () const
 
const ConfigVarget (const QString &var) const
 
QString getOutputDir (const QString &format=QString("HTML")) const
 Function to return the correct outputdir for the output format.
 
QSet< QStringgetOutputFormats () const
 Function to return the correct outputformats.
 
QStringList getCanonicalPathList (const QString &var, PathFlags flags=None) const
 Returns a path list where all paths from the config variable var are canonicalized.
 
QRegularExpression getRegExp (const QString &var) const
 Calls getRegExpList() with the control variable var and iterates through the resulting list of regular expressions, concatenating them with extra characters to form a single QRegularExpression, which is then returned.
 
QList< QRegularExpressiongetRegExpList (const QString &var) const
 Looks up the configuration variable var in the string list map, converts the string list to a list of regular expressions, and returns it.
 
QSet< QStringsubVars (const QString &var) const
 This function is slower than it could be.
 
QStringList getAllFiles (const QString &filesVar, const QString &dirsVar, const QSet< QString > &excludedDirs=QSet< QString >(), const QSet< QString > &excludedFiles=QSet< QString >())
 Builds and returns a list of file pathnames for the file type specified by filesVar (e.g.
 
QString getIncludeFilePath (const QString &fileName) const
 Searches for a path to fileName in 'sources', 'sourcedirs', and 'exampledirs' config variables and returns a full path to the first match found.
 
QStringList getExampleQdocFiles (const QSet< QString > &excludedDirs, const QSet< QString > &excludedFiles)
 
QStringList getExampleImageFiles (const QSet< QString > &excludedDirs, const QSet< QString > &excludedFiles)
 
QString getExampleProjectFile (const QString &examplePath)
 Returns the path to the project file for examplePath, or an empty string if no project file was found.
 
bool singleExec () const
 
bool dualExec () const
 
QStringListdefines ()
 
QStringListdependModules ()
 
QStringListincludePaths ()
 
QStringListindexDirs ()
 
QString currentDir () const
 
void setCurrentDir (const QString &path)
 
QString previousCurrentDir () const
 
void setPreviousCurrentDir (const QString &path)
 
void setQDocPass (const QDocPass &pass)
 
bool preparing () const
 
bool generating () const
 
const ExcludedPathsgetExcludedPaths ()
 
std::set< HeaderFilePathgetHeaderFiles ()
 
- Public Member Functions inherited from Singleton< Config >
int thing () const
 
 Singleton (const Singleton &)=delete
 
 Singleton (QObject *parent=nullptr)
 
Singletonoperator= (const Singleton &)=delete
 
void setThing (int v)
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 

Static Public Member Functions

static QStringList loadMaster (const QString &fileName)
 fileName is a master qdocconf file.
 
static bool isFileExcluded (const QString &fileName, const QSet< QString > &excludedFiles)
 
static QStringList getFilesHere (const QString &dir, const QString &nameFilter, const Location &location=Location(), const QSet< QString > &excludedDirs=QSet< QString >(), const QSet< QString > &excludedFiles=QSet< QString >())
 
static QString findFile (const Location &location, const QStringList &files, const QStringList &dirs, const QString &fileName, QString *userFriendlyFilePath=nullptr)
 fileName is the path of the file to find.
 
static QString copyFile (const Location &location, const QString &sourceFilePath, const QString &userFriendlySourceFilePath, const QString &targetDirPath)
 Copies the sourceFilePath to the file name constructed by concatenating targetDirPath and the file name from the userFriendlySourceFilePath.
 
static int numParams (const QString &value)
 Finds the largest unicode digit in value in the range 1..7 and returns it.
 
static void pushWorkingDir (const QString &dir)
 Set dir as the working directory and push it onto the stack of working directories.
 
static void popWorkingDir ()
 Pop the top entry from the stack of working directories.
 
- Static Public Member Functions inherited from Singleton< Config >
static Configinstance ()
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 

Static Public Attributes

static const QString dot = QLatin1String(".")
 
static bool generateExamples = true
 
static QString installDir
 
static QString overrideOutputDir
 
static QSet< QStringoverrideOutputFormats
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Signals inherited from Singleton< Config >
void thingChanged ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 
- Protected Member Functions inherited from Singleton< Config >
 Singleton ()=default
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from Singleton< Config >
int thing
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Detailed Description

The Config class contains the configuration variables for controlling how qdoc produces documentation.

Its load() function reads, parses, and processes a qdocconf file.

Definition at line 83 of file config.h.

Member Enumeration Documentation

◆ PathFlags

enum Config::PathFlags : unsigned char

Flags used for retrieving canonicalized paths from Config.

\value Validate Issue a warning for paths that do not exist and remove them from the returned list.

\value IncludePaths Assume the variable contains include paths with prefixes such as {-I} that are to be removed before canonicalizing and then re-inserted.

\omitvalue None

See also
getCanonicalPathList()
Enumerator
None 
Validate 
IncludePaths 

Definition at line 90 of file config.h.

◆ QDocPass

Enumerator
Neither 
Prepare 
Generate 

Definition at line 88 of file config.h.

Constructor & Destructor Documentation

◆ ~Config()

Config::~Config ( )

Definition at line 343 of file config.cpp.

References clear().

+ Here is the call graph for this function:

Member Function Documentation

◆ clear()

void Config::clear ( )

Clears the location and internal maps for config variables.

Definition at line 351 of file config.cpp.

Referenced by ~Config(), and reset().

+ Here is the caller graph for this function:

◆ copyFile()

QString Config::copyFile ( const Location & location,
const QString & sourceFilePath,
const QString & userFriendlySourceFilePath,
const QString & targetDirPath )
static

Copies the sourceFilePath to the file name constructed by concatenating targetDirPath and the file name from the userFriendlySourceFilePath.

location is for identifying the file and line number where a qdoc error occurred. The constructed output file name is returned.

Definition at line 944 of file config.cpp.

◆ currentDir()

QString Config::currentDir ( ) const
inlinenodiscard

Definition at line 175 of file config.h.

◆ defines()

QStringList & Config::defines ( )
inline

Definition at line 171 of file config.h.

◆ dependModules()

QStringList & Config::dependModules ( )
inline

Definition at line 172 of file config.h.

◆ dualExec()

bool Config::dualExec ( ) const
inlinenodiscard

Definition at line 407 of file config.h.

Referenced by processQdocconfFile().

+ Here is the caller graph for this function:

◆ findFile()

QString Config::findFile ( const Location & location,
const QStringList & files,
const QStringList & dirs,
const QString & fileName,
QString * userFriendlyFilePath = nullptr )
static

fileName is the path of the file to find.

files and dirs are the lists where we must find the components of fileName.

location is used for obtaining the file and line numbers for report qdoc errors.

Definition at line 860 of file config.cpp.

◆ generating()

bool Config::generating ( ) const
inlinenodiscard

Definition at line 182 of file config.h.

References Generate.

Referenced by HtmlGenerator::generateDocs(), and Generator::initializeFormat().

+ Here is the caller graph for this function:

◆ get()

const ConfigVar & Config::get ( const QString & var) const
inlinenodiscard

Definition at line 122 of file config.h.

◆ getAllFiles()

QStringList Config::getAllFiles ( const QString & filesVar,
const QString & dirsVar,
const QSet< QString > & excludedDirs = QSet<QString>(),
const QSet< QString > & excludedFiles = QSet<QString>() )

Builds and returns a list of file pathnames for the file type specified by filesVar (e.g.

"headers" or "sources"). The files are found in the directories specified by dirsVar, and they are filtered by defaultNameFilter if a better filter can't be constructed from filesVar. The directories in excludedDirs are avoided. The files in excludedFiles are not included in the return list.

Definition at line 762 of file config.cpp.

◆ getAtomsDump()

bool Config::getAtomsDump ( ) const
inlinenodiscard

Definition at line 109 of file config.h.

◆ getCanonicalPathList()

QStringList Config::getCanonicalPathList ( const QString & var,
PathFlags flags = None ) const
nodiscard

Returns a path list where all paths from the config variable var are canonicalized.

If flags contains Validate, outputs a warning for invalid paths. The IncludePaths flag is used as a hint to strip away potential prefixes found in include paths before attempting to canonicalize.

Definition at line 605 of file config.cpp.

◆ getDebug()

bool Config::getDebug ( ) const
inlinenodiscard

Definition at line 108 of file config.h.

Referenced by processQdocconfFile().

+ Here is the caller graph for this function:

◆ getExampleImageFiles()

QStringList Config::getExampleImageFiles ( const QSet< QString > & excludedDirs,
const QSet< QString > & excludedFiles )

Definition at line 788 of file config.cpp.

◆ getExampleProjectFile()

QString Config::getExampleProjectFile ( const QString & examplePath)

Returns the path to the project file for examplePath, or an empty string if no project file was found.

Definition at line 811 of file config.cpp.

◆ getExampleQdocFiles()

QStringList Config::getExampleQdocFiles ( const QSet< QString > & excludedDirs,
const QSet< QString > & excludedFiles )

Definition at line 776 of file config.cpp.

◆ getExcludedPaths()

const Config::ExcludedPaths & Config::getExcludedPaths ( )

Definition at line 1405 of file config.cpp.

Referenced by getHeaderFiles(), and processQdocconfFile().

+ Here is the caller graph for this function:

◆ getFilesHere()

QStringList Config::getFilesHere ( const QString & dir,
const QString & nameFilter,
const Location & location = Location(),
const QSet< QString > & excludedDirs = QSet<QString>(),
const QSet< QString > & excludedFiles = QSet<QString>() )
static

Definition at line 1344 of file config.cpp.

◆ getHeaderFiles()

std::set< Config::HeaderFilePath > Config::getHeaderFiles ( )

Definition at line 1420 of file config.cpp.

References getExcludedPaths().

+ Here is the call graph for this function:

◆ getIncludeFilePath()

QString Config::getIncludeFilePath ( const QString & fileName) const
nodiscard

Searches for a path to fileName in 'sources', 'sourcedirs', and 'exampledirs' config variables and returns a full path to the first match found.

If the file is not found, returns an empty string.

Definition at line 724 of file config.cpp.

◆ getOutputDir()

QString Config::getOutputDir ( const QString & format = QString("HTML")) const
nodiscard

Function to return the correct outputdir for the output format.

If format is not specified, defaults to 'HTML'. outputdir can be set using the qdocconf or the command-line variable -outputdir.

Definition at line 551 of file config.cpp.

◆ getOutputFormats()

QSet< QString > Config::getOutputFormats ( ) const
nodiscard

Function to return the correct outputformats.

outputformats can be set using the qdocconf or the command-line variable -outputformat.

Definition at line 576 of file config.cpp.

◆ getRegExp()

QRegularExpression Config::getRegExp ( const QString & var) const
nodiscard

Calls getRegExpList() with the control variable var and iterates through the resulting list of regular expressions, concatenating them with extra characters to form a single QRegularExpression, which is then returned.

See also
getRegExpList()

Definition at line 666 of file config.cpp.

◆ getRegExpList()

QList< QRegularExpression > Config::getRegExpList ( const QString & var) const
nodiscard

Looks up the configuration variable var in the string list map, converts the string list to a list of regular expressions, and returns it.

Definition at line 688 of file config.cpp.

◆ includePaths()

QStringList & Config::includePaths ( )
inline

Definition at line 173 of file config.h.

◆ indexDirs()

QStringList & Config::indexDirs ( )
inline

Definition at line 174 of file config.h.

◆ init()

void Config::init ( const QString & programName,
const QStringList & args )

Initializes the Config with programName and sets all internal state variables to either default values or to ones defined in command line arguments args.

Definition at line 336 of file config.cpp.

References reset().

+ Here is the call graph for this function:

◆ insertStringList()

void Config::insertStringList ( const QString & var,
const QStringList & values )

Adds the values from a string list to the configuration variable var.

Existing value(s) are kept.

Definition at line 472 of file config.cpp.

◆ isFileExcluded()

bool Config::isFileExcluded ( const QString & fileName,
const QSet< QString > & excludedFiles )
static

Definition at line 1332 of file config.cpp.

◆ load()

void Config::load ( const QString & fileName)

Loads and parses the qdoc configuration file fileName.

If a previous project was loaded, this function first resets the Config instance. Then it calls the other load() function, which does the loading, parsing, and processing of the configuration file.

Definition at line 403 of file config.cpp.

References reset().

+ Here is the call graph for this function:

◆ loadMaster()

QStringList Config::loadMaster ( const QString & fileName)
static

fileName is a master qdocconf file.

It contains a list of qdocconf files and nothing else. Read the list and return it.

Definition at line 1057 of file config.cpp.

◆ location()

const Location & Config::location ( ) const
inlinenodiscard

Definition at line 121 of file config.h.

Referenced by processQdocconfFile().

+ Here is the caller graph for this function:

◆ numParams()

int Config::numParams ( const QString & value)
static

Finds the largest unicode digit in value in the range 1..7 and returns it.

Definition at line 1032 of file config.cpp.

◆ popWorkingDir()

void Config::popWorkingDir ( )
static

Pop the top entry from the stack of working directories.

Set the working directory to the next one on the stack, if one exists.

Definition at line 1397 of file config.cpp.

◆ preparing()

bool Config::preparing ( ) const
inlinenodiscard

Definition at line 181 of file config.h.

References Prepare.

Referenced by HtmlGenerator::generateDocs(), Generator::initializeFormat(), and processQdocconfFile().

+ Here is the caller graph for this function:

◆ previousCurrentDir()

QString Config::previousCurrentDir ( ) const
inlinenodiscard

Definition at line 177 of file config.h.

◆ programName()

const QString & Config::programName ( ) const
inlinenodiscard

Definition at line 120 of file config.h.

◆ pushWorkingDir()

void Config::pushWorkingDir ( const QString & dir)
static

Set dir as the working directory and push it onto the stack of working directories.

Definition at line 1386 of file config.cpp.

◆ qdocFiles()

QStringList Config::qdocFiles ( ) const
inlinenodiscard

Definition at line 119 of file config.h.

◆ reset()

void Config::reset ( )

Resets the Config instance - used by load()

Definition at line 362 of file config.cpp.

References clear().

Referenced by init(), and load().

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

◆ setCurrentDir()

void Config::setCurrentDir ( const QString & path)
inline

Definition at line 176 of file config.h.

◆ setPreviousCurrentDir()

void Config::setPreviousCurrentDir ( const QString & path)
inline

Definition at line 178 of file config.h.

◆ setQDocPass()

void Config::setQDocPass ( const QDocPass & pass)
inline

Definition at line 180 of file config.h.

◆ setStringList()

void Config::setStringList ( const QString & var,
const QStringList & values )

Sets the values of a configuration variable var from a string list.

Definition at line 463 of file config.cpp.

◆ showHelp()

void Config::showHelp ( int exitCode = 0)
inline

Definition at line 118 of file config.h.

◆ showInternal()

bool Config::showInternal ( ) const
inlinenodiscard

Definition at line 110 of file config.h.

◆ singleExec()

bool Config::singleExec ( ) const
inlinenodiscard

Definition at line 402 of file config.h.

Referenced by Location::initialize(), and processQdocconfFile().

+ Here is the caller graph for this function:

◆ subVars()

QSet< QString > Config::subVars ( const QString & var) const
nodiscard

This function is slower than it could be.

What it does is find all the keys that begin with var + dot and return the matching keys in a set, stripped of the matching prefix and dot.

Definition at line 703 of file config.cpp.

Member Data Documentation

◆ dot

const QString Config::dot = QLatin1String(".")
static

Definition at line 162 of file config.h.

Referenced by processQdocconfFile().

◆ generateExamples

bool Config::generateExamples = true
static

Definition at line 164 of file config.h.

Referenced by CppCodeParser::processTopicCommand().

◆ installDir

QString Config::installDir
static

Definition at line 165 of file config.h.

◆ overrideOutputDir

QString Config::overrideOutputDir
static

Definition at line 166 of file config.h.

◆ overrideOutputFormats

QSet< QString > Config::overrideOutputFormats
static

Definition at line 167 of file config.h.


The documentation for this class was generated from the following files: