LeechCraft  0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
debugprinters.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include "sllconfig.h"
12 #include <QDebug>
13 #include <QDomDocument>
14 #include "either.h"
15 
16 UTIL_SLL_API QDebug operator<< (QDebug, const QDomDocument::ParseResult&);
17 
18 namespace LC::Util
19 {
20  template<typename T>
21  concept QDebuggable = requires (T t, QDebug out) { out << t; };
22 
23  template<QDebuggable L, QDebuggable R>
24  QDebug operator<< (QDebug out, const Either<L, R>& either)
25  {
26  QDebugStateSaver saver { out };
27  Visit (either,
28  [&out] (const L& l) { out.nospace () << "L { " << l << " }"; },
29  [&out] (const R& r) { out.nospace () << "R { " << r << " }"; });
30  return out;
31  }
32 }
#define UTIL_SLL_API
Definition: sllconfig.h:16
auto Visit(const Either< Left, Right > &either, Args &&... args)
Definition: either.h:180
UTIL_SLL_API QDebug operator<<(QDebug, const QDomDocument::ParseResult &)
concept QDebuggable
Definition: debugprinters.h:21
requires(Tup1Size==Tup2Size) const expr auto ZipWith(Tup1 &&tup1