aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2019-07-30 15:26:31 +0200
committerNikolai Kosjar <nikolai.kosjar@qt.io>2019-08-30 08:42:22 +0000
commit0ba729e527da37f7c5d7fbc59247971df3da7d8a (patch)
treef6397a18ab4a7850b656f7b6e7a68f3d8a4e49ae /src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h
parentd663b8e406c89585f123207d6e07832d1818e53b (diff)
Import YAML-Parser yaml-cpp
Version: tags/yaml-cpp-0.6.2 License: MIT yaml-cpp requires c++11 and since yaml-cpp 0.6 there is no dependency on boost anymore. A YAML parser is needed for the ClangTools plugin to parse exported diagnostics from clang-tidy/clazy: $ clang-tidy -export-fixes=/tmp/tidy.yaml source.cpp The imported source is stripped of unneeded files as documented with src/libs/3rdparty/yaml-cpp/patches/0001-yaml-cpp-Strip-unneeded-sources.patch (generated with "git format-patch -D") Change-Id: Ib0a521b5aff4b1cd058eb480bfb99fde4b320dc7 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h')
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h
new file mode 100644
index 0000000000..06780c861f
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h
@@ -0,0 +1,51 @@
+#ifndef STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#define STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+#include <vector>
+#include <list>
+#include <set>
+#include <map>
+
+namespace YAML {
+template <typename Seq>
+inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
+ emitter << BeginSeq;
+ for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it)
+ emitter << *it;
+ emitter << EndSeq;
+ return emitter;
+}
+
+template <typename T>
+inline Emitter& operator<<(Emitter& emitter, const std::vector<T>& v) {
+ return EmitSeq(emitter, v);
+}
+
+template <typename T>
+inline Emitter& operator<<(Emitter& emitter, const std::list<T>& v) {
+ return EmitSeq(emitter, v);
+}
+
+template <typename T>
+inline Emitter& operator<<(Emitter& emitter, const std::set<T>& v) {
+ return EmitSeq(emitter, v);
+}
+
+template <typename K, typename V>
+inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) {
+ typedef typename std::map<K, V> map;
+ emitter << BeginMap;
+ for (typename map::const_iterator it = m.begin(); it != m.end(); ++it)
+ emitter << Key << it->first << Value << it->second;
+ emitter << EndMap;
+ return emitter;
+}
+}
+
+#endif // STLEMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66