summaryrefslogtreecommitdiff
path: root/src/qdoc/catch_conversions/src/catch_conversions/qt_catch_conversions.h
diff options
context:
space:
mode:
authorLuca Di Sera <luca.disera@qt.io>2023-05-10 16:29:48 +0200
committerLuca Di Sera <luca.disera@qt.io>2023-05-11 11:17:21 +0200
commit453fa4ca39c93f31d496d856babda17b919d6cec (patch)
tree460662fc03e25a23d401d65bb8e225e03c453289 /src/qdoc/catch_conversions/src/catch_conversions/qt_catch_conversions.h
parentd927a87b765681dc7fb1bf2ba81a113000141d7b (diff)
downloadqttools-453fa4ca39c93f31d496d856babda17b919d6cec.tar.gz
QDoc: Move catch_conversions under src
QDoc employs a very small support library, "catch_conversions", to provide better output for certain types when used with the Catch2 testing framework, which QDoc uses for some of its tests. "catch_conversions" was currently kept under "tests/auto/qdoc" and its headers were included and used directly by its sibling tests by relative paths. Due to a certain restructuring that is happening in QDoc, with one of the goals, among others, being to increase the locality of QDoc-related code under "src/qdoc", the "catch_conversions" support library is now moved under "src/qdoc". To allow code that depended on it to keep their usages without requiring the addition of some relative paths from the "tests" directory to the "src" directory, a library target, "Qt::QDocCatchConversionsPrivate" was created for the support library. The target can be linked-to to gain access to the previously-directly-used headers, with include path "catch_conversions/.*". To allow for this specific include path to work, the internal directory structure for "catch_conversions" was slightly modified with the addition of some intermediate directories in between its root and the library headers. Targets under "tests/auto/qdoc" that used the dependency now link to it instead. Hence, their "CMakeLists.txt" files were modified to avoid using the dependency as an include directory and instead use "Qt::QDocCatchConversionsPrivate" as a library. The inclusions of the of the "catch_conversions" headers in relevant sources was modified to respect the new "catch_conversions/.*" path. The root "CMakeLists.txt" file under "src/qdoc" was modified to add the relevant library as a subdirectory. Change-Id: Iec24ca3877a48a42a55ff406309813aa083ab23f Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'src/qdoc/catch_conversions/src/catch_conversions/qt_catch_conversions.h')
-rw-r--r--src/qdoc/catch_conversions/src/catch_conversions/qt_catch_conversions.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/qdoc/catch_conversions/src/catch_conversions/qt_catch_conversions.h b/src/qdoc/catch_conversions/src/catch_conversions/qt_catch_conversions.h
new file mode 100644
index 000000000..68abf5fb0
--- /dev/null
+++ b/src/qdoc/catch_conversions/src/catch_conversions/qt_catch_conversions.h
@@ -0,0 +1,19 @@
+// Copyright (C) 2021 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
+
+#pragma once
+
+#include "std_catch_conversions.h"
+
+#include <ostream>
+
+#include <QChar>
+#include <QString>
+
+inline std::ostream& operator<<(std::ostream& os, const QChar& character) {
+ return os << QString{character}.toStdString();
+}
+
+inline std::ostream& operator<<(std::ostream& os, const QString& string) {
+ return os << string.toStdString();
+}