diff options
Diffstat (limited to 'src/qdoc/qdoc/src/qdoc/boundaries/filesystem/filepath.h')
-rw-r--r-- | src/qdoc/qdoc/src/qdoc/boundaries/filesystem/filepath.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/qdoc/qdoc/src/qdoc/boundaries/filesystem/filepath.h b/src/qdoc/qdoc/src/qdoc/boundaries/filesystem/filepath.h new file mode 100644 index 000000000..e8a9b2d35 --- /dev/null +++ b/src/qdoc/qdoc/src/qdoc/boundaries/filesystem/filepath.h @@ -0,0 +1,17 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +#pragma once + +#include "qdoc/boundaries/refined_typedef.h" + +#include <optional> + +#include <QtCore/qstring.h> +#include <QtCore/qfileinfo.h> + +QDOC_REFINED_TYPEDEF(QString, FilePath) { + QFileInfo info{value}; + + return (info.isFile() && info.isReadable()) ? std::optional(FilePath{info.canonicalFilePath()}) : std::nullopt; +} |