File indexing completed on 2024-06-02 05:41:12
0001 /* 0002 SPDX-FileCopyrightText: 2015 Ivan Cukic <ivan.cukic(at)kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef DEBUG_AND_RETURN_H 0008 #define DEBUG_AND_RETURN_H 0009 0010 #ifdef QT_DEBUG 0011 #include <QDebug> 0012 #endif 0013 0014 namespace kamd 0015 { 0016 namespace utils 0017 { 0018 template<typename T> 0019 T debug_and_return(bool debug, const char *message, T &&value) 0020 { 0021 if (debug) { 0022 qDebug().noquote() << message << " " << value; 0023 } 0024 0025 return std::forward<T>(value); 0026 } 0027 0028 } // namespace utils 0029 } // namespace kamd 0030 0031 #endif // DEBUG_AND_RETURN_H