From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/common/ostream_temp.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/common/ostream_temp.h (limited to 'src/common/ostream_temp.h') diff --git a/src/common/ostream_temp.h b/src/common/ostream_temp.h new file mode 100644 index 000000000..722b189cd --- /dev/null +++ b/src/common/ostream_temp.h @@ -0,0 +1,39 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#pragma once + +#include + +typedef enum { + CLOG_DEBUG = 0, + CLOG_INFO = 1, + CLOG_SEC = 2, + CLOG_WARN = 3, + CLOG_ERROR = 4, + CLOG_UNKNOWN = -1, +} clog_type; + +class OstreamTemp +{ +public: + class OstreamTempSink { + public: + virtual void do_log(clog_type prio, std::stringstream& ss) = 0; + virtual ~OstreamTempSink() {} + }; + OstreamTemp(clog_type type_, OstreamTempSink *parent_); + OstreamTemp(OstreamTemp &&rhs) = default; + ~OstreamTemp(); + + template + std::ostream& operator<<(const T& rhs) + { + return ss << rhs; + } + +private: + clog_type type; + OstreamTempSink *parent; + std::stringstream ss; +}; -- cgit v1.2.3