From 6de82e6857ebabf47f50a4517ed5d69fde9044c7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 21 Apr 2020 16:39:02 +0200 Subject: [PATCH] [libcalamares] Add convenience for QDebug.noquote() - Use << Logger::NoQuote{} to turn off quoting **and** the space - In practice, in Calamares we use this only around other processes' output, where we want neither quotes nor spaces. --- src/libcalamares/utils/Logger.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libcalamares/utils/Logger.h b/src/libcalamares/utils/Logger.h index fe4b98fd4..24198e256 100644 --- a/src/libcalamares/utils/Logger.h +++ b/src/libcalamares/utils/Logger.h @@ -33,6 +33,9 @@ struct FuncSuppressor const char* m_s; }; +struct NoQuote {}; +struct Quote {}; + DLLEXPORT extern const FuncSuppressor Continuation; DLLEXPORT extern const FuncSuppressor SubEntry; @@ -74,6 +77,18 @@ operator<<( QDebug& s, const FuncSuppressor& f ) return s << f.m_s; } +inline QDebug& +operator<<( QDebug& s, const NoQuote& ) +{ + return s.noquote().nospace(); +} + +inline QDebug& +operator<<( QDebug& s, const Quote& ) +{ + return s.quote().space(); +} + /** * @brief The full path of the log file. */