![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
Represents an output directory that has been verified to exist. More...
#include <outputdirectory.h>
Public Member Functions | |
| OutputDirectory (QString path) noexcept | |
| Constructs an OutputDirectory for the given path. | |
| OutputDirectory (const OutputDirectory &)=default | |
| OutputDirectory (OutputDirectory &&) noexcept=default | |
| OutputDirectory & | operator= (const OutputDirectory &)=default |
| OutputDirectory & | operator= (OutputDirectory &&) noexcept=default |
| ~OutputDirectory ()=default | |
| OutputDirectory | ensureSubdir (QStringView subdirName, const Location &location) const |
| Ensures that a subdirectory named subdirName exists within this output directory, creating it if necessary. | |
| const QString & | path () const noexcept |
| QString | absoluteFilePath (QStringView fileName) const |
| Returns the absolute file path for a file named fileName within this output directory. | |
| QDir | toQDir () const |
Static Public Member Functions | |
| static OutputDirectory | ensure (QStringView path, const Location &location) |
| Ensures that an output directory exists at path and creates it if necessary. | |
Friends | |
| bool | operator== (const OutputDirectory &lhs, const OutputDirectory &rhs) noexcept |
| bool | operator!= (const OutputDirectory &lhs, const OutputDirectory &rhs) noexcept |
Represents an output directory that has been verified to exist.
OutputDirectory is a simple value type that wraps a QString representing a filesystem path to a directory. Instances are created via OutputDirectory::ensure() and OutputDirectory::ensureSubdir() after ensuring the directory exists.
This class provides a type-safe way to pass around directory paths that are known to be valid. This reduces the need for repeated existence checks.
Instances created via ensure() or ensureSubdir() provide the following guarantees:
\list
Definition at line 15 of file outputdirectory.h.
|
explicitnoexcept |
Constructs an OutputDirectory for the given path.
The path is normalized using QDir::cleanPath() and moved into the object. This constructor is intentionally public to allow the static factory methods to create instances, but users should not construct OutputDirectory instances directly—they should use OutputDirectory::ensure() or ensureSubdir() instead.
Definition at line 63 of file outputdirectory.cpp.
References OutputDirectory().
Referenced by OutputDirectory().
|
default |
|
defaultnoexcept |
|
default |
|
nodiscard |
Returns the absolute file path for a file named fileName within this output directory.
For example, if the output directory is "/tmp/doc" and fileName is "index.html", this returns "/tmp/doc/index.html".
Definition at line 75 of file outputdirectory.cpp.
|
staticnodiscard |
Ensures that an output directory exists at path and creates it if necessary.
If path exists but is not a directory, or if the directory cannot be created, reports a fatal error using location and terminates QDoc execution.
Returns an OutputDirectory representing the created or existing directory.
Definition at line 92 of file outputdirectory.cpp.
|
nodiscard |
Ensures that a subdirectory named subdirName exists within this output directory, creating it if necessary.
The subdirName must be a relative path. Absolute paths and paths that traverse outside the parent directory using ".." are rejected with a fatal error to prevent accidental writes outside the output tree.
If the directory cannot be created, reports a fatal error using location and terminates QDoc execution.
Returns an OutputDirectory representing the created or existing subdirectory.
Definition at line 122 of file outputdirectory.cpp.
|
default |
|
defaultnoexcept |
|
inlinenodiscardnoexcept |
Definition at line 30 of file outputdirectory.h.
Referenced by Generator::addImageToCopy().
|
inlinenodiscard |
Definition at line 32 of file outputdirectory.h.
|
friend |
Definition at line 39 of file outputdirectory.h.
References operator==.
|
friend |
Definition at line 34 of file outputdirectory.h.
Referenced by operator!=.