aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/3rdparty/yaml-cpp/include
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2023-08-25 12:55:14 +0200
committerEike Ziller <eike.ziller@qt.io>2023-08-28 06:29:55 +0000
commit6c9d4a60e00cd00712d739746d9ded34876901a9 (patch)
tree0e5bc434b9aa451c725f8d37f5cbe571b9c76335 /src/libs/3rdparty/yaml-cpp/include
parentbe54b3db2f4356d477b372bd4528415f2fa57e85 (diff)
Update yaml-cpp to 0.8.0
With removal of unneeded files similar to the original import, the patch in patches/0001-... generated with git format-patch -D HEAD~1 to show just the removed files. Change-Id: Ibfe64439bae5d1b1baa6b6bc47caf1ae030b3f9d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/libs/3rdparty/yaml-cpp/include')
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/anchor.h2
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/binary.h12
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/depthguard.h77
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h85
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitfromevents.h24
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitter.h35
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emittermanip.h19
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/eventhandler.h9
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h94
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/convert.h276
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h26
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/impl.h116
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator.h11
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h4
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/memory.h7
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node.h32
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_data.h24
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h28
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/impl.h173
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/iterator.h5
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/node.h11
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/ptr.h11
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noexcept.h18
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noncopyable.h25
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/ostream_wrapper.h10
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/parser.h10
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h9
-rw-r--r--src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h36
28 files changed, 758 insertions, 431 deletions
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/anchor.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/anchor.h
index 06759c724d..f46d1d79dd 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/anchor.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/anchor.h
@@ -10,7 +10,7 @@
#include <cstddef>
namespace YAML {
-typedef std::size_t anchor_t;
+using anchor_t = std::size_t;
const anchor_t NullAnchor = 0;
}
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/binary.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/binary.h
index 29d5dbd027..1050dae98c 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/binary.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/binary.h
@@ -19,9 +19,13 @@ YAML_CPP_API std::vector<unsigned char> DecodeBase64(const std::string &input);
class YAML_CPP_API Binary {
public:
- Binary() : m_unownedData(0), m_unownedSize(0) {}
Binary(const unsigned char *data_, std::size_t size_)
- : m_unownedData(data_), m_unownedSize(size_) {}
+ : m_data{}, m_unownedData(data_), m_unownedSize(size_) {}
+ Binary() : Binary(nullptr, 0) {}
+ Binary(const Binary &) = default;
+ Binary(Binary &&) = default;
+ Binary &operator=(const Binary &) = default;
+ Binary &operator=(Binary &&) = default;
bool owned() const { return !m_unownedData; }
std::size_t size() const { return owned() ? m_data.size() : m_unownedSize; }
@@ -35,7 +39,7 @@ class YAML_CPP_API Binary {
rhs.clear();
rhs.resize(m_unownedSize);
std::copy(m_unownedData, m_unownedData + m_unownedSize, rhs.begin());
- m_unownedData = 0;
+ m_unownedData = nullptr;
m_unownedSize = 0;
} else {
m_data.swap(rhs);
@@ -62,6 +66,6 @@ class YAML_CPP_API Binary {
const unsigned char *m_unownedData;
std::size_t m_unownedSize;
};
-}
+} // namespace YAML
#endif // BASE64_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/depthguard.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/depthguard.h
new file mode 100644
index 0000000000..8ca61ac6cc
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/depthguard.h
@@ -0,0 +1,77 @@
+#ifndef DEPTH_GUARD_H_00000000000000000000000000000000000000000000000000000000
+#define DEPTH_GUARD_H_00000000000000000000000000000000000000000000000000000000
+
+#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 "exceptions.h"
+
+namespace YAML {
+
+/**
+ * @brief The DeepRecursion class
+ * An exception class which is thrown by DepthGuard. Ideally it should be
+ * a member of DepthGuard. However, DepthGuard is a templated class which means
+ * that any catch points would then need to know the template parameters. It is
+ * simpler for clients to not have to know at the catch point what was the
+ * maximum depth.
+ */
+class DeepRecursion : public ParserException {
+public:
+ virtual ~DeepRecursion() = default;
+
+ DeepRecursion(int depth, const Mark& mark_, const std::string& msg_);
+
+ // Returns the recursion depth when the exception was thrown
+ int depth() const {
+ return m_depth;
+ }
+
+private:
+ int m_depth = 0;
+};
+
+/**
+ * @brief The DepthGuard class
+ * DepthGuard takes a reference to an integer. It increments the integer upon
+ * construction of DepthGuard and decrements the integer upon destruction.
+ *
+ * If the integer would be incremented past max_depth, then an exception is
+ * thrown. This is ideally geared toward guarding against deep recursion.
+ *
+ * @param max_depth
+ * compile-time configurable maximum depth.
+ */
+template <int max_depth = 2000>
+class DepthGuard final {
+public:
+ DepthGuard(int & depth_, const Mark& mark_, const std::string& msg_) : m_depth(depth_) {
+ ++m_depth;
+ if ( max_depth <= m_depth ) {
+ throw DeepRecursion{m_depth, mark_, msg_};
+ }
+ }
+
+ DepthGuard(const DepthGuard & copy_ctor) = delete;
+ DepthGuard(DepthGuard && move_ctor) = delete;
+ DepthGuard & operator=(const DepthGuard & copy_assign) = delete;
+ DepthGuard & operator=(DepthGuard && move_assign) = delete;
+
+ ~DepthGuard() {
+ --m_depth;
+ }
+
+ int current_depth() const {
+ return m_depth;
+ }
+
+private:
+ int & m_depth;
+};
+
+} // namespace YAML
+
+#endif // DEPTH_GUARD_H_00000000000000000000000000000000000000000000000000000000
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h
index 897f1533df..eabdda1d95 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/dll.h
@@ -1,42 +1,61 @@
#ifndef DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
#define DLL_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
-
-// The following ifdef block is the standard way of creating macros which make
-// exporting from a DLL simpler. All files within this DLL are compiled with the
-// yaml_cpp_EXPORTS symbol defined on the command line. This symbol should not
-// be defined on any project that uses this DLL. This way any other project
-// whose source files include this file see YAML_CPP_API functions as being
-// imported from a DLL, whereas this DLL sees symbols defined with this macro as
-// being exported.
-#undef YAML_CPP_API
+// Definition YAML_CPP_STATIC_DEFINE using to building YAML-CPP as static
+// library (definition created by CMake or defined manually)
-#ifdef YAML_CPP_DLL // Using or Building YAML-CPP DLL (definition defined
- // manually)
+// Definition yaml_cpp_EXPORTS using to building YAML-CPP as dll/so library
+// (definition created by CMake or defined manually)
-#if defined(_WIN32) || defined(WIN32)
-# define YAML_CPP_API_IMPORT __declspec(dllimport)
-# define YAML_CPP_API_EXPORT __declspec(dllexport)
+#ifdef YAML_CPP_STATIC_DEFINE
+# define YAML_CPP_API
+# define YAML_CPP_NO_EXPORT
#else
-# define YAML_CPP_API_IMPORT __attribute__((visibility("default")))
-# define YAML_CPP_API_EXPORT __attribute__((visibility("default")))
+# if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
+# ifndef YAML_CPP_API
+# ifdef yaml_cpp_EXPORTS
+ /* We are building this library */
+# pragma message( "Defining YAML_CPP_API for DLL export" )
+# define YAML_CPP_API __declspec(dllexport)
+# else
+ /* We are using this library */
+# pragma message( "Defining YAML_CPP_API for DLL import" )
+# define YAML_CPP_API __declspec(dllimport)
+# endif
+# endif
+# ifndef YAML_CPP_NO_EXPORT
+# define YAML_CPP_NO_EXPORT
+# endif
+# else /* No _MSC_VER */
+# ifndef YAML_CPP_API
+# ifdef yaml_cpp_EXPORTS
+ /* We are building this library */
+# define YAML_CPP_API __attribute__((visibility("default")))
+# else
+ /* We are using this library */
+# define YAML_CPP_API __attribute__((visibility("default")))
+# endif
+# endif
+# ifndef YAML_CPP_NO_EXPORT
+# define YAML_CPP_NO_EXPORT __attribute__((visibility("hidden")))
+# endif
+# endif /* _MSC_VER */
+#endif /* YAML_CPP_STATIC_DEFINE */
+
+#ifndef YAML_CPP_DEPRECATED
+# ifdef _MSC_VER
+# define YAML_CPP_DEPRECATED __declspec(deprecated)
+# else
+# define YAML_CPP_DEPRECATED __attribute__ ((__deprecated__))
+# endif
#endif
-#ifdef yaml_cpp_EXPORTS // Building YAML-CPP DLL (definition created by CMake
- // or defined manually)
-// #pragma message( "Defining YAML_CPP_API for DLL export" )
-#define YAML_CPP_API YAML_CPP_API_EXPORT
-#else // yaml_cpp_EXPORTS
-// #pragma message( "Defining YAML_CPP_API for DLL import" )
-#define YAML_CPP_API YAML_CPP_API_IMPORT
-#endif // yaml_cpp_EXPORTS
-#else // YAML_CPP_DLL
-#define YAML_CPP_API
-#endif // YAML_CPP_DLL
+#ifndef YAML_CPP_DEPRECATED_EXPORT
+# define YAML_CPP_DEPRECATED_EXPORT YAML_CPP_API YAML_CPP_DEPRECATED
+#endif
+
+#ifndef YAML_CPP_DEPRECATED_NO_EXPORT
+# define YAML_CPP_DEPRECATED_NO_EXPORT YAML_CPP_NO_EXPORT YAML_CPP_DEPRECATED
+#endif
-#endif // DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
+#endif /* DLL_H_62B23520_7C8E_11DE_8A39_0800200C9A66 */
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitfromevents.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitfromevents.h
index f14b051ab0..1f389c5a13 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitfromevents.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitfromevents.h
@@ -24,21 +24,21 @@ class EmitFromEvents : public EventHandler {
public:
EmitFromEvents(Emitter& emitter);
- virtual void OnDocumentStart(const Mark& mark);
- virtual void OnDocumentEnd();
+ void OnDocumentStart(const Mark& mark) override;
+ void OnDocumentEnd() override;
- virtual void OnNull(const Mark& mark, anchor_t anchor);
- virtual void OnAlias(const Mark& mark, anchor_t anchor);
- virtual void OnScalar(const Mark& mark, const std::string& tag,
- anchor_t anchor, const std::string& value);
+ void OnNull(const Mark& mark, anchor_t anchor) override;
+ void OnAlias(const Mark& mark, anchor_t anchor) override;
+ void OnScalar(const Mark& mark, const std::string& tag,
+ anchor_t anchor, const std::string& value) override;
- virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
- anchor_t anchor, EmitterStyle::value style);
- virtual void OnSequenceEnd();
+ void OnSequenceStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) override;
+ void OnSequenceEnd() override;
- virtual void OnMapStart(const Mark& mark, const std::string& tag,
- anchor_t anchor, EmitterStyle::value style);
- virtual void OnMapEnd();
+ void OnMapStart(const Mark& mark, const std::string& tag,
+ anchor_t anchor, EmitterStyle::value style) override;
+ void OnMapEnd() override;
private:
void BeginNode();
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitter.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitter.h
index ef92cc4035..210b1ec974 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitter.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emitter.h
@@ -7,16 +7,18 @@
#pragma once
#endif
+#include <cmath>
#include <cstddef>
+#include <limits>
#include <memory>
#include <sstream>
#include <string>
+#include <type_traits>
#include "yaml-cpp/binary.h"
#include "yaml-cpp/dll.h"
#include "yaml-cpp/emitterdef.h"
#include "yaml-cpp/emittermanip.h"
-#include "yaml-cpp/noncopyable.h"
#include "yaml-cpp/null.h"
#include "yaml-cpp/ostream_wrapper.h"
@@ -28,10 +30,12 @@ struct _Null;
namespace YAML {
class EmitterState;
-class YAML_CPP_API Emitter : private noncopyable {
+class YAML_CPP_API Emitter {
public:
Emitter();
explicit Emitter(std::ostream& stream);
+ Emitter(const Emitter&) = delete;
+ Emitter& operator=(const Emitter&) = delete;
~Emitter();
// output
@@ -46,6 +50,7 @@ class YAML_CPP_API Emitter : private noncopyable {
bool SetOutputCharset(EMITTER_MANIP value);
bool SetStringFormat(EMITTER_MANIP value);
bool SetBoolFormat(EMITTER_MANIP value);
+ bool SetNullFormat(EMITTER_MANIP value);
bool SetIntBase(EMITTER_MANIP value);
bool SetSeqFormat(EMITTER_MANIP value);
bool SetMapFormat(EMITTER_MANIP value);
@@ -54,6 +59,7 @@ class YAML_CPP_API Emitter : private noncopyable {
bool SetPostCommentIndent(std::size_t n);
bool SetFloatPrecision(std::size_t n);
bool SetDoublePrecision(std::size_t n);
+ void RestoreGlobalModifiedSettings();
// local setters
Emitter& SetLocalValue(EMITTER_MANIP value);
@@ -119,6 +125,7 @@ class YAML_CPP_API Emitter : private noncopyable {
void SpaceOrIndentTo(bool requireSpace, std::size_t indent);
const char* ComputeFullBoolName(bool b) const;
+ const char* ComputeNullName() const;
bool CanEmitNewline() const;
private:
@@ -152,7 +159,27 @@ inline Emitter& Emitter::WriteStreamable(T value) {
std::stringstream stream;
SetStreamablePrecision<T>(stream);
- stream << value;
+
+ bool special = false;
+ if (std::is_floating_point<T>::value) {
+ if ((std::numeric_limits<T>::has_quiet_NaN ||
+ std::numeric_limits<T>::has_signaling_NaN) &&
+ std::isnan(value)) {
+ special = true;
+ stream << ".nan";
+ } else if (std::numeric_limits<T>::has_infinity && std::isinf(value)) {
+ special = true;
+ if (std::signbit(value)) {
+ stream << "-.inf";
+ } else {
+ stream << ".inf";
+ }
+ }
+ }
+
+ if (!special) {
+ stream << value;
+ }
m_stream << stream.str();
StartedScalar();
@@ -249,6 +276,6 @@ inline Emitter& operator<<(Emitter& emitter, _Indent indent) {
inline Emitter& operator<<(Emitter& emitter, _Precision precision) {
return emitter.SetLocalPrecision(precision);
}
-}
+} // namespace YAML
#endif // EMITTER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emittermanip.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emittermanip.h
index 89f7256714..976d14950f 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emittermanip.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/emittermanip.h
@@ -19,6 +19,7 @@ enum EMITTER_MANIP {
// output character set
EmitNonAscii,
EscapeNonAscii,
+ EscapeAsJson,
// string manipulators
// Auto, // duplicate
@@ -26,6 +27,12 @@ enum EMITTER_MANIP {
DoubleQuoted,
Literal,
+ // null manipulators
+ LowerNull,
+ UpperNull,
+ CamelNull,
+ TildeNull,
+
// bool manipulators
YesNoBool, // yes, no
TrueFalseBool, // true, false
@@ -74,14 +81,14 @@ struct _Alias {
std::string content;
};
-inline _Alias Alias(const std::string content) { return _Alias(content); }
+inline _Alias Alias(const std::string& content) { return _Alias(content); }
struct _Anchor {
_Anchor(const std::string& content_) : content(content_) {}
std::string content;
};
-inline _Anchor Anchor(const std::string content) { return _Anchor(content); }
+inline _Anchor Anchor(const std::string& content) { return _Anchor(content); }
struct _Tag {
struct Type {
@@ -96,11 +103,11 @@ struct _Tag {
Type::value type;
};
-inline _Tag VerbatimTag(const std::string content) {
+inline _Tag VerbatimTag(const std::string& content) {
return _Tag("", content, _Tag::Type::Verbatim);
}
-inline _Tag LocalTag(const std::string content) {
+inline _Tag LocalTag(const std::string& content) {
return _Tag("", content, _Tag::Type::PrimaryHandle);
}
@@ -108,7 +115,7 @@ inline _Tag LocalTag(const std::string& prefix, const std::string content) {
return _Tag(prefix, content, _Tag::Type::NamedHandle);
}
-inline _Tag SecondaryTag(const std::string content) {
+inline _Tag SecondaryTag(const std::string& content) {
return _Tag("", content, _Tag::Type::NamedHandle);
}
@@ -117,7 +124,7 @@ struct _Comment {
std::string content;
};
-inline _Comment Comment(const std::string content) { return _Comment(content); }
+inline _Comment Comment(const std::string& content) { return _Comment(content); }
struct _Precision {
_Precision(int floatPrecision_, int doublePrecision_)
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/eventhandler.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/eventhandler.h
index efe381c621..7242fe1f5b 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/eventhandler.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/eventhandler.h
@@ -17,7 +17,7 @@ struct Mark;
class EventHandler {
public:
- virtual ~EventHandler() {}
+ virtual ~EventHandler() = default;
virtual void OnDocumentStart(const Mark& mark) = 0;
virtual void OnDocumentEnd() = 0;
@@ -34,7 +34,12 @@ class EventHandler {
virtual void OnMapStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) = 0;
virtual void OnMapEnd() = 0;
+
+ virtual void OnAnchor(const Mark& /*mark*/,
+ const std::string& /*anchor_name*/) {
+ // empty default implementation for compatibility
+ }
};
-}
+} // namespace YAML
#endif // EVENTHANDLER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h
index eae31968b7..f6b2602ae1 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/exceptions.h
@@ -8,13 +8,12 @@
#endif
#include "yaml-cpp/mark.h"
+#include "yaml-cpp/noexcept.h"
#include "yaml-cpp/traits.h"
#include <sstream>
#include <stdexcept>
#include <string>
-#define YAML_CPP_NOEXCEPT noexcept
-
namespace YAML {
// error messages
namespace ErrorMsg {
@@ -66,7 +65,7 @@ const char* const ZERO_INDENT_IN_BLOCK =
const char* const CHAR_IN_BLOCK = "unexpected character in block scalar";
const char* const AMBIGUOUS_ANCHOR =
"cannot assign the same alias to multiple nodes";
-const char* const UNKNOWN_ANCHOR = "the referenced anchor is not defined";
+const char* const UNKNOWN_ANCHOR = "the referenced anchor is not defined: ";
const char* const INVALID_NODE =
"invalid node; this may result from using a map iterator as a sequence "
@@ -101,6 +100,12 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) {
return stream.str();
}
+inline const std::string KEY_NOT_FOUND_WITH_KEY(const char* key) {
+ std::stringstream stream;
+ stream << KEY_NOT_FOUND << ": " << key;
+ return stream.str();
+}
+
template <typename T>
inline const std::string KEY_NOT_FOUND_WITH_KEY(
const T& key, typename enable_if<is_numeric<T>>::type* = 0) {
@@ -108,13 +113,48 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(
stream << KEY_NOT_FOUND << ": " << key;
return stream.str();
}
+
+template <typename T>
+inline const std::string BAD_SUBSCRIPT_WITH_KEY(
+ const T&, typename disable_if<is_numeric<T>>::type* = nullptr) {
+ return BAD_SUBSCRIPT;
+}
+
+inline const std::string BAD_SUBSCRIPT_WITH_KEY(const std::string& key) {
+ std::stringstream stream;
+ stream << BAD_SUBSCRIPT << " (key: \"" << key << "\")";
+ return stream.str();
+}
+
+inline const std::string BAD_SUBSCRIPT_WITH_KEY(const char* key) {
+ std::stringstream stream;
+ stream << BAD_SUBSCRIPT << " (key: \"" << key << "\")";
+ return stream.str();
+}
+
+template <typename T>
+inline const std::string BAD_SUBSCRIPT_WITH_KEY(
+ const T& key, typename enable_if<is_numeric<T>>::type* = nullptr) {
+ std::stringstream stream;
+ stream << BAD_SUBSCRIPT << " (key: \"" << key << "\")";
+ return stream.str();
+}
+
+inline const std::string INVALID_NODE_WITH_KEY(const std::string& key) {
+ std::stringstream stream;
+ if (key.empty()) {
+ return INVALID_NODE;
+ }
+ stream << "invalid node; first invalid key: \"" << key << "\"";
+ return stream.str();
}
+} // namespace ErrorMsg
class YAML_CPP_API Exception : public std::runtime_error {
public:
Exception(const Mark& mark_, const std::string& msg_)
: std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
- virtual ~Exception() YAML_CPP_NOEXCEPT;
+ ~Exception() YAML_CPP_NOEXCEPT override;
Exception(const Exception&) = default;
@@ -125,7 +165,7 @@ class YAML_CPP_API Exception : public std::runtime_error {
static const std::string build_what(const Mark& mark,
const std::string& msg) {
if (mark.is_null()) {
- return msg.c_str();
+ return msg;
}
std::stringstream output;
@@ -140,7 +180,7 @@ class YAML_CPP_API ParserException : public Exception {
ParserException(const Mark& mark_, const std::string& msg_)
: Exception(mark_, msg_) {}
ParserException(const ParserException&) = default;
- virtual ~ParserException() YAML_CPP_NOEXCEPT;
+ ~ParserException() YAML_CPP_NOEXCEPT override;
};
class YAML_CPP_API RepresentationException : public Exception {
@@ -148,7 +188,7 @@ class YAML_CPP_API RepresentationException : public Exception {
RepresentationException(const Mark& mark_, const std::string& msg_)
: Exception(mark_, msg_) {}
RepresentationException(const RepresentationException&) = default;
- virtual ~RepresentationException() YAML_CPP_NOEXCEPT;
+ ~RepresentationException() YAML_CPP_NOEXCEPT override;
};
// representation exceptions
@@ -157,7 +197,7 @@ class YAML_CPP_API InvalidScalar : public RepresentationException {
InvalidScalar(const Mark& mark_)
: RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
InvalidScalar(const InvalidScalar&) = default;
- virtual ~InvalidScalar() YAML_CPP_NOEXCEPT;
+ ~InvalidScalar() YAML_CPP_NOEXCEPT override;
};
class YAML_CPP_API KeyNotFound : public RepresentationException {
@@ -167,7 +207,7 @@ class YAML_CPP_API KeyNotFound : public RepresentationException {
: RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {
}
KeyNotFound(const KeyNotFound&) = default;
- virtual ~KeyNotFound() YAML_CPP_NOEXCEPT;
+ ~KeyNotFound() YAML_CPP_NOEXCEPT override;
};
template <typename T>
@@ -175,7 +215,7 @@ class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
public:
TypedKeyNotFound(const Mark& mark_, const T& key_)
: KeyNotFound(mark_, key_), key(key_) {}
- virtual ~TypedKeyNotFound() YAML_CPP_NOEXCEPT {}
+ ~TypedKeyNotFound() YAML_CPP_NOEXCEPT override = default;
T key;
};
@@ -188,10 +228,11 @@ inline TypedKeyNotFound<T> MakeTypedKeyNotFound(const Mark& mark,
class YAML_CPP_API InvalidNode : public RepresentationException {
public:
- InvalidNode()
- : RepresentationException(Mark::null_mark(), ErrorMsg::INVALID_NODE) {}
+ InvalidNode(const std::string& key)
+ : RepresentationException(Mark::null_mark(),
+ ErrorMsg::INVALID_NODE_WITH_KEY(key)) {}
InvalidNode(const InvalidNode&) = default;
- virtual ~InvalidNode() YAML_CPP_NOEXCEPT;
+ ~InvalidNode() YAML_CPP_NOEXCEPT override;
};
class YAML_CPP_API BadConversion : public RepresentationException {
@@ -199,7 +240,7 @@ class YAML_CPP_API BadConversion : public RepresentationException {
explicit BadConversion(const Mark& mark_)
: RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
BadConversion(const BadConversion&) = default;
- virtual ~BadConversion() YAML_CPP_NOEXCEPT;
+ ~BadConversion() YAML_CPP_NOEXCEPT override;
};
template <typename T>
@@ -213,15 +254,16 @@ class YAML_CPP_API BadDereference : public RepresentationException {
BadDereference()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
BadDereference(const BadDereference&) = default;
- virtual ~BadDereference() YAML_CPP_NOEXCEPT;
+ ~BadDereference() YAML_CPP_NOEXCEPT override;
};
class YAML_CPP_API BadSubscript : public RepresentationException {
public:
- BadSubscript()
- : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_SUBSCRIPT) {}
+ template <typename Key>
+ BadSubscript(const Mark& mark_, const Key& key)
+ : RepresentationException(mark_, ErrorMsg::BAD_SUBSCRIPT_WITH_KEY(key)) {}
BadSubscript(const BadSubscript&) = default;
- virtual ~BadSubscript() YAML_CPP_NOEXCEPT;
+ ~BadSubscript() YAML_CPP_NOEXCEPT override;
};
class YAML_CPP_API BadPushback : public RepresentationException {
@@ -229,7 +271,7 @@ class YAML_CPP_API BadPushback : public RepresentationException {
BadPushback()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
BadPushback(const BadPushback&) = default;
- virtual ~BadPushback() YAML_CPP_NOEXCEPT;
+ ~BadPushback() YAML_CPP_NOEXCEPT override;
};
class YAML_CPP_API BadInsert : public RepresentationException {
@@ -237,7 +279,7 @@ class YAML_CPP_API BadInsert : public RepresentationException {
BadInsert()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
BadInsert(const BadInsert&) = default;
- virtual ~BadInsert() YAML_CPP_NOEXCEPT;
+ ~BadInsert() YAML_CPP_NOEXCEPT override;
};
class YAML_CPP_API EmitterException : public Exception {
@@ -245,17 +287,17 @@ class YAML_CPP_API EmitterException : public Exception {
EmitterException(const std::string& msg_)
: Exception(Mark::null_mark(), msg_) {}
EmitterException(const EmitterException&) = default;
- virtual ~EmitterException() YAML_CPP_NOEXCEPT;
+ ~EmitterException() YAML_CPP_NOEXCEPT override;
};
class YAML_CPP_API BadFile : public Exception {
public:
- BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}
+ explicit BadFile(const std::string& filename)
+ : Exception(Mark::null_mark(),
+ std::string(ErrorMsg::BAD_FILE) + ": " + filename) {}
BadFile(const BadFile&) = default;
- virtual ~BadFile() YAML_CPP_NOEXCEPT;
+ ~BadFile() YAML_CPP_NOEXCEPT override;
};
-}
-
-#undef YAML_CPP_NOEXCEPT
+} // namespace YAML
#endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/convert.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/convert.h
index 45a878ab0c..d0eb450f73 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/convert.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/convert.h
@@ -8,12 +8,20 @@
#endif
#include <array>
+#include <cmath>
#include <limits>
#include <list>
#include <map>
+#include <unordered_map>
#include <sstream>
+#include <type_traits>
+#include <valarray>
#include <vector>
+#if __cplusplus >= 201703L
+#include <string_view>
+#endif
+
#include "yaml-cpp/binary.h"
#include "yaml-cpp/node/impl.h"
#include "yaml-cpp/node/iterator.h"
@@ -21,6 +29,7 @@
#include "yaml-cpp/node/type.h"
#include "yaml-cpp/null.h"
+
namespace YAML {
class Binary;
struct _Null;
@@ -71,14 +80,33 @@ struct convert<std::string> {
// C-strings can only be encoded
template <>
struct convert<const char*> {
- static Node encode(const char*& rhs) { return Node(rhs); }
+ static Node encode(const char* rhs) { return Node(rhs); }
+};
+
+template <>
+struct convert<char*> {
+ static Node encode(const char* rhs) { return Node(rhs); }
};
template <std::size_t N>
-struct convert<const char[N]> {
- static Node encode(const char(&rhs)[N]) { return Node(rhs); }
+struct convert<char[N]> {
+ static Node encode(const char* rhs) { return Node(rhs); }
};
+#if __cplusplus >= 201703L
+template <>
+struct convert<std::string_view> {
+ static Node encode(std::string_view rhs) { return Node(std::string(rhs)); }
+
+ static bool decode(const Node& node, std::string_view& rhs) {
+ if (!node.IsScalar())
+ return false;
+ rhs = node.Scalar();
+ return true;
+ }
+};
+#endif
+
template <>
struct convert<_Null> {
static Node encode(const _Null& /* rhs */) { return Node(); }
@@ -88,42 +116,98 @@ struct convert<_Null> {
}
};
-#define YAML_DEFINE_CONVERT_STREAMABLE(type, negative_op) \
- template <> \
- struct convert<type> { \
- static Node encode(const type& rhs) { \
- std::stringstream stream; \
- stream.precision(std::numeric_limits<type>::digits10 + 1); \
- stream << rhs; \
- return Node(stream.str()); \
- } \
- \
- static bool decode(const Node& node, type& rhs) { \
- if (node.Type() != NodeType::Scalar) \
- return false; \
- const std::string& input = node.Scalar(); \
- std::stringstream stream(input); \
- stream.unsetf(std::ios::dec); \
- if ((stream >> std::noskipws >> rhs) && (stream >> std::ws).eof()) \
- return true; \
- if (std::numeric_limits<type>::has_infinity) { \
- if (conversion::IsInfinity(input)) { \
- rhs = std::numeric_limits<type>::infinity(); \
- return true; \
- } else if (conversion::IsNegativeInfinity(input)) { \
- rhs = negative_op std::numeric_limits<type>::infinity(); \
- return true; \
- } \
- } \
- \
- if (std::numeric_limits<type>::has_quiet_NaN && \
- conversion::IsNaN(input)) { \
- rhs = std::numeric_limits<type>::quiet_NaN(); \
- return true; \
- } \
- \
- return false; \
- } \
+namespace conversion {
+template <typename T>
+typename std::enable_if< std::is_floating_point<T>::value, void>::type
+inner_encode(const T& rhs, std::stringstream& stream){
+ if (std::isnan(rhs)) {
+ stream << ".nan";
+ } else if (std::isinf(rhs)) {
+ if (std::signbit(rhs)) {
+ stream << "-.inf";
+ } else {
+ stream << ".inf";
+ }
+ } else {
+ stream << rhs;
+ }
+}
+
+template <typename T>
+typename std::enable_if<!std::is_floating_point<T>::value, void>::type
+inner_encode(const T& rhs, std::stringstream& stream){
+ stream << rhs;
+}
+
+template <typename T>
+typename std::enable_if<(std::is_same<T, unsigned char>::value ||
+ std::is_same<T, signed char>::value), bool>::type
+ConvertStreamTo(std::stringstream& stream, T& rhs) {
+ int num;
+ if ((stream >> std::noskipws >> num) && (stream >> std::ws).eof()) {
+ if (num >= (std::numeric_limits<T>::min)() &&
+ num <= (std::numeric_limits<T>::max)()) {
+ rhs = static_cast<T>(num);
+ return true;
+ }
+ }
+ return false;
+}
+
+template <typename T>
+typename std::enable_if<!(std::is_same<T, unsigned char>::value ||
+ std::is_same<T, signed char>::value), bool>::type
+ConvertStreamTo(std::stringstream& stream, T& rhs) {
+ if ((stream >> std::noskipws >> rhs) && (stream >> std::ws).eof()) {
+ return true;
+ }
+ return false;
+}
+}
+
+#define YAML_DEFINE_CONVERT_STREAMABLE(type, negative_op) \
+ template <> \
+ struct convert<type> { \
+ \
+ static Node encode(const type& rhs) { \
+ std::stringstream stream; \
+ stream.precision(std::numeric_limits<type>::max_digits10); \
+ conversion::inner_encode(rhs, stream); \
+ return Node(stream.str()); \
+ } \
+ \
+ static bool decode(const Node& node, type& rhs) { \
+ if (node.Type() != NodeType::Scalar) { \
+ return false; \
+ } \
+ const std::string& input = node.Scalar(); \
+ std::stringstream stream(input); \
+ stream.unsetf(std::ios::dec); \
+ if ((stream.peek() == '-') && std::is_unsigned<type>::value) { \
+ return false; \
+ } \
+ if (conversion::ConvertStreamTo(stream, rhs)) { \
+ return true; \
+ } \
+ if (std::numeric_limits<type>::has_infinity) { \
+ if (conversion::IsInfinity(input)) { \
+ rhs = std::numeric_limits<type>::infinity(); \
+ return true; \
+ } else if (conversion::IsNegativeInfinity(input)) { \
+ rhs = negative_op std::numeric_limits<type>::infinity(); \
+ return true; \
+ } \
+ } \
+ \
+ if (std::numeric_limits<type>::has_quiet_NaN) { \
+ if (conversion::IsNaN(input)) { \
+ rhs = std::numeric_limits<type>::quiet_NaN(); \
+ return true; \
+ } \
+ } \
+ \
+ return false; \
+ } \
}
#define YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(type) \
@@ -162,81 +246,104 @@ struct convert<bool> {
};
// std::map
-template <typename K, typename V>
-struct convert<std::map<K, V>> {
- static Node encode(const std::map<K, V>& rhs) {
+template <typename K, typename V, typename C, typename A>
+struct convert<std::map<K, V, C, A>> {
+ static Node encode(const std::map<K, V, C, A>& rhs) {
Node node(NodeType::Map);
- for (typename std::map<K, V>::const_iterator it = rhs.begin();
- it != rhs.end(); ++it)
- node.force_insert(it->first, it->second);
+ for (const auto& element : rhs)
+ node.force_insert(element.first, element.second);
return node;
}
- static bool decode(const Node& node, std::map<K, V>& rhs) {
+ static bool decode(const Node& node, std::map<K, V, C, A>& rhs) {
if (!node.IsMap())
return false;
rhs.clear();
- for (const_iterator it = node.begin(); it != node.end(); ++it)
+ for (const auto& element : node)
#if defined(__GNUC__) && __GNUC__ < 4
// workaround for GCC 3:
- rhs[it->first.template as<K>()] = it->second.template as<V>();
+ rhs[element.first.template as<K>()] = element.second.template as<V>();
#else
- rhs[it->first.as<K>()] = it->second.as<V>();
+ rhs[element.first.as<K>()] = element.second.as<V>();
+#endif
+ return true;
+ }
+};
+
+// std::unordered_map
+template <typename K, typename V, typename H, typename P, typename A>
+struct convert<std::unordered_map<K, V, H, P, A>> {
+ static Node encode(const std::unordered_map<K, V, H, P, A>& rhs) {
+ Node node(NodeType::Map);
+ for (const auto& element : rhs)
+ node.force_insert(element.first, element.second);
+ return node;
+ }
+
+ static bool decode(const Node& node, std::unordered_map<K, V, H, P, A>& rhs) {
+ if (!node.IsMap())
+ return false;
+
+ rhs.clear();
+ for (const auto& element : node)
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs[element.first.template as<K>()] = element.second.template as<V>();
+#else
+ rhs[element.first.as<K>()] = element.second.as<V>();
#endif
return true;
}
};
// std::vector
-template <typename T>
-struct convert<std::vector<T>> {
- static Node encode(const std::vector<T>& rhs) {
+template <typename T, typename A>
+struct convert<std::vector<T, A>> {
+ static Node encode(const std::vector<T, A>& rhs) {
Node node(NodeType::Sequence);
- for (typename std::vector<T>::const_iterator it = rhs.begin();
- it != rhs.end(); ++it)
- node.push_back(*it);
+ for (const auto& element : rhs)
+ node.push_back(element);
return node;
}
- static bool decode(const Node& node, std::vector<T>& rhs) {
+ static bool decode(const Node& node, std::vector<T, A>& rhs) {
if (!node.IsSequence())
return false;
rhs.clear();
- for (const_iterator it = node.begin(); it != node.end(); ++it)
+ for (const auto& element : node)
#if defined(__GNUC__) && __GNUC__ < 4
// workaround for GCC 3:
- rhs.push_back(it->template as<T>());
+ rhs.push_back(element.template as<T>());
#else
- rhs.push_back(it->as<T>());
+ rhs.push_back(element.as<T>());
#endif
return true;
}
};
// std::list
-template <typename T>
-struct convert<std::list<T>> {
- static Node encode(const std::list<T>& rhs) {
+template <typename T, typename A>
+struct convert<std::list<T,A>> {
+ static Node encode(const std::list<T,A>& rhs) {
Node node(NodeType::Sequence);
- for (typename std::list<T>::const_iterator it = rhs.begin();
- it != rhs.end(); ++it)
- node.push_back(*it);
+ for (const auto& element : rhs)
+ node.push_back(element);
return node;
}
- static bool decode(const Node& node, std::list<T>& rhs) {
+ static bool decode(const Node& node, std::list<T,A>& rhs) {
if (!node.IsSequence())
return false;
rhs.clear();
- for (const_iterator it = node.begin(); it != node.end(); ++it)
+ for (const auto& element : node)
#if defined(__GNUC__) && __GNUC__ < 4
// workaround for GCC 3:
- rhs.push_back(it->template as<T>());
+ rhs.push_back(element.template as<T>());
#else
- rhs.push_back(it->as<T>());
+ rhs.push_back(element.as<T>());
#endif
return true;
}
@@ -275,6 +382,37 @@ struct convert<std::array<T, N>> {
}
};
+
+// std::valarray
+template <typename T>
+struct convert<std::valarray<T>> {
+ static Node encode(const std::valarray<T>& rhs) {
+ Node node(NodeType::Sequence);
+ for (const auto& element : rhs) {
+ node.push_back(element);
+ }
+ return node;
+ }
+
+ static bool decode(const Node& node, std::valarray<T>& rhs) {
+ if (!node.IsSequence()) {
+ return false;
+ }
+
+ rhs.resize(node.size());
+ for (auto i = 0u; i < node.size(); ++i) {
+#if defined(__GNUC__) && __GNUC__ < 4
+ // workaround for GCC 3:
+ rhs[i] = node[i].template as<T>();
+#else
+ rhs[i] = node[i].as<T>();
+#endif
+ }
+ return true;
+ }
+};
+
+
// std::pair
template <typename T, typename U>
struct convert<std::pair<T, U>> {
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h
deleted file mode 100644
index 2c80705c9a..0000000000
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/bool_type.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NODE_DETAIL_BOOL_TYPE_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
-
-namespace YAML {
-namespace detail {
-struct unspecified_bool {
- struct NOT_ALLOWED;
- static void true_value(NOT_ALLOWED*) {}
-};
-typedef void (*unspecified_bool_type)(unspecified_bool::NOT_ALLOWED*);
-}
-}
-
-#define YAML_CPP_OPERATOR_BOOL() \
- operator YAML::detail::unspecified_bool_type() const { \
- return this->operator!() ? 0 \
- : &YAML::detail::unspecified_bool::true_value; \
- }
-
-#endif // NODE_DETAIL_BOOL_TYPE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/impl.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/impl.h
index 09e55f838c..b38038dfd2 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/impl.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/impl.h
@@ -9,6 +9,8 @@
#include "yaml-cpp/node/detail/node.h"
#include "yaml-cpp/node/detail/node_data.h"
+
+#include <algorithm>
#include <type_traits>
namespace YAML {
@@ -17,7 +19,7 @@ template <typename Key, typename Enable = void>
struct get_idx {
static node* get(const std::vector<node*>& /* sequence */,
const Key& /* key */, shared_memory_holder /* pMemory */) {
- return 0;
+ return nullptr;
}
};
@@ -27,13 +29,13 @@ struct get_idx<Key,
!std::is_same<Key, bool>::value>::type> {
static node* get(const std::vector<node*>& sequence, const Key& key,
shared_memory_holder /* pMemory */) {
- return key < sequence.size() ? sequence[key] : 0;
+ return key < sequence.size() ? sequence[key] : nullptr;
}
static node* get(std::vector<node*>& sequence, const Key& key,
shared_memory_holder pMemory) {
- if (key > sequence.size() || (key > 0 && !sequence[key-1]->is_defined()))
- return 0;
+ if (key > sequence.size() || (key > 0 && !sequence[key - 1]->is_defined()))
+ return nullptr;
if (key == sequence.size())
sequence.push_back(&pMemory->create_node());
return sequence[key];
@@ -46,13 +48,51 @@ struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> {
shared_memory_holder pMemory) {
return key >= 0 ? get_idx<std::size_t>::get(
sequence, static_cast<std::size_t>(key), pMemory)
- : 0;
+ : nullptr;
}
static node* get(std::vector<node*>& sequence, const Key& key,
shared_memory_holder pMemory) {
return key >= 0 ? get_idx<std::size_t>::get(
sequence, static_cast<std::size_t>(key), pMemory)
- : 0;
+ : nullptr;
+ }
+};
+
+template <typename Key, typename Enable = void>
+struct remove_idx {
+ static bool remove(std::vector<node*>&, const Key&, std::size_t&) {
+ return false;
+ }
+};
+
+template <typename Key>
+struct remove_idx<
+ Key, typename std::enable_if<std::is_unsigned<Key>::value &&
+ !std::is_same<Key, bool>::value>::type> {
+
+ static bool remove(std::vector<node*>& sequence, const Key& key,
+ std::size_t& seqSize) {
+ if (key >= sequence.size()) {
+ return false;
+ } else {
+ sequence.erase(sequence.begin() + key);
+ if (seqSize > key) {
+ --seqSize;
+ }
+ return true;
+ }
+ }
+};
+
+template <typename Key>
+struct remove_idx<Key,
+ typename std::enable_if<std::is_signed<Key>::value>::type> {
+
+ static bool remove(std::vector<node*>& sequence, const Key& key,
+ std::size_t& seqSize) {
+ return key >= 0 ? remove_idx<std::size_t>::remove(
+ sequence, static_cast<std::size_t>(key), seqSize)
+ : false;
}
};
@@ -66,7 +106,11 @@ inline bool node::equals(const T& rhs, shared_memory_holder pMemory) {
}
inline bool node::equals(const char* rhs, shared_memory_holder pMemory) {
- return equals<std::string>(rhs, pMemory);
+ std::string lhs;
+ if (convert<std::string>::decode(Node(*this, std::move(pMemory)), lhs)) {
+ return lhs == rhs;
+ }
+ return false;
}
// indexing
@@ -78,22 +122,20 @@ inline node* node_data::get(const Key& key,
break;
case NodeType::Undefined:
case NodeType::Null:
- return NULL;
+ return nullptr;
case NodeType::Sequence:
if (node* pNode = get_idx<Key>::get(m_sequence, key, pMemory))
return pNode;
- return NULL;
+ return nullptr;
case NodeType::Scalar:
- throw BadSubscript();
+ throw BadSubscript(m_mark, key);
}
- for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
- if (it->first->equals(key, pMemory)) {
- return it->second;
- }
- }
+ auto it = std::find_if(m_map.begin(), m_map.end(), [&](const kv_pair m) {
+ return m.first->equals(key, pMemory);
+ });
- return NULL;
+ return it != m_map.end() ? it->second : nullptr;
}
template <typename Key>
@@ -112,13 +154,15 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
convert_to_map(pMemory);
break;
case NodeType::Scalar:
- throw BadSubscript();
+ throw BadSubscript(m_mark, key);
}
- for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
- if (it->first->equals(key, pMemory)) {
- return *it->second;
- }
+ auto it = std::find_if(m_map.begin(), m_map.end(), [&](const kv_pair m) {
+ return m.first->equals(key, pMemory);
+ });
+
+ if (it != m_map.end()) {
+ return *it->second;
}
node& k = convert_to_node(key, pMemory);
@@ -129,20 +173,26 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
template <typename Key>
inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) {
- if (m_type != NodeType::Map)
- return false;
-
- for (kv_pairs::iterator it = m_undefinedPairs.begin();
- it != m_undefinedPairs.end();) {
- kv_pairs::iterator jt = std::next(it);
- if (it->first->equals(key, pMemory))
- m_undefinedPairs.erase(it);
- it = jt;
+ if (m_type == NodeType::Sequence) {
+ return remove_idx<Key>::remove(m_sequence, key, m_seqSize);
}
- for (node_map::iterator it = m_map.begin(); it != m_map.end(); ++it) {
- if (it->first->equals(key, pMemory)) {
- m_map.erase(it);
+ if (m_type == NodeType::Map) {
+ kv_pairs::iterator it = m_undefinedPairs.begin();
+ while (it != m_undefinedPairs.end()) {
+ kv_pairs::iterator jt = std::next(it);
+ if (it->first->equals(key, pMemory)) {
+ m_undefinedPairs.erase(it);
+ }
+ it = jt;
+ }
+
+ auto iter = std::find_if(m_map.begin(), m_map.end(), [&](const kv_pair m) {
+ return m.first->equals(key, pMemory);
+ });
+
+ if (iter != m_map.end()) {
+ m_map.erase(iter);
return true;
}
}
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator.h
index 0ea3bc3f0e..997c69a14c 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator.h
@@ -8,12 +8,13 @@
#endif
#include "yaml-cpp/dll.h"
+#include "yaml-cpp/node/detail/node_iterator.h"
#include "yaml-cpp/node/node.h"
#include "yaml-cpp/node/ptr.h"
-#include "yaml-cpp/node/detail/node_iterator.h"
#include <cstddef>
#include <iterator>
+
namespace YAML {
namespace detail {
struct iterator_value;
@@ -25,7 +26,7 @@ class iterator_base {
template <typename>
friend class iterator_base;
struct enabler {};
- typedef node_iterator base_type;
+ using base_type = node_iterator;
struct proxy {
explicit proxy(const V& x) : m_ref(x) {}
@@ -40,7 +41,7 @@ class iterator_base {
using value_type = V;
using difference_type = std::ptrdiff_t;
using pointer = V*;
- using reference = V&;
+ using reference = V;
public:
iterator_base() : m_iterator(), m_pMemory() {}
@@ -89,7 +90,7 @@ class iterator_base {
base_type m_iterator;
shared_memory_holder m_pMemory;
};
-}
-}
+} // namespace detail
+} // namespace YAML
#endif // VALUE_DETAIL_ITERATOR_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h
index 5f1ffe7436..75c9de086c 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/iterator_fwd.h
@@ -20,8 +20,8 @@ template <typename V>
class iterator_base;
}
-typedef detail::iterator_base<detail::iterator_value> iterator;
-typedef detail::iterator_base<const detail::iterator_value> const_iterator;
+using iterator = detail::iterator_base<detail::iterator_value>;
+using const_iterator = detail::iterator_base<const detail::iterator_value>;
}
#endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/memory.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/memory.h
index 8f2bc2657a..e881545bf2 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/memory.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/memory.h
@@ -22,11 +22,12 @@ namespace YAML {
namespace detail {
class YAML_CPP_API memory {
public:
+ memory() : m_nodes{} {}
node& create_node();
void merge(const memory& rhs);
private:
- typedef std::set<shared_node> Nodes;
+ using Nodes = std::set<shared_node>;
Nodes m_nodes;
};
@@ -40,7 +41,7 @@ class YAML_CPP_API memory_holder {
private:
shared_memory m_pMemory;
};
-}
-}
+} // namespace detail
+} // namespace YAML
#endif // VALUE_DETAIL_MEMORY_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node.h
index 8a776f62a9..acf60ffb6d 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node.h
@@ -7,18 +7,24 @@
#pragma once
#endif
-#include "yaml-cpp/emitterstyle.h"
#include "yaml-cpp/dll.h"
-#include "yaml-cpp/node/type.h"
-#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/emitterstyle.h"
#include "yaml-cpp/node/detail/node_ref.h"
+#include "yaml-cpp/node/ptr.h"
+#include "yaml-cpp/node/type.h"
#include <set>
+#include <atomic>
namespace YAML {
namespace detail {
class node {
+ private:
+ struct less {
+ bool operator ()(const node* l, const node* r) const {return l->m_index < r->m_index;}
+ };
+
public:
- node() : m_pRef(new node_ref) {}
+ node() : m_pRef(new node_ref), m_dependencies{}, m_index{} {}
node(const node&) = delete;
node& operator=(const node&) = delete;
@@ -42,9 +48,8 @@ class node {
return;
m_pRef->mark_defined();
- for (nodes::iterator it = m_dependencies.begin();
- it != m_dependencies.end(); ++it)
- (*it)->mark_defined();
+ for (node* dependency : m_dependencies)
+ dependency->mark_defined();
m_dependencies.clear();
}
@@ -109,6 +114,7 @@ class node {
void push_back(node& input, shared_memory_holder pMemory) {
m_pRef->push_back(input, pMemory);
input.add_dependency(*this);
+ m_index = m_amount.fetch_add(1);
}
void insert(node& key, node& value, shared_memory_holder pMemory) {
m_pRef->insert(key, value, pMemory);
@@ -120,7 +126,7 @@ class node {
template <typename Key>
node* get(const Key& key, shared_memory_holder pMemory) const {
// NOTE: this returns a non-const node so that the top-level Node can wrap
- // it, and returns a pointer so that it can be NULL (if there is no such
+ // it, and returns a pointer so that it can be nullptr (if there is no such
// key).
return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
}
@@ -137,7 +143,7 @@ class node {
node* get(node& key, shared_memory_holder pMemory) const {
// NOTE: this returns a non-const node so that the top-level Node can wrap
- // it, and returns a pointer so that it can be NULL (if there is no such
+ // it, and returns a pointer so that it can be nullptr (if there is no such
// key).
return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
}
@@ -160,10 +166,12 @@ class node {
private:
shared_node_ref m_pRef;
- typedef std::set<node*> nodes;
+ using nodes = std::set<node*, less>;
nodes m_dependencies;
+ size_t m_index;
+ static YAML_CPP_API std::atomic<size_t> m_amount;
};
-}
-}
+} // namespace detail
+} // namespace YAML
#endif // NODE_DETAIL_NODE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_data.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_data.h
index 50bcd74352..07cf81aa09 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_data.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_data.h
@@ -60,8 +60,8 @@ class YAML_CPP_API node_data {
node_iterator end();
// sequence
- void push_back(node& node, shared_memory_holder pMemory);
- void insert(node& key, node& value, shared_memory_holder pMemory);
+ void push_back(node& node, const shared_memory_holder& pMemory);
+ void insert(node& key, node& value, const shared_memory_holder& pMemory);
// indexing
template <typename Key>
@@ -71,9 +71,9 @@ class YAML_CPP_API node_data {
template <typename Key>
bool remove(const Key& key, shared_memory_holder pMemory);
- node* get(node& key, shared_memory_holder pMemory) const;
- node& get(node& key, shared_memory_holder pMemory);
- bool remove(node& key, shared_memory_holder pMemory);
+ node* get(node& key, const shared_memory_holder& pMemory) const;
+ node& get(node& key, const shared_memory_holder& pMemory);
+ bool remove(node& key, const shared_memory_holder& pMemory);
// map
template <typename Key, typename Value>
@@ -81,7 +81,7 @@ class YAML_CPP_API node_data {
shared_memory_holder pMemory);
public:
- static std::string empty_scalar;
+ static const std::string& empty_scalar();
private:
void compute_seq_size() const;
@@ -91,8 +91,8 @@ class YAML_CPP_API node_data {
void reset_map();
void insert_map_pair(node& key, node& value);
- void convert_to_map(shared_memory_holder pMemory);
- void convert_sequence_to_map(shared_memory_holder pMemory);
+ void convert_to_map(const shared_memory_holder& pMemory);
+ void convert_sequence_to_map(const shared_memory_holder& pMemory);
template <typename T>
static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
@@ -108,17 +108,17 @@ class YAML_CPP_API node_data {
std::string m_scalar;
// sequence
- typedef std::vector<node*> node_seq;
+ using node_seq = std::vector<node *>;
node_seq m_sequence;
mutable std::size_t m_seqSize;
// map
- typedef std::vector<std::pair<node*, node*>> node_map;
+ using node_map = std::vector<std::pair<node*, node*>>;
node_map m_map;
- typedef std::pair<node*, node*> kv_pair;
- typedef std::list<kv_pair> kv_pairs;
+ using kv_pair = std::pair<node*, node*>;
+ using kv_pairs = std::list<kv_pair>;
mutable kv_pairs m_undefinedPairs;
};
}
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h
index 692afca328..49dcf958db 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/detail/node_iterator.h
@@ -24,11 +24,11 @@ struct iterator_type {
template <typename V>
struct node_iterator_value : public std::pair<V*, V*> {
- typedef std::pair<V*, V*> kv;
+ using kv = std::pair<V*, V*>;
- node_iterator_value() : kv(), pNode(0) {}
+ node_iterator_value() : kv(), pNode(nullptr) {}
explicit node_iterator_value(V& rhs) : kv(), pNode(&rhs) {}
- explicit node_iterator_value(V& key, V& value) : kv(&key, &value), pNode(0) {}
+ explicit node_iterator_value(V& key, V& value) : kv(&key, &value), pNode(nullptr) {}
V& operator*() const { return *pNode; }
V& operator->() const { return *pNode; }
@@ -36,19 +36,19 @@ struct node_iterator_value : public std::pair<V*, V*> {
V* pNode;
};
-typedef std::vector<node*> node_seq;
-typedef std::vector<std::pair<node*, node*>> node_map;
+using node_seq = std::vector<node *>;
+using node_map = std::vector<std::pair<node*, node*>>;
template <typename V>
struct node_iterator_type {
- typedef node_seq::iterator seq;
- typedef node_map::iterator map;
+ using seq = node_seq::iterator;
+ using map = node_map::iterator;
};
template <typename V>
struct node_iterator_type<const V> {
- typedef node_seq::const_iterator seq;
- typedef node_map::const_iterator map;
+ using seq = node_seq::const_iterator;
+ using map = node_map::const_iterator;
};
template <typename V>
@@ -65,13 +65,13 @@ class node_iterator_base {
};
public:
- typedef typename node_iterator_type<V>::seq SeqIter;
- typedef typename node_iterator_type<V>::map MapIter;
using iterator_category = std::forward_iterator_tag;
using value_type = node_iterator_value<V>;
using difference_type = std::ptrdiff_t;
using pointer = node_iterator_value<V>*;
- using reference = node_iterator_value<V>&;
+ using reference = node_iterator_value<V>;
+ using SeqIter = typename node_iterator_type<V>::seq;
+ using MapIter = typename node_iterator_type<V>::map;
node_iterator_base()
: m_type(iterator_type::NoneType), m_seqIt(), m_mapIt(), m_mapEnd() {}
@@ -173,8 +173,8 @@ class node_iterator_base {
MapIter m_mapIt, m_mapEnd;
};
-typedef node_iterator_base<node> node_iterator;
-typedef node_iterator_base<const node> const_node_iterator;
+using node_iterator = node_iterator_base<node>;
+using const_node_iterator = node_iterator_base<const node>;
}
}
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/impl.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/impl.h
index 20c487a687..312281f18c 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/impl.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/impl.h
@@ -7,18 +7,21 @@
#pragma once
#endif
-#include "yaml-cpp/node/node.h"
-#include "yaml-cpp/node/iterator.h"
+#include "yaml-cpp/exceptions.h"
#include "yaml-cpp/node/detail/memory.h"
#include "yaml-cpp/node/detail/node.h"
-#include "yaml-cpp/exceptions.h"
+#include "yaml-cpp/node/iterator.h"
+#include "yaml-cpp/node/node.h"
+#include <sstream>
#include <string>
namespace YAML {
-inline Node::Node() : m_isValid(true), m_pNode(NULL) {}
+inline Node::Node()
+ : m_isValid(true), m_invalidKey{}, m_pMemory(nullptr), m_pNode(nullptr) {}
inline Node::Node(NodeType::value type)
: m_isValid(true),
+ m_invalidKey{},
m_pMemory(new detail::memory_holder),
m_pNode(&m_pMemory->create_node()) {
m_pNode->set_type(type);
@@ -27,6 +30,7 @@ inline Node::Node(NodeType::value type)
template <typename T>
inline Node::Node(const T& rhs)
: m_isValid(true),
+ m_invalidKey{},
m_pMemory(new detail::memory_holder),
m_pNode(&m_pMemory->create_node()) {
Assign(rhs);
@@ -34,24 +38,26 @@ inline Node::Node(const T& rhs)
inline Node::Node(const detail::iterator_value& rhs)
: m_isValid(rhs.m_isValid),
+ m_invalidKey(rhs.m_invalidKey),
m_pMemory(rhs.m_pMemory),
m_pNode(rhs.m_pNode) {}
-inline Node::Node(const Node& rhs)
- : m_isValid(rhs.m_isValid),
- m_pMemory(rhs.m_pMemory),
- m_pNode(rhs.m_pNode) {}
+inline Node::Node(const Node&) = default;
+
+inline Node::Node(Zombie)
+ : m_isValid(false), m_invalidKey{}, m_pMemory{}, m_pNode(nullptr) {}
-inline Node::Node(Zombie) : m_isValid(false), m_pNode(NULL) {}
+inline Node::Node(Zombie, const std::string& key)
+ : m_isValid(false), m_invalidKey(key), m_pMemory{}, m_pNode(nullptr) {}
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
- : m_isValid(true), m_pMemory(pMemory), m_pNode(&node) {}
+ : m_isValid(true), m_invalidKey{}, m_pMemory(pMemory), m_pNode(&node) {}
-inline Node::~Node() {}
+inline Node::~Node() = default;
inline void Node::EnsureNodeExists() const {
if (!m_isValid)
- throw InvalidNode();
+ throw InvalidNode(m_invalidKey);
if (!m_pNode) {
m_pMemory.reset(new detail::memory_holder);
m_pNode = &m_pMemory->create_node();
@@ -68,14 +74,14 @@ inline bool Node::IsDefined() const {
inline Mark Node::Mark() const {
if (!m_isValid) {
- throw InvalidNode();
+ throw InvalidNode(m_invalidKey);
}
return m_pNode ? m_pNode->mark() : Mark::null_mark();
}
inline NodeType::value Node::Type() const {
if (!m_isValid)
- throw InvalidNode();
+ throw InvalidNode(m_invalidKey);
return m_pNode ? m_pNode->type() : NodeType::Null;
}
@@ -104,6 +110,8 @@ struct as_if<std::string, S> {
const Node& node;
std::string operator()(const S& fallback) const {
+ if (node.Type() == NodeType::Null)
+ return "null";
if (node.Type() != NodeType::Scalar)
return fallback;
return node.Scalar();
@@ -132,6 +140,8 @@ struct as_if<std::string, void> {
const Node& node;
std::string operator()() const {
+ if (node.Type() == NodeType::Null)
+ return "null";
if (node.Type() != NodeType::Scalar)
throw TypedBadConversion<std::string>(node.Mark());
return node.Scalar();
@@ -142,7 +152,7 @@ struct as_if<std::string, void> {
template <typename T>
inline T Node::as() const {
if (!m_isValid)
- throw InvalidNode();
+ throw InvalidNode(m_invalidKey);
return as_if<T, void>(*this)();
}
@@ -155,32 +165,28 @@ inline T Node::as(const S& fallback) const {
inline const std::string& Node::Scalar() const {
if (!m_isValid)
- throw InvalidNode();
- return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar;
+ throw InvalidNode(m_invalidKey);
+ return m_pNode ? m_pNode->scalar() : detail::node_data::empty_scalar();
}
inline const std::string& Node::Tag() const {
if (!m_isValid)
- throw InvalidNode();
- return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar;
+ throw InvalidNode(m_invalidKey);
+ return m_pNode ? m_pNode->tag() : detail::node_data::empty_scalar();
}
inline void Node::SetTag(const std::string& tag) {
- if (!m_isValid)
- throw InvalidNode();
EnsureNodeExists();
m_pNode->set_tag(tag);
}
inline EmitterStyle::value Node::Style() const {
if (!m_isValid)
- throw InvalidNode();
+ throw InvalidNode(m_invalidKey);
return m_pNode ? m_pNode->style() : EmitterStyle::Default;
}
inline void Node::SetStyle(EmitterStyle::value style) {
- if (!m_isValid)
- throw InvalidNode();
EnsureNodeExists();
m_pNode->set_style(style);
}
@@ -188,7 +194,7 @@ inline void Node::SetStyle(EmitterStyle::value style) {
// assignment
inline bool Node::is(const Node& rhs) const {
if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
+ throw InvalidNode(m_invalidKey);
if (!m_pNode || !rhs.m_pNode)
return false;
return m_pNode->is(*rhs.m_pNode);
@@ -196,15 +202,20 @@ inline bool Node::is(const Node& rhs) const {
template <typename T>
inline Node& Node::operator=(const T& rhs) {
- if (!m_isValid)
- throw InvalidNode();
Assign(rhs);
return *this;
}
+inline Node& Node::operator=(const Node& rhs) {
+ if (is(rhs))
+ return *this;
+ AssignNode(rhs);
+ return *this;
+}
+
inline void Node::reset(const YAML::Node& rhs) {
if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
+ throw InvalidNode(m_invalidKey);
m_pMemory = rhs.m_pMemory;
m_pNode = rhs.m_pNode;
}
@@ -212,44 +223,27 @@ inline void Node::reset(const YAML::Node& rhs) {
template <typename T>
inline void Node::Assign(const T& rhs) {
if (!m_isValid)
- throw InvalidNode();
+ throw InvalidNode(m_invalidKey);
AssignData(convert<T>::encode(rhs));
}
template <>
inline void Node::Assign(const std::string& rhs) {
- if (!m_isValid)
- throw InvalidNode();
EnsureNodeExists();
m_pNode->set_scalar(rhs);
}
inline void Node::Assign(const char* rhs) {
- if (!m_isValid)
- throw InvalidNode();
EnsureNodeExists();
m_pNode->set_scalar(rhs);
}
inline void Node::Assign(char* rhs) {
- if (!m_isValid)
- throw InvalidNode();
EnsureNodeExists();
m_pNode->set_scalar(rhs);
}
-inline Node& Node::operator=(const Node& rhs) {
- if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
- if (is(rhs))
- return *this;
- AssignNode(rhs);
- return *this;
-}
-
inline void Node::AssignData(const Node& rhs) {
- if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
EnsureNodeExists();
rhs.EnsureNodeExists();
@@ -258,8 +252,8 @@ inline void Node::AssignData(const Node& rhs) {
}
inline void Node::AssignNode(const Node& rhs) {
- if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
+ if (!m_isValid)
+ throw InvalidNode(m_invalidKey);
rhs.EnsureNodeExists();
if (!m_pNode) {
@@ -276,7 +270,7 @@ inline void Node::AssignNode(const Node& rhs) {
// size/iterator
inline std::size_t Node::size() const {
if (!m_isValid)
- throw InvalidNode();
+ throw InvalidNode(m_invalidKey);
return m_pNode ? m_pNode->size() : 0;
}
@@ -309,13 +303,11 @@ inline iterator Node::end() {
template <typename T>
inline void Node::push_back(const T& rhs) {
if (!m_isValid)
- throw InvalidNode();
+ throw InvalidNode(m_invalidKey);
push_back(Node(rhs));
}
inline void Node::push_back(const Node& rhs) {
- if (!m_isValid || !rhs.m_isValid)
- throw InvalidNode();
EnsureNodeExists();
rhs.EnsureNodeExists();
@@ -323,99 +315,49 @@ inline void Node::push_back(const Node& rhs) {
m_pMemory->merge(*rhs.m_pMemory);
}
-// helpers for indexing
-namespace detail {
-template <typename T>
-struct to_value_t {
- explicit to_value_t(const T& t_) : t(t_) {}
- const T& t;
- typedef const T& return_type;
-
- const T& operator()() const { return t; }
-};
-
-template <>
-struct to_value_t<const char*> {
- explicit to_value_t(const char* t_) : t(t_) {}
- const char* t;
- typedef std::string return_type;
-
- const std::string operator()() const { return t; }
-};
-
-template <>
-struct to_value_t<char*> {
- explicit to_value_t(char* t_) : t(t_) {}
- const char* t;
- typedef std::string return_type;
-
- const std::string operator()() const { return t; }
-};
-
-template <std::size_t N>
-struct to_value_t<char[N]> {
- explicit to_value_t(const char* t_) : t(t_) {}
- const char* t;
- typedef std::string return_type;
-
- const std::string operator()() const { return t; }
-};
-
-// converts C-strings to std::strings so they can be copied
-template <typename T>
-inline typename to_value_t<T>::return_type to_value(const T& t) {
- return to_value_t<T>(t)();
-}
+template<typename Key>
+std::string key_to_string(const Key& key) {
+ return streamable_to_string<Key, is_streamable<std::stringstream, Key>::value>().impl(key);
}
// indexing
template <typename Key>
inline const Node Node::operator[](const Key& key) const {
- if (!m_isValid)
- throw InvalidNode();
EnsureNodeExists();
- detail::node* value = static_cast<const detail::node&>(*m_pNode)
- .get(detail::to_value(key), m_pMemory);
+ detail::node* value =
+ static_cast<const detail::node&>(*m_pNode).get(key, m_pMemory);
if (!value) {
- return Node(ZombieNode);
+ return Node(ZombieNode, key_to_string(key));
}
return Node(*value, m_pMemory);
}
template <typename Key>
inline Node Node::operator[](const Key& key) {
- if (!m_isValid)
- throw InvalidNode();
EnsureNodeExists();
- detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory);
+ detail::node& value = m_pNode->get(key, m_pMemory);
return Node(value, m_pMemory);
}
template <typename Key>
inline bool Node::remove(const Key& key) {
- if (!m_isValid)
- throw InvalidNode();
EnsureNodeExists();
- return m_pNode->remove(detail::to_value(key), m_pMemory);
+ return m_pNode->remove(key, m_pMemory);
}
inline const Node Node::operator[](const Node& key) const {
- if (!m_isValid || !key.m_isValid)
- throw InvalidNode();
EnsureNodeExists();
key.EnsureNodeExists();
m_pMemory->merge(*key.m_pMemory);
detail::node* value =
static_cast<const detail::node&>(*m_pNode).get(*key.m_pNode, m_pMemory);
if (!value) {
- return Node(ZombieNode);
+ return Node(ZombieNode, key_to_string(key));
}
return Node(*value, m_pMemory);
}
inline Node Node::operator[](const Node& key) {
- if (!m_isValid || !key.m_isValid)
- throw InvalidNode();
EnsureNodeExists();
key.EnsureNodeExists();
m_pMemory->merge(*key.m_pMemory);
@@ -424,8 +366,6 @@ inline Node Node::operator[](const Node& key) {
}
inline bool Node::remove(const Node& key) {
- if (!m_isValid || !key.m_isValid)
- throw InvalidNode();
EnsureNodeExists();
key.EnsureNodeExists();
return m_pNode->remove(*key.m_pNode, m_pMemory);
@@ -434,15 +374,12 @@ inline bool Node::remove(const Node& key) {
// map
template <typename Key, typename Value>
inline void Node::force_insert(const Key& key, const Value& value) {
- if (!m_isValid)
- throw InvalidNode();
EnsureNodeExists();
- m_pNode->force_insert(detail::to_value(key), detail::to_value(value),
- m_pMemory);
+ m_pNode->force_insert(key, value, m_pMemory);
}
// free functions
inline bool operator==(const Node& lhs, const Node& rhs) { return lhs.is(rhs); }
-}
+} // namespace YAML
#endif // NODE_IMPL_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/iterator.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/iterator.h
index 366a9c807f..1fcf6e400f 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/iterator.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/iterator.h
@@ -15,10 +15,13 @@
#include <utility>
#include <vector>
+// Assert in place so gcc + libc++ combination properly builds
+static_assert(std::is_constructible<YAML::Node, const YAML::Node&>::value, "Node must be copy constructable");
+
namespace YAML {
namespace detail {
struct iterator_value : public Node, std::pair<Node, Node> {
- iterator_value() {}
+ iterator_value() = default;
explicit iterator_value(const Node& rhs)
: Node(rhs),
std::pair<Node, Node>(Node(Node::ZombieNode), Node(Node::ZombieNode)) {}
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/node.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/node.h
index 1ded7d27b7..c9e9a0a4bc 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/node.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/node.h
@@ -8,11 +8,11 @@
#endif
#include <stdexcept>
+#include <string>
#include "yaml-cpp/dll.h"
#include "yaml-cpp/emitterstyle.h"
#include "yaml-cpp/mark.h"
-#include "yaml-cpp/node/detail/bool_type.h"
#include "yaml-cpp/node/detail/iterator_fwd.h"
#include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/type.h"
@@ -38,8 +38,8 @@ class YAML_CPP_API Node {
template <typename T, typename S>
friend struct as_if;
- typedef YAML::iterator iterator;
- typedef YAML::const_iterator const_iterator;
+ using iterator = YAML::iterator;
+ using const_iterator = YAML::const_iterator;
Node();
explicit Node(NodeType::value type);
@@ -58,7 +58,7 @@ class YAML_CPP_API Node {
bool IsMap() const { return Type() == NodeType::Map; }
// bool conversions
- YAML_CPP_OPERATOR_BOOL()
+ explicit operator bool() const { return IsDefined(); }
bool operator!() const { return !IsDefined(); }
// access
@@ -116,6 +116,7 @@ class YAML_CPP_API Node {
private:
enum Zombie { ZombieNode };
explicit Node(Zombie);
+ explicit Node(Zombie, const std::string&);
explicit Node(detail::node& node, detail::shared_memory_holder pMemory);
void EnsureNodeExists() const;
@@ -130,6 +131,8 @@ class YAML_CPP_API Node {
private:
bool m_isValid;
+ // String representation of invalid key, if the node is invalid.
+ std::string m_invalidKey;
mutable detail::shared_memory_holder m_pMemory;
mutable detail::node* m_pNode;
};
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/ptr.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/ptr.h
index ce085dd5cd..f55d95ed9c 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/ptr.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/node/ptr.h
@@ -7,7 +7,6 @@
#pragma once
#endif
-#include "yaml-cpp/dll.h"
#include <memory>
namespace YAML {
@@ -18,11 +17,11 @@ class node_data;
class memory;
class memory_holder;
-typedef std::shared_ptr<node> shared_node;
-typedef std::shared_ptr<node_ref> shared_node_ref;
-typedef std::shared_ptr<node_data> shared_node_data;
-typedef std::shared_ptr<memory_holder> shared_memory_holder;
-typedef std::shared_ptr<memory> shared_memory;
+using shared_node = std::shared_ptr<node>;
+using shared_node_ref = std::shared_ptr<node_ref>;
+using shared_node_data = std::shared_ptr<node_data>;
+using shared_memory_holder = std::shared_ptr<memory_holder>;
+using shared_memory = std::shared_ptr<memory>;
}
}
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noexcept.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noexcept.h
new file mode 100644
index 0000000000..6aac63516f
--- /dev/null
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noexcept.h
@@ -0,0 +1,18 @@
+#ifndef NOEXCEPT_H_768872DA_476C_11EA_88B8_90B11C0C0FF8
+#define NOEXCEPT_H_768872DA_476C_11EA_88B8_90B11C0C0FF8
+
+#if defined(_MSC_VER) || \
+ (defined(__GNUC__) && (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || \
+ (__GNUC__ >= 4)) // GCC supports "pragma once" correctly since 3.4
+#pragma once
+#endif
+
+// This is here for compatibility with older versions of Visual Studio
+// which don't support noexcept.
+#if defined(_MSC_VER) && _MSC_VER < 1900
+ #define YAML_CPP_NOEXCEPT _NOEXCEPT
+#else
+ #define YAML_CPP_NOEXCEPT noexcept
+#endif
+
+#endif
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noncopyable.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noncopyable.h
deleted file mode 100644
index a261040739..0000000000
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/noncopyable.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
-#define NONCOPYABLE_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 "yaml-cpp/dll.h"
-
-namespace YAML {
-// this is basically boost::noncopyable
-class YAML_CPP_API noncopyable {
- protected:
- noncopyable() {}
- ~noncopyable() {}
-
- private:
- noncopyable(const noncopyable&);
- const noncopyable& operator=(const noncopyable&);
-};
-}
-
-#endif // NONCOPYABLE_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/ostream_wrapper.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/ostream_wrapper.h
index 09d45f39b7..cf89741d09 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/ostream_wrapper.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/ostream_wrapper.h
@@ -17,6 +17,10 @@ class YAML_CPP_API ostream_wrapper {
public:
ostream_wrapper();
explicit ostream_wrapper(std::ostream& stream);
+ ostream_wrapper(const ostream_wrapper&) = delete;
+ ostream_wrapper(ostream_wrapper&&) = delete;
+ ostream_wrapper& operator=(const ostream_wrapper&) = delete;
+ ostream_wrapper& operator=(ostream_wrapper&&) = delete;
~ostream_wrapper();
void write(const std::string& str);
@@ -26,7 +30,7 @@ class YAML_CPP_API ostream_wrapper {
const char* str() const {
if (m_pStream) {
- return 0;
+ return nullptr;
} else {
m_buffer[m_pos] = '\0';
return &m_buffer[0];
@@ -52,7 +56,7 @@ class YAML_CPP_API ostream_wrapper {
template <std::size_t N>
inline ostream_wrapper& operator<<(ostream_wrapper& stream,
- const char(&str)[N]) {
+ const char (&str)[N]) {
stream.write(str, N - 1);
return stream;
}
@@ -67,6 +71,6 @@ inline ostream_wrapper& operator<<(ostream_wrapper& stream, char ch) {
stream.write(&ch, 1);
return stream;
}
-}
+} // namespace YAML
#endif // OSTREAM_WRAPPER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/parser.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/parser.h
index ceac22d026..2f403c3504 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/parser.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/parser.h
@@ -11,7 +11,6 @@
#include <memory>
#include "yaml-cpp/dll.h"
-#include "yaml-cpp/noncopyable.h"
namespace YAML {
class EventHandler;
@@ -24,11 +23,16 @@ struct Token;
* A parser turns a stream of bytes into one stream of "events" per YAML
* document in the input stream.
*/
-class YAML_CPP_API Parser : private noncopyable {
+class YAML_CPP_API Parser {
public:
/** Constructs an empty parser (with no input. */
Parser();
+ Parser(const Parser&) = delete;
+ Parser(Parser&&) = delete;
+ Parser& operator=(const Parser&) = delete;
+ Parser& operator=(Parser&&) = delete;
+
/**
* Constructs a parser from the given input stream. The input stream must
* live as long as the parser.
@@ -81,6 +85,6 @@ class YAML_CPP_API Parser : private noncopyable {
std::unique_ptr<Scanner> m_pScanner;
std::unique_ptr<Directives> m_pDirectives;
};
-}
+} // namespace YAML
#endif // PARSER_H_62B23520_7C8E_11DE_8A39_0800200C9A66
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h
index 06780c861f..210a2f64e6 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/stlemitter.h
@@ -16,8 +16,8 @@ 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;
+ for (const auto& v : seq)
+ emitter << v;
emitter << EndSeq;
return emitter;
}
@@ -39,10 +39,9 @@ inline Emitter& operator<<(Emitter& emitter, const std::set<T>& 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;
+ for (const auto& v : m)
+ emitter << Key << v.first << Value << v.second;
emitter << EndMap;
return emitter;
}
diff --git a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h
index f33d0e1f63..ffe9999f19 100644
--- a/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h
+++ b/src/libs/3rdparty/yaml-cpp/include/yaml-cpp/traits.h
@@ -7,6 +7,11 @@
#pragma once
#endif
+#include <type_traits>
+#include <utility>
+#include <string>
+#include <sstream>
+
namespace YAML {
template <typename>
struct is_numeric {
@@ -79,7 +84,7 @@ struct is_numeric<long double> {
template <bool, class T = void>
struct enable_if_c {
- typedef T type;
+ using type = T;
};
template <class T>
@@ -90,7 +95,7 @@ struct enable_if : public enable_if_c<Cond::value, T> {};
template <bool, class T = void>
struct disable_if_c {
- typedef T type;
+ using type = T;
};
template <class T>
@@ -100,4 +105,31 @@ template <class Cond, class T = void>
struct disable_if : public disable_if_c<Cond::value, T> {};
}
+template <typename S, typename T>
+struct is_streamable {
+ template <typename StreamT, typename ValueT>
+ static auto test(int)
+ -> decltype(std::declval<StreamT&>() << std::declval<ValueT>(), std::true_type());
+
+ template <typename, typename>
+ static auto test(...) -> std::false_type;
+
+ static const bool value = decltype(test<S, T>(0))::value;
+};
+
+template<typename Key, bool Streamable>
+struct streamable_to_string {
+ static std::string impl(const Key& key) {
+ std::stringstream ss;
+ ss << key;
+ return ss.str();
+ }
+};
+
+template<typename Key>
+struct streamable_to_string<Key, false> {
+ static std::string impl(const Key&) {
+ return "";
+ }
+};
#endif // TRAITS_H_62B23520_7C8E_11DE_8A39_0800200C9A66