mirror of https://github.com/qt/qtgrpc.git
QGrpcCallOptions: add debug streaming support
Change-Id: Id8a4616f69e9499b8bc77997016030f4e9a9fb94 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
434d7e1da4
commit
bf5bec1f02
|
|
@ -4,6 +4,8 @@
|
|||
#include <QtGrpc/private/qtgrpcglobal_p.h>
|
||||
#include <QtGrpc/qgrpccalloptions.h>
|
||||
|
||||
#include <QtCore/qdebug.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
using namespace Qt::StringLiterals;
|
||||
|
|
@ -124,5 +126,21 @@ QGrpcMetadata QGrpcCallOptions::metadata() && noexcept
|
|||
return std::move(dPtr->metadata);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
/*!
|
||||
\since 6.8
|
||||
\fn QDebug QGrpcCallOptions::operator<<(QDebug debug, const QGrpcCallOptions &callOpts)
|
||||
Writes \a callOpts to the specified stream \a debug.
|
||||
*/
|
||||
QDebug operator<<(QDebug debug, const QGrpcCallOptions &callOpts)
|
||||
{
|
||||
QDebugStateSaver save(debug);
|
||||
debug.nospace();
|
||||
debug.noquote();
|
||||
debug << "QGrpcCallOptions(deadline: " << callOpts.deadline()
|
||||
<< ", metadata: " << callOpts.metadata() << ')';
|
||||
return debug;
|
||||
}
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDebug;
|
||||
class QGrpcCallOptionsPrivate;
|
||||
|
||||
class QGrpcCallOptions final
|
||||
|
|
@ -35,6 +36,10 @@ public:
|
|||
|
||||
private:
|
||||
std::unique_ptr<QGrpcCallOptionsPrivate> dPtr;
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
friend Q_GRPC_EXPORT QDebug operator<<(QDebug debug, const QGrpcCallOptions &callOpts);
|
||||
#endif
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
|||
Loading…
Reference in New Issue