aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/botan/src/lib/filters/data_snk.h
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-08-15 13:53:28 +0200
committerEike Ziller <eike.ziller@qt.io>2018-08-15 13:53:28 +0200
commitdb9837fa6c9401e898ac8e7492081a6e21c71790 (patch)
treed542a089711257402ac4fe70813fa0e7de825f2e /src/libs/3rdparty/botan/src/lib/filters/data_snk.h
parent7bc14bf3498ea6b1c19abacf85a5103772da26bc (diff)
parent58747b2de107e8f6ac00daeb431ecbf3e603fd34 (diff)
Merge remote-tracking branch 'origin/4.7'
Conflicts: src/plugins/clangtools/clangtoolruncontrol.cpp src/plugins/cpptools/compileroptionsbuilder.cpp Change-Id: Ib1e8abf066898b50c90fc1ccba4697fe983e8a8f
Diffstat (limited to 'src/libs/3rdparty/botan/src/lib/filters/data_snk.h')
-rw-r--r--src/libs/3rdparty/botan/src/lib/filters/data_snk.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/libs/3rdparty/botan/src/lib/filters/data_snk.h b/src/libs/3rdparty/botan/src/lib/filters/data_snk.h
new file mode 100644
index 00000000000..49484b1c1a6
--- /dev/null
+++ b/src/libs/3rdparty/botan/src/lib/filters/data_snk.h
@@ -0,0 +1,76 @@
+/*
+* DataSink
+* (C) 1999-2007 Jack Lloyd
+* 2017 Philippe Lieser
+*
+* Botan is released under the Simplified BSD License (see license.txt)
+*/
+
+#ifndef BOTAN_DATA_SINK_H_
+#define BOTAN_DATA_SINK_H_
+
+#include <botan/filter.h>
+#include <memory>
+#include <iosfwd>
+
+namespace Botan {
+
+/**
+* This class represents abstract data sink objects.
+*/
+class BOTAN_PUBLIC_API(2,0) DataSink : public Filter
+ {
+ public:
+ bool attachable() override { return false; }
+ DataSink() = default;
+ virtual ~DataSink() = default;
+
+ DataSink& operator=(const DataSink&) = delete;
+ DataSink(const DataSink&) = delete;
+ };
+
+/**
+* This class represents a data sink which writes its output to a stream.
+*/
+class BOTAN_PUBLIC_API(2,0) DataSink_Stream final : public DataSink
+ {
+ public:
+ /**
+ * Construct a DataSink_Stream from a stream.
+ * @param stream the stream to write to
+ * @param name identifier
+ */
+ DataSink_Stream(std::ostream& stream,
+ const std::string& name = "<std::ostream>");
+
+#if defined(BOTAN_TARGET_OS_HAS_FILESYSTEM)
+
+ /**
+ * Construct a DataSink_Stream from a filesystem path name.
+ * @param pathname the name of the file to open a stream to
+ * @param use_binary indicates whether to treat the file
+ * as a binary file or not
+ */
+ DataSink_Stream(const std::string& pathname,
+ bool use_binary = false);
+#endif
+
+ std::string name() const override { return m_identifier; }
+
+ void write(const uint8_t[], size_t) override;
+
+ void end_msg() override;
+
+ ~DataSink_Stream();
+
+ private:
+ const std::string m_identifier;
+
+ // May be null, if m_sink was an external reference
+ std::unique_ptr<std::ostream> m_sink_memory;
+ std::ostream& m_sink;
+ };
+
+}
+
+#endif