Commit 704c39e9 authored by xuebingbing's avatar xuebingbing

1 增加编译机编译出的yaml-cpp 库

parent 8ad71d2b
No preview for this file type
No preview for this file type
set(PACKAGE_VERSION "0.6.3")
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
# Compute paths # Compute paths
get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(YAML_CPP_INCLUDE_DIR "") set(YAML_CPP_INCLUDE_DIR "${YAML_CPP_CMAKE_DIR}/../include")
# Our library dependencies (contains definitions for IMPORTED targets) # Our library dependencies (contains definitions for IMPORTED targets)
include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake") include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake")
# These are IMPORTED targets created by yaml-cpp-targets.cmake # These are IMPORTED targets created by yaml-cpp-targets.cmake
set(YAML_CPP_LIBRARIES "") set(YAML_CPP_LIBRARIES "yaml-cpp")
#----------------------------------------------------------------
# Generated CMake target import file for configuration "Debug".
#----------------------------------------------------------------
# Commands may need to know the format version.
set(CMAKE_IMPORT_FILE_VERSION 1)
# Import target "yaml-cpp" for configuration "Debug"
set_property(TARGET yaml-cpp APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(yaml-cpp PROPERTIES
IMPORTED_IMPLIB_DEBUG "${_IMPORT_PREFIX}/lib/yaml-cpp.lib"
IMPORTED_LOCATION_DEBUG "${_IMPORT_PREFIX}/bin/yaml-cpp.dll"
)
list(APPEND _IMPORT_CHECK_TARGETS yaml-cpp )
list(APPEND _IMPORT_CHECK_FILES_FOR_yaml-cpp "${_IMPORT_PREFIX}/lib/yaml-cpp.lib" "${_IMPORT_PREFIX}/bin/yaml-cpp.dll" )
# Commands beyond this point should not need to know the version.
set(CMAKE_IMPORT_FILE_VERSION)
...@@ -44,8 +44,6 @@ unset(_expectedTargets) ...@@ -44,8 +44,6 @@ unset(_expectedTargets)
# Compute the installation prefix relative to this file. # Compute the installation prefix relative to this file.
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH) get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH) get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
if(_IMPORT_PREFIX STREQUAL "/") if(_IMPORT_PREFIX STREQUAL "/")
set(_IMPORT_PREFIX "") set(_IMPORT_PREFIX "")
endif() endif()
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <cstddef> #include <cstddef>
namespace YAML { namespace YAML {
using anchor_t = std::size_t; typedef std::size_t anchor_t;
const anchor_t NullAnchor = 0; const anchor_t NullAnchor = 0;
} }
......
...@@ -15,7 +15,7 @@ class Parser; ...@@ -15,7 +15,7 @@ class Parser;
// GraphBuilderInterface // GraphBuilderInterface
// . Abstraction of node creation // . Abstraction of node creation
// . pParentNode is always nullptr or the return value of one of the NewXXX() // . pParentNode is always NULL or the return value of one of the NewXXX()
// functions. // functions.
class GraphBuilderInterface { class GraphBuilderInterface {
public: public:
...@@ -73,9 +73,9 @@ class GraphBuilder : public GraphBuilderInterface { ...@@ -73,9 +73,9 @@ class GraphBuilder : public GraphBuilderInterface {
typedef typename Impl::Map Map; typedef typename Impl::Map Map;
GraphBuilder(Impl &impl) : m_impl(impl) { GraphBuilder(Impl &impl) : m_impl(impl) {
Map *pMap = nullptr; Map *pMap = NULL;
Sequence *pSeq = nullptr; Sequence *pSeq = NULL;
Node *pNode = nullptr; Node *pNode = NULL;
// Type consistency checks // Type consistency checks
pNode = pMap; pNode = pMap;
......
...@@ -24,21 +24,21 @@ class EmitFromEvents : public EventHandler { ...@@ -24,21 +24,21 @@ class EmitFromEvents : public EventHandler {
public: public:
EmitFromEvents(Emitter& emitter); EmitFromEvents(Emitter& emitter);
void OnDocumentStart(const Mark& mark) override; virtual void OnDocumentStart(const Mark& mark);
void OnDocumentEnd() override; virtual void OnDocumentEnd();
void OnNull(const Mark& mark, anchor_t anchor) override; virtual void OnNull(const Mark& mark, anchor_t anchor);
void OnAlias(const Mark& mark, anchor_t anchor) override; virtual void OnAlias(const Mark& mark, anchor_t anchor);
void OnScalar(const Mark& mark, const std::string& tag, virtual void OnScalar(const Mark& mark, const std::string& tag,
anchor_t anchor, const std::string& value) override; anchor_t anchor, const std::string& value);
void OnSequenceStart(const Mark& mark, const std::string& tag, virtual void OnSequenceStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) override; anchor_t anchor, EmitterStyle::value style);
void OnSequenceEnd() override; virtual void OnSequenceEnd();
void OnMapStart(const Mark& mark, const std::string& tag, virtual void OnMapStart(const Mark& mark, const std::string& tag,
anchor_t anchor, EmitterStyle::value style) override; anchor_t anchor, EmitterStyle::value style);
void OnMapEnd() override; virtual void OnMapEnd();
private: private:
void BeginNode(); void BeginNode();
......
...@@ -50,7 +50,6 @@ class YAML_CPP_API Emitter { ...@@ -50,7 +50,6 @@ class YAML_CPP_API Emitter {
bool SetOutputCharset(EMITTER_MANIP value); bool SetOutputCharset(EMITTER_MANIP value);
bool SetStringFormat(EMITTER_MANIP value); bool SetStringFormat(EMITTER_MANIP value);
bool SetBoolFormat(EMITTER_MANIP value); bool SetBoolFormat(EMITTER_MANIP value);
bool SetNullFormat(EMITTER_MANIP value);
bool SetIntBase(EMITTER_MANIP value); bool SetIntBase(EMITTER_MANIP value);
bool SetSeqFormat(EMITTER_MANIP value); bool SetSeqFormat(EMITTER_MANIP value);
bool SetMapFormat(EMITTER_MANIP value); bool SetMapFormat(EMITTER_MANIP value);
...@@ -59,7 +58,6 @@ class YAML_CPP_API Emitter { ...@@ -59,7 +58,6 @@ class YAML_CPP_API Emitter {
bool SetPostCommentIndent(std::size_t n); bool SetPostCommentIndent(std::size_t n);
bool SetFloatPrecision(std::size_t n); bool SetFloatPrecision(std::size_t n);
bool SetDoublePrecision(std::size_t n); bool SetDoublePrecision(std::size_t n);
void RestoreGlobalModifiedSettings();
// local setters // local setters
Emitter& SetLocalValue(EMITTER_MANIP value); Emitter& SetLocalValue(EMITTER_MANIP value);
...@@ -125,7 +123,6 @@ class YAML_CPP_API Emitter { ...@@ -125,7 +123,6 @@ class YAML_CPP_API Emitter {
void SpaceOrIndentTo(bool requireSpace, std::size_t indent); void SpaceOrIndentTo(bool requireSpace, std::size_t indent);
const char* ComputeFullBoolName(bool b) const; const char* ComputeFullBoolName(bool b) const;
const char* ComputeNullName() const;
bool CanEmitNewline() const; bool CanEmitNewline() const;
private: private:
...@@ -167,12 +164,13 @@ inline Emitter& Emitter::WriteStreamable(T value) { ...@@ -167,12 +164,13 @@ inline Emitter& Emitter::WriteStreamable(T value) {
std::isnan(value)) { std::isnan(value)) {
special = true; special = true;
stream << ".nan"; stream << ".nan";
} else if (std::numeric_limits<T>::has_infinity && std::isinf(value)) { } else if (std::numeric_limits<T>::has_infinity) {
special = true; if (value == std::numeric_limits<T>::infinity()) {
if (std::signbit(value)) { special = true;
stream << "-.inf";
} else {
stream << ".inf"; stream << ".inf";
} else if (value == -std::numeric_limits<T>::infinity()) {
special = true;
stream << "-.inf";
} }
} }
} }
......
...@@ -19,7 +19,6 @@ enum EMITTER_MANIP { ...@@ -19,7 +19,6 @@ enum EMITTER_MANIP {
// output character set // output character set
EmitNonAscii, EmitNonAscii,
EscapeNonAscii, EscapeNonAscii,
EscapeAsJson,
// string manipulators // string manipulators
// Auto, // duplicate // Auto, // duplicate
...@@ -27,12 +26,6 @@ enum EMITTER_MANIP { ...@@ -27,12 +26,6 @@ enum EMITTER_MANIP {
DoubleQuoted, DoubleQuoted,
Literal, Literal,
// null manipulators
LowerNull,
UpperNull,
CamelNull,
TildeNull,
// bool manipulators // bool manipulators
YesNoBool, // yes, no YesNoBool, // yes, no
TrueFalseBool, // true, false TrueFalseBool, // true, false
...@@ -81,14 +74,14 @@ struct _Alias { ...@@ -81,14 +74,14 @@ struct _Alias {
std::string content; 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 { struct _Anchor {
_Anchor(const std::string& content_) : content(content_) {} _Anchor(const std::string& content_) : content(content_) {}
std::string 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 _Tag {
struct Type { struct Type {
...@@ -103,11 +96,11 @@ struct _Tag { ...@@ -103,11 +96,11 @@ struct _Tag {
Type::value type; Type::value type;
}; };
inline _Tag VerbatimTag(const std::string& content) { inline _Tag VerbatimTag(const std::string content) {
return _Tag("", content, _Tag::Type::Verbatim); 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); return _Tag("", content, _Tag::Type::PrimaryHandle);
} }
...@@ -115,7 +108,7 @@ inline _Tag LocalTag(const std::string& prefix, const std::string content) { ...@@ -115,7 +108,7 @@ inline _Tag LocalTag(const std::string& prefix, const std::string content) {
return _Tag(prefix, content, _Tag::Type::NamedHandle); 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); return _Tag("", content, _Tag::Type::NamedHandle);
} }
...@@ -124,7 +117,7 @@ struct _Comment { ...@@ -124,7 +117,7 @@ struct _Comment {
std::string content; 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 { struct _Precision {
_Precision(int floatPrecision_, int doublePrecision_) _Precision(int floatPrecision_, int doublePrecision_)
......
...@@ -17,7 +17,7 @@ struct Mark; ...@@ -17,7 +17,7 @@ struct Mark;
class EventHandler { class EventHandler {
public: public:
virtual ~EventHandler() = default; virtual ~EventHandler() {}
virtual void OnDocumentStart(const Mark& mark) = 0; virtual void OnDocumentStart(const Mark& mark) = 0;
virtual void OnDocumentEnd() = 0; virtual void OnDocumentEnd() = 0;
......
...@@ -8,12 +8,19 @@ ...@@ -8,12 +8,19 @@
#endif #endif
#include "yaml-cpp/mark.h" #include "yaml-cpp/mark.h"
#include "yaml-cpp/noexcept.h"
#include "yaml-cpp/traits.h" #include "yaml-cpp/traits.h"
#include <sstream> #include <sstream>
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
// 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
namespace YAML { namespace YAML {
// error messages // error messages
namespace ErrorMsg { namespace ErrorMsg {
...@@ -100,12 +107,6 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) { ...@@ -100,12 +107,6 @@ inline const std::string KEY_NOT_FOUND_WITH_KEY(const std::string& key) {
return stream.str(); 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> template <typename T>
inline const std::string KEY_NOT_FOUND_WITH_KEY( inline const std::string KEY_NOT_FOUND_WITH_KEY(
const T& key, typename enable_if<is_numeric<T>>::type* = 0) { const T& key, typename enable_if<is_numeric<T>>::type* = 0) {
...@@ -126,12 +127,6 @@ inline const std::string BAD_SUBSCRIPT_WITH_KEY(const std::string& key) { ...@@ -126,12 +127,6 @@ inline const std::string BAD_SUBSCRIPT_WITH_KEY(const std::string& key) {
return stream.str(); 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> template <typename T>
inline const std::string BAD_SUBSCRIPT_WITH_KEY( inline const std::string BAD_SUBSCRIPT_WITH_KEY(
const T& key, typename enable_if<is_numeric<T>>::type* = nullptr) { const T& key, typename enable_if<is_numeric<T>>::type* = nullptr) {
...@@ -148,13 +143,13 @@ inline const std::string INVALID_NODE_WITH_KEY(const std::string& key) { ...@@ -148,13 +143,13 @@ inline const std::string INVALID_NODE_WITH_KEY(const std::string& key) {
stream << "invalid node; first invalid key: \"" << key << "\""; stream << "invalid node; first invalid key: \"" << key << "\"";
return stream.str(); return stream.str();
} }
} // namespace ErrorMsg }
class YAML_CPP_API Exception : public std::runtime_error { class YAML_CPP_API Exception : public std::runtime_error {
public: public:
Exception(const Mark& mark_, const std::string& msg_) Exception(const Mark& mark_, const std::string& msg_)
: std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {} : std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {}
~Exception() YAML_CPP_NOEXCEPT override; virtual ~Exception() YAML_CPP_NOEXCEPT;
Exception(const Exception&) = default; Exception(const Exception&) = default;
...@@ -180,7 +175,7 @@ class YAML_CPP_API ParserException : public Exception { ...@@ -180,7 +175,7 @@ class YAML_CPP_API ParserException : public Exception {
ParserException(const Mark& mark_, const std::string& msg_) ParserException(const Mark& mark_, const std::string& msg_)
: Exception(mark_, msg_) {} : Exception(mark_, msg_) {}
ParserException(const ParserException&) = default; ParserException(const ParserException&) = default;
~ParserException() YAML_CPP_NOEXCEPT override; virtual ~ParserException() YAML_CPP_NOEXCEPT;
}; };
class YAML_CPP_API RepresentationException : public Exception { class YAML_CPP_API RepresentationException : public Exception {
...@@ -188,7 +183,7 @@ class YAML_CPP_API RepresentationException : public Exception { ...@@ -188,7 +183,7 @@ class YAML_CPP_API RepresentationException : public Exception {
RepresentationException(const Mark& mark_, const std::string& msg_) RepresentationException(const Mark& mark_, const std::string& msg_)
: Exception(mark_, msg_) {} : Exception(mark_, msg_) {}
RepresentationException(const RepresentationException&) = default; RepresentationException(const RepresentationException&) = default;
~RepresentationException() YAML_CPP_NOEXCEPT override; virtual ~RepresentationException() YAML_CPP_NOEXCEPT;
}; };
// representation exceptions // representation exceptions
...@@ -197,7 +192,7 @@ class YAML_CPP_API InvalidScalar : public RepresentationException { ...@@ -197,7 +192,7 @@ class YAML_CPP_API InvalidScalar : public RepresentationException {
InvalidScalar(const Mark& mark_) InvalidScalar(const Mark& mark_)
: RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {} : RepresentationException(mark_, ErrorMsg::INVALID_SCALAR) {}
InvalidScalar(const InvalidScalar&) = default; InvalidScalar(const InvalidScalar&) = default;
~InvalidScalar() YAML_CPP_NOEXCEPT override; virtual ~InvalidScalar() YAML_CPP_NOEXCEPT;
}; };
class YAML_CPP_API KeyNotFound : public RepresentationException { class YAML_CPP_API KeyNotFound : public RepresentationException {
...@@ -207,7 +202,7 @@ class YAML_CPP_API KeyNotFound : public RepresentationException { ...@@ -207,7 +202,7 @@ class YAML_CPP_API KeyNotFound : public RepresentationException {
: RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) { : RepresentationException(mark_, ErrorMsg::KEY_NOT_FOUND_WITH_KEY(key_)) {
} }
KeyNotFound(const KeyNotFound&) = default; KeyNotFound(const KeyNotFound&) = default;
~KeyNotFound() YAML_CPP_NOEXCEPT override; virtual ~KeyNotFound() YAML_CPP_NOEXCEPT;
}; };
template <typename T> template <typename T>
...@@ -215,7 +210,7 @@ class YAML_CPP_API TypedKeyNotFound : public KeyNotFound { ...@@ -215,7 +210,7 @@ class YAML_CPP_API TypedKeyNotFound : public KeyNotFound {
public: public:
TypedKeyNotFound(const Mark& mark_, const T& key_) TypedKeyNotFound(const Mark& mark_, const T& key_)
: KeyNotFound(mark_, key_), key(key_) {} : KeyNotFound(mark_, key_), key(key_) {}
~TypedKeyNotFound() YAML_CPP_NOEXCEPT override = default; virtual ~TypedKeyNotFound() YAML_CPP_NOEXCEPT {}
T key; T key;
}; };
...@@ -228,11 +223,11 @@ inline TypedKeyNotFound<T> MakeTypedKeyNotFound(const Mark& mark, ...@@ -228,11 +223,11 @@ inline TypedKeyNotFound<T> MakeTypedKeyNotFound(const Mark& mark,
class YAML_CPP_API InvalidNode : public RepresentationException { class YAML_CPP_API InvalidNode : public RepresentationException {
public: public:
InvalidNode(const std::string& key) InvalidNode(std::string key)
: RepresentationException(Mark::null_mark(), : RepresentationException(Mark::null_mark(),
ErrorMsg::INVALID_NODE_WITH_KEY(key)) {} ErrorMsg::INVALID_NODE_WITH_KEY(key)) {}
InvalidNode(const InvalidNode&) = default; InvalidNode(const InvalidNode&) = default;
~InvalidNode() YAML_CPP_NOEXCEPT override; virtual ~InvalidNode() YAML_CPP_NOEXCEPT;
}; };
class YAML_CPP_API BadConversion : public RepresentationException { class YAML_CPP_API BadConversion : public RepresentationException {
...@@ -240,7 +235,7 @@ class YAML_CPP_API BadConversion : public RepresentationException { ...@@ -240,7 +235,7 @@ class YAML_CPP_API BadConversion : public RepresentationException {
explicit BadConversion(const Mark& mark_) explicit BadConversion(const Mark& mark_)
: RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {} : RepresentationException(mark_, ErrorMsg::BAD_CONVERSION) {}
BadConversion(const BadConversion&) = default; BadConversion(const BadConversion&) = default;
~BadConversion() YAML_CPP_NOEXCEPT override; virtual ~BadConversion() YAML_CPP_NOEXCEPT;
}; };
template <typename T> template <typename T>
...@@ -254,16 +249,17 @@ class YAML_CPP_API BadDereference : public RepresentationException { ...@@ -254,16 +249,17 @@ class YAML_CPP_API BadDereference : public RepresentationException {
BadDereference() BadDereference()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {} : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_DEREFERENCE) {}
BadDereference(const BadDereference&) = default; BadDereference(const BadDereference&) = default;
~BadDereference() YAML_CPP_NOEXCEPT override; virtual ~BadDereference() YAML_CPP_NOEXCEPT;
}; };
class YAML_CPP_API BadSubscript : public RepresentationException { class YAML_CPP_API BadSubscript : public RepresentationException {
public: public:
template <typename Key> template <typename Key>
BadSubscript(const Mark& mark_, const Key& key) BadSubscript(const Key& key)
: RepresentationException(mark_, ErrorMsg::BAD_SUBSCRIPT_WITH_KEY(key)) {} : RepresentationException(Mark::null_mark(),
ErrorMsg::BAD_SUBSCRIPT_WITH_KEY(key)) {}
BadSubscript(const BadSubscript&) = default; BadSubscript(const BadSubscript&) = default;
~BadSubscript() YAML_CPP_NOEXCEPT override; virtual ~BadSubscript() YAML_CPP_NOEXCEPT;
}; };
class YAML_CPP_API BadPushback : public RepresentationException { class YAML_CPP_API BadPushback : public RepresentationException {
...@@ -271,7 +267,7 @@ class YAML_CPP_API BadPushback : public RepresentationException { ...@@ -271,7 +267,7 @@ class YAML_CPP_API BadPushback : public RepresentationException {
BadPushback() BadPushback()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {} : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_PUSHBACK) {}
BadPushback(const BadPushback&) = default; BadPushback(const BadPushback&) = default;
~BadPushback() YAML_CPP_NOEXCEPT override; virtual ~BadPushback() YAML_CPP_NOEXCEPT;
}; };
class YAML_CPP_API BadInsert : public RepresentationException { class YAML_CPP_API BadInsert : public RepresentationException {
...@@ -279,7 +275,7 @@ class YAML_CPP_API BadInsert : public RepresentationException { ...@@ -279,7 +275,7 @@ class YAML_CPP_API BadInsert : public RepresentationException {
BadInsert() BadInsert()
: RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {} : RepresentationException(Mark::null_mark(), ErrorMsg::BAD_INSERT) {}
BadInsert(const BadInsert&) = default; BadInsert(const BadInsert&) = default;
~BadInsert() YAML_CPP_NOEXCEPT override; virtual ~BadInsert() YAML_CPP_NOEXCEPT;
}; };
class YAML_CPP_API EmitterException : public Exception { class YAML_CPP_API EmitterException : public Exception {
...@@ -287,17 +283,17 @@ class YAML_CPP_API EmitterException : public Exception { ...@@ -287,17 +283,17 @@ class YAML_CPP_API EmitterException : public Exception {
EmitterException(const std::string& msg_) EmitterException(const std::string& msg_)
: Exception(Mark::null_mark(), msg_) {} : Exception(Mark::null_mark(), msg_) {}
EmitterException(const EmitterException&) = default; EmitterException(const EmitterException&) = default;
~EmitterException() YAML_CPP_NOEXCEPT override; virtual ~EmitterException() YAML_CPP_NOEXCEPT;
}; };
class YAML_CPP_API BadFile : public Exception { class YAML_CPP_API BadFile : public Exception {
public: public:
explicit BadFile(const std::string& filename) BadFile() : Exception(Mark::null_mark(), ErrorMsg::BAD_FILE) {}
: Exception(Mark::null_mark(),
std::string(ErrorMsg::BAD_FILE) + ": " + filename) {}
BadFile(const BadFile&) = default; BadFile(const BadFile&) = default;
~BadFile() YAML_CPP_NOEXCEPT override; virtual ~BadFile() YAML_CPP_NOEXCEPT;
}; };
} // namespace YAML }
#undef YAML_CPP_NOEXCEPT
#endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66 #endif // EXCEPTIONS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
...@@ -8,12 +8,10 @@ ...@@ -8,12 +8,10 @@
#endif #endif
#include <array> #include <array>
#include <cmath>
#include <limits> #include <limits>
#include <list> #include <list>
#include <map> #include <map>
#include <sstream> #include <sstream>
#include <type_traits>
#include <vector> #include <vector>
#include "yaml-cpp/binary.h" #include "yaml-cpp/binary.h"
...@@ -23,7 +21,6 @@ ...@@ -23,7 +21,6 @@
#include "yaml-cpp/node/type.h" #include "yaml-cpp/node/type.h"
#include "yaml-cpp/null.h" #include "yaml-cpp/null.h"
namespace YAML { namespace YAML {
class Binary; class Binary;
struct _Null; struct _Null;
...@@ -74,17 +71,12 @@ struct convert<std::string> { ...@@ -74,17 +71,12 @@ struct convert<std::string> {
// C-strings can only be encoded // C-strings can only be encoded
template <> template <>
struct convert<const char*> { 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> template <std::size_t N>
struct convert<char[N]> { struct convert<const char[N]> {
static Node encode(const char* rhs) { return Node(rhs); } static Node encode(const char(&rhs)[N]) { return Node(rhs); }
}; };
template <> template <>
...@@ -96,98 +88,43 @@ struct convert<_Null> { ...@@ -96,98 +88,43 @@ struct convert<_Null> {
} }
}; };
namespace conversion { #define YAML_DEFINE_CONVERT_STREAMABLE(type, negative_op) \
template <typename T> template <> \
typename std::enable_if< std::is_floating_point<T>::value, void>::type struct convert<type> { \
inner_encode(const T& rhs, std::stringstream& stream){ static Node encode(const type& rhs) { \
if (std::isnan(rhs)) { std::stringstream stream; \
stream << ".nan"; stream.precision(std::numeric_limits<type>::max_digits10); \
} else if (std::isinf(rhs)) { stream << rhs; \
if (std::signbit(rhs)) { return Node(stream.str()); \
stream << "-.inf"; } \
} else { \
stream << ".inf"; static bool decode(const Node& node, type& rhs) { \
} if (node.Type() != NodeType::Scalar) \
} else { return false; \
stream << rhs; const std::string& input = node.Scalar(); \
} std::stringstream stream(input); \
} stream.unsetf(std::ios::dec); \
if ((stream >> std::noskipws >> rhs) && (stream >> std::ws).eof()) \
template <typename T> return true; \
typename std::enable_if<!std::is_floating_point<T>::value, void>::type if (std::numeric_limits<type>::has_infinity) { \
inner_encode(const T& rhs, std::stringstream& stream){ if (conversion::IsInfinity(input)) { \
stream << rhs; rhs = std::numeric_limits<type>::infinity(); \
} return true; \
} else if (conversion::IsNegativeInfinity(input)) { \
template <typename T> rhs = negative_op std::numeric_limits<type>::infinity(); \
typename std::enable_if<(std::is_same<T, unsigned char>::value || return true; \
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 (std::numeric_limits<type>::has_quiet_NaN) { \
if (num >= (std::numeric_limits<T>::min)() && if (conversion::IsNaN(input)) { \
num <= (std::numeric_limits<T>::max)()) { rhs = std::numeric_limits<type>::quiet_NaN(); \
rhs = num; return true; \
return true; } \
} } \
} \
return false; 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) \ #define YAML_DEFINE_CONVERT_STREAMABLE_SIGNED(type) \
...@@ -226,78 +163,81 @@ struct convert<bool> { ...@@ -226,78 +163,81 @@ struct convert<bool> {
}; };
// std::map // std::map
template <typename K, typename V, typename C, typename A> template <typename K, typename V>
struct convert<std::map<K, V, C, A>> { struct convert<std::map<K, V>> {
static Node encode(const std::map<K, V, C, A>& rhs) { static Node encode(const std::map<K, V>& rhs) {
Node node(NodeType::Map); Node node(NodeType::Map);
for (const auto& element : rhs) for (typename std::map<K, V>::const_iterator it = rhs.begin();
node.force_insert(element.first, element.second); it != rhs.end(); ++it)
node.force_insert(it->first, it->second);
return node; return node;
} }
static bool decode(const Node& node, std::map<K, V, C, A>& rhs) { static bool decode(const Node& node, std::map<K, V>& rhs) {
if (!node.IsMap()) if (!node.IsMap())
return false; return false;
rhs.clear(); rhs.clear();
for (const auto& element : node) for (const_iterator it = node.begin(); it != node.end(); ++it)
#if defined(__GNUC__) && __GNUC__ < 4 #if defined(__GNUC__) && __GNUC__ < 4
// workaround for GCC 3: // workaround for GCC 3:
rhs[element.first.template as<K>()] = element.second.template as<V>(); rhs[it->first.template as<K>()] = it->second.template as<V>();
#else #else
rhs[element.first.as<K>()] = element.second.as<V>(); rhs[it->first.as<K>()] = it->second.as<V>();
#endif #endif
return true; return true;
} }
}; };
// std::vector // std::vector
template <typename T, typename A> template <typename T>
struct convert<std::vector<T, A>> { struct convert<std::vector<T>> {
static Node encode(const std::vector<T, A>& rhs) { static Node encode(const std::vector<T>& rhs) {
Node node(NodeType::Sequence); Node node(NodeType::Sequence);
for (const auto& element : rhs) for (typename std::vector<T>::const_iterator it = rhs.begin();
node.push_back(element); it != rhs.end(); ++it)
node.push_back(*it);
return node; return node;
} }
static bool decode(const Node& node, std::vector<T, A>& rhs) { static bool decode(const Node& node, std::vector<T>& rhs) {
if (!node.IsSequence()) if (!node.IsSequence())
return false; return false;
rhs.clear(); rhs.clear();
for (const auto& element : node) for (const_iterator it = node.begin(); it != node.end(); ++it)
#if defined(__GNUC__) && __GNUC__ < 4 #if defined(__GNUC__) && __GNUC__ < 4
// workaround for GCC 3: // workaround for GCC 3:
rhs.push_back(element.template as<T>()); rhs.push_back(it->template as<T>());
#else #else
rhs.push_back(element.as<T>()); rhs.push_back(it->as<T>());
#endif #endif
return true; return true;
} }
}; };
// std::list // std::list
template <typename T, typename A> template <typename T>
struct convert<std::list<T,A>> { struct convert<std::list<T>> {
static Node encode(const std::list<T,A>& rhs) { static Node encode(const std::list<T>& rhs) {
Node node(NodeType::Sequence); Node node(NodeType::Sequence);
for (const auto& element : rhs) for (typename std::list<T>::const_iterator it = rhs.begin();
node.push_back(element); it != rhs.end(); ++it)
node.push_back(*it);
return node; return node;
} }
static bool decode(const Node& node, std::list<T,A>& rhs) { static bool decode(const Node& node, std::list<T>& rhs) {
if (!node.IsSequence()) if (!node.IsSequence())
return false; return false;
rhs.clear(); rhs.clear();
for (const auto& element : node) for (const_iterator it = node.begin(); it != node.end(); ++it)
#if defined(__GNUC__) && __GNUC__ < 4 #if defined(__GNUC__) && __GNUC__ < 4
// workaround for GCC 3: // workaround for GCC 3:
rhs.push_back(element.template as<T>()); rhs.push_back(it->template as<T>());
#else #else
rhs.push_back(element.as<T>()); rhs.push_back(it->as<T>());
#endif #endif
return true; return true;
} }
......
#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
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "yaml-cpp/node/detail/node.h" #include "yaml-cpp/node/detail/node.h"
#include "yaml-cpp/node/detail/node_data.h" #include "yaml-cpp/node/detail/node_data.h"
#include <algorithm>
#include <type_traits> #include <type_traits>
namespace YAML { namespace YAML {
...@@ -35,7 +33,7 @@ struct get_idx<Key, ...@@ -35,7 +33,7 @@ struct get_idx<Key,
static node* get(std::vector<node*>& sequence, const Key& key, static node* get(std::vector<node*>& sequence, const Key& key,
shared_memory_holder pMemory) { shared_memory_holder pMemory) {
if (key > sequence.size() || (key > 0 && !sequence[key - 1]->is_defined())) if (key > sequence.size() || (key > 0 && !sequence[key - 1]->is_defined()))
return nullptr; return 0;
if (key == sequence.size()) if (key == sequence.size())
sequence.push_back(&pMemory->create_node()); sequence.push_back(&pMemory->create_node());
return sequence[key]; return sequence[key];
...@@ -60,9 +58,7 @@ struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> { ...@@ -60,9 +58,7 @@ struct get_idx<Key, typename std::enable_if<std::is_signed<Key>::value>::type> {
template <typename Key, typename Enable = void> template <typename Key, typename Enable = void>
struct remove_idx { struct remove_idx {
static bool remove(std::vector<node*>&, const Key&, std::size_t&) { static bool remove(std::vector<node*>&, const Key&) { return false; }
return false;
}
}; };
template <typename Key> template <typename Key>
...@@ -70,15 +66,11 @@ struct remove_idx< ...@@ -70,15 +66,11 @@ struct remove_idx<
Key, typename std::enable_if<std::is_unsigned<Key>::value && Key, typename std::enable_if<std::is_unsigned<Key>::value &&
!std::is_same<Key, bool>::value>::type> { !std::is_same<Key, bool>::value>::type> {
static bool remove(std::vector<node*>& sequence, const Key& key, static bool remove(std::vector<node*>& sequence, const Key& key) {
std::size_t& seqSize) {
if (key >= sequence.size()) { if (key >= sequence.size()) {
return false; return false;
} else { } else {
sequence.erase(sequence.begin() + key); sequence.erase(sequence.begin() + key);
if (seqSize > key) {
--seqSize;
}
return true; return true;
} }
} }
...@@ -88,10 +80,9 @@ template <typename Key> ...@@ -88,10 +80,9 @@ template <typename Key>
struct remove_idx<Key, struct remove_idx<Key,
typename std::enable_if<std::is_signed<Key>::value>::type> { typename std::enable_if<std::is_signed<Key>::value>::type> {
static bool remove(std::vector<node*>& sequence, const Key& key, static bool remove(std::vector<node*>& sequence, const Key& key) {
std::size_t& seqSize) {
return key >= 0 ? remove_idx<std::size_t>::remove( return key >= 0 ? remove_idx<std::size_t>::remove(
sequence, static_cast<std::size_t>(key), seqSize) sequence, static_cast<std::size_t>(key))
: false; : false;
} }
}; };
...@@ -106,11 +97,7 @@ inline bool node::equals(const T& rhs, shared_memory_holder pMemory) { ...@@ -106,11 +97,7 @@ inline bool node::equals(const T& rhs, shared_memory_holder pMemory) {
} }
inline bool node::equals(const char* rhs, shared_memory_holder pMemory) { inline bool node::equals(const char* rhs, shared_memory_holder pMemory) {
std::string lhs; return equals<std::string>(rhs, pMemory);
if (convert<std::string>::decode(Node(*this, std::move(pMemory)), lhs)) {
return lhs == rhs;
}
return false;
} }
// indexing // indexing
...@@ -128,14 +115,16 @@ inline node* node_data::get(const Key& key, ...@@ -128,14 +115,16 @@ inline node* node_data::get(const Key& key,
return pNode; return pNode;
return nullptr; return nullptr;
case NodeType::Scalar: case NodeType::Scalar:
throw BadSubscript(m_mark, key); throw BadSubscript(key);
} }
auto it = std::find_if(m_map.begin(), m_map.end(), [&](const kv_pair m) { for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
return m.first->equals(key, pMemory); if (it->first->equals(key, pMemory)) {
}); return it->second;
}
}
return it != m_map.end() ? it->second : nullptr; return nullptr;
} }
template <typename Key> template <typename Key>
...@@ -154,15 +143,13 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) { ...@@ -154,15 +143,13 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
convert_to_map(pMemory); convert_to_map(pMemory);
break; break;
case NodeType::Scalar: case NodeType::Scalar:
throw BadSubscript(m_mark, key); throw BadSubscript(key);
} }
auto it = std::find_if(m_map.begin(), m_map.end(), [&](const kv_pair m) { for (node_map::const_iterator it = m_map.begin(); it != m_map.end(); ++it) {
return m.first->equals(key, pMemory); if (it->first->equals(key, pMemory)) {
}); return *it->second;
}
if (it != m_map.end()) {
return *it->second;
} }
node& k = convert_to_node(key, pMemory); node& k = convert_to_node(key, pMemory);
...@@ -174,10 +161,8 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) { ...@@ -174,10 +161,8 @@ inline node& node_data::get(const Key& key, shared_memory_holder pMemory) {
template <typename Key> template <typename Key>
inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) { inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) {
if (m_type == NodeType::Sequence) { if (m_type == NodeType::Sequence) {
return remove_idx<Key>::remove(m_sequence, key, m_seqSize); return remove_idx<Key>::remove(m_sequence, key);
} } else if (m_type == NodeType::Map) {
if (m_type == NodeType::Map) {
kv_pairs::iterator it = m_undefinedPairs.begin(); kv_pairs::iterator it = m_undefinedPairs.begin();
while (it != m_undefinedPairs.end()) { while (it != m_undefinedPairs.end()) {
kv_pairs::iterator jt = std::next(it); kv_pairs::iterator jt = std::next(it);
...@@ -187,13 +172,11 @@ inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) { ...@@ -187,13 +172,11 @@ inline bool node_data::remove(const Key& key, shared_memory_holder pMemory) {
it = jt; it = jt;
} }
auto iter = std::find_if(m_map.begin(), m_map.end(), [&](const kv_pair m) { for (node_map::iterator iter = m_map.begin(); iter != m_map.end(); ++iter) {
return m.first->equals(key, pMemory); if (iter->first->equals(key, pMemory)) {
}); m_map.erase(iter);
return true;
if (iter != m_map.end()) { }
m_map.erase(iter);
return true;
} }
} }
......
...@@ -26,7 +26,7 @@ class iterator_base { ...@@ -26,7 +26,7 @@ class iterator_base {
template <typename> template <typename>
friend class iterator_base; friend class iterator_base;
struct enabler {}; struct enabler {};
using base_type = node_iterator; typedef node_iterator base_type;
struct proxy { struct proxy {
explicit proxy(const V& x) : m_ref(x) {} explicit proxy(const V& x) : m_ref(x) {}
......
...@@ -20,8 +20,8 @@ template <typename V> ...@@ -20,8 +20,8 @@ template <typename V>
class iterator_base; class iterator_base;
} }
using iterator = detail::iterator_base<detail::iterator_value>; typedef detail::iterator_base<detail::iterator_value> iterator;
using const_iterator = detail::iterator_base<const detail::iterator_value>; typedef detail::iterator_base<const detail::iterator_value> const_iterator;
} }
#endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66 #endif // VALUE_DETAIL_ITERATOR_FWD_H_62B23520_7C8E_11DE_8A39_0800200C9A66
...@@ -27,7 +27,7 @@ class YAML_CPP_API memory { ...@@ -27,7 +27,7 @@ class YAML_CPP_API memory {
void merge(const memory& rhs); void merge(const memory& rhs);
private: private:
using Nodes = std::set<shared_node>; typedef std::set<shared_node> Nodes;
Nodes m_nodes; Nodes m_nodes;
}; };
......
...@@ -13,18 +13,12 @@ ...@@ -13,18 +13,12 @@
#include "yaml-cpp/node/ptr.h" #include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/type.h" #include "yaml-cpp/node/type.h"
#include <set> #include <set>
#include <atomic>
namespace YAML { namespace YAML {
namespace detail { namespace detail {
class node { class node {
private:
struct less {
bool operator ()(const node* l, const node* r) const {return l->m_index < r->m_index;}
};
public: public:
node() : m_pRef(new node_ref), m_dependencies{}, m_index{} {} node() : m_pRef(new node_ref), m_dependencies{} {}
node(const node&) = delete; node(const node&) = delete;
node& operator=(const node&) = delete; node& operator=(const node&) = delete;
...@@ -48,8 +42,9 @@ class node { ...@@ -48,8 +42,9 @@ class node {
return; return;
m_pRef->mark_defined(); m_pRef->mark_defined();
for (node* dependency : m_dependencies) for (nodes::iterator it = m_dependencies.begin();
dependency->mark_defined(); it != m_dependencies.end(); ++it)
(*it)->mark_defined();
m_dependencies.clear(); m_dependencies.clear();
} }
...@@ -114,7 +109,6 @@ class node { ...@@ -114,7 +109,6 @@ class node {
void push_back(node& input, shared_memory_holder pMemory) { void push_back(node& input, shared_memory_holder pMemory) {
m_pRef->push_back(input, pMemory); m_pRef->push_back(input, pMemory);
input.add_dependency(*this); input.add_dependency(*this);
m_index = m_amount.fetch_add(1);
} }
void insert(node& key, node& value, shared_memory_holder pMemory) { void insert(node& key, node& value, shared_memory_holder pMemory) {
m_pRef->insert(key, value, pMemory); m_pRef->insert(key, value, pMemory);
...@@ -126,7 +120,7 @@ class node { ...@@ -126,7 +120,7 @@ class node {
template <typename Key> template <typename Key>
node* get(const Key& key, shared_memory_holder pMemory) const { 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 // 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 nullptr (if there is no such // it, and returns a pointer so that it can be NULL (if there is no such
// key). // key).
return static_cast<const node_ref&>(*m_pRef).get(key, pMemory); return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
} }
...@@ -143,7 +137,7 @@ class node { ...@@ -143,7 +137,7 @@ class node {
node* get(node& key, shared_memory_holder pMemory) const { node* get(node& key, shared_memory_holder pMemory) const {
// NOTE: this returns a non-const node so that the top-level Node can wrap // 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 nullptr (if there is no such // it, and returns a pointer so that it can be NULL (if there is no such
// key). // key).
return static_cast<const node_ref&>(*m_pRef).get(key, pMemory); return static_cast<const node_ref&>(*m_pRef).get(key, pMemory);
} }
...@@ -166,10 +160,8 @@ class node { ...@@ -166,10 +160,8 @@ class node {
private: private:
shared_node_ref m_pRef; shared_node_ref m_pRef;
using nodes = std::set<node*, less>; typedef std::set<node*> nodes;
nodes m_dependencies; nodes m_dependencies;
size_t m_index;
static std::atomic<size_t> m_amount;
}; };
} // namespace detail } // namespace detail
} // namespace YAML } // namespace YAML
......
...@@ -60,8 +60,8 @@ class YAML_CPP_API node_data { ...@@ -60,8 +60,8 @@ class YAML_CPP_API node_data {
node_iterator end(); node_iterator end();
// sequence // sequence
void push_back(node& node, const shared_memory_holder& pMemory); void push_back(node& node, shared_memory_holder pMemory);
void insert(node& key, node& value, const shared_memory_holder& pMemory); void insert(node& key, node& value, shared_memory_holder pMemory);
// indexing // indexing
template <typename Key> template <typename Key>
...@@ -71,9 +71,9 @@ class YAML_CPP_API node_data { ...@@ -71,9 +71,9 @@ class YAML_CPP_API node_data {
template <typename Key> template <typename Key>
bool remove(const Key& key, shared_memory_holder pMemory); bool remove(const Key& key, shared_memory_holder pMemory);
node* get(node& key, const shared_memory_holder& pMemory) const; node* get(node& key, shared_memory_holder pMemory) const;
node& get(node& key, const shared_memory_holder& pMemory); node& get(node& key, shared_memory_holder pMemory);
bool remove(node& key, const shared_memory_holder& pMemory); bool remove(node& key, shared_memory_holder pMemory);
// map // map
template <typename Key, typename Value> template <typename Key, typename Value>
...@@ -91,8 +91,8 @@ class YAML_CPP_API node_data { ...@@ -91,8 +91,8 @@ class YAML_CPP_API node_data {
void reset_map(); void reset_map();
void insert_map_pair(node& key, node& value); void insert_map_pair(node& key, node& value);
void convert_to_map(const shared_memory_holder& pMemory); void convert_to_map(shared_memory_holder pMemory);
void convert_sequence_to_map(const shared_memory_holder& pMemory); void convert_sequence_to_map(shared_memory_holder pMemory);
template <typename T> template <typename T>
static node& convert_to_node(const T& rhs, shared_memory_holder pMemory); static node& convert_to_node(const T& rhs, shared_memory_holder pMemory);
...@@ -108,17 +108,17 @@ class YAML_CPP_API node_data { ...@@ -108,17 +108,17 @@ class YAML_CPP_API node_data {
std::string m_scalar; std::string m_scalar;
// sequence // sequence
using node_seq = std::vector<node *>; typedef std::vector<node*> node_seq;
node_seq m_sequence; node_seq m_sequence;
mutable std::size_t m_seqSize; mutable std::size_t m_seqSize;
// map // map
using node_map = std::vector<std::pair<node*, node*>>; typedef std::vector<std::pair<node*, node*>> node_map;
node_map m_map; node_map m_map;
using kv_pair = std::pair<node*, node*>; typedef std::pair<node*, node*> kv_pair;
using kv_pairs = std::list<kv_pair>; typedef std::list<kv_pair> kv_pairs;
mutable kv_pairs m_undefinedPairs; mutable kv_pairs m_undefinedPairs;
}; };
} }
......
...@@ -24,7 +24,7 @@ struct iterator_type { ...@@ -24,7 +24,7 @@ struct iterator_type {
template <typename V> template <typename V>
struct node_iterator_value : public std::pair<V*, V*> { struct node_iterator_value : public std::pair<V*, V*> {
using kv = std::pair<V*, V*>; typedef std::pair<V*, V*> kv;
node_iterator_value() : kv(), pNode(nullptr) {} node_iterator_value() : kv(), pNode(nullptr) {}
explicit node_iterator_value(V& rhs) : kv(), pNode(&rhs) {} explicit node_iterator_value(V& rhs) : kv(), pNode(&rhs) {}
...@@ -36,23 +36,26 @@ struct node_iterator_value : public std::pair<V*, V*> { ...@@ -36,23 +36,26 @@ struct node_iterator_value : public std::pair<V*, V*> {
V* pNode; V* pNode;
}; };
using node_seq = std::vector<node *>; typedef std::vector<node*> node_seq;
using node_map = std::vector<std::pair<node*, node*>>; typedef std::vector<std::pair<node*, node*>> node_map;
template <typename V> template <typename V>
struct node_iterator_type { struct node_iterator_type {
using seq = node_seq::iterator; typedef node_seq::iterator seq;
using map = node_map::iterator; typedef node_map::iterator map;
}; };
template <typename V> template <typename V>
struct node_iterator_type<const V> { struct node_iterator_type<const V> {
using seq = node_seq::const_iterator; typedef node_seq::const_iterator seq;
using map = node_map::const_iterator; typedef node_map::const_iterator map;
}; };
template <typename V> template <typename V>
class node_iterator_base { class node_iterator_base
: public std::iterator<std::forward_iterator_tag, node_iterator_value<V>,
std::ptrdiff_t, node_iterator_value<V>*,
node_iterator_value<V>> {
private: private:
struct enabler {}; struct enabler {};
...@@ -65,13 +68,9 @@ class node_iterator_base { ...@@ -65,13 +68,9 @@ class node_iterator_base {
}; };
public: public:
using iterator_category = std::forward_iterator_tag; typedef typename node_iterator_type<V>::seq SeqIter;
using value_type = node_iterator_value<V>; typedef typename node_iterator_type<V>::map MapIter;
using difference_type = std::ptrdiff_t; typedef node_iterator_value<V> value_type;
using pointer = 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() node_iterator_base()
: m_type(iterator_type::NoneType), m_seqIt(), m_mapIt(), m_mapEnd() {} : m_type(iterator_type::NoneType), m_seqIt(), m_mapIt(), m_mapEnd() {}
...@@ -173,8 +172,8 @@ class node_iterator_base { ...@@ -173,8 +172,8 @@ class node_iterator_base {
MapIter m_mapIt, m_mapEnd; MapIter m_mapIt, m_mapEnd;
}; };
using node_iterator = node_iterator_base<node>; typedef node_iterator_base<node> node_iterator;
using const_node_iterator = node_iterator_base<const node>; typedef node_iterator_base<const node> const_node_iterator;
} }
} }
......
...@@ -42,7 +42,11 @@ inline Node::Node(const detail::iterator_value& rhs) ...@@ -42,7 +42,11 @@ inline Node::Node(const detail::iterator_value& rhs)
m_pMemory(rhs.m_pMemory), m_pMemory(rhs.m_pMemory),
m_pNode(rhs.m_pNode) {} m_pNode(rhs.m_pNode) {}
inline Node::Node(const Node& rhs) = default; inline Node::Node(const Node& rhs)
: m_isValid(rhs.m_isValid),
m_invalidKey(rhs.m_invalidKey),
m_pMemory(rhs.m_pMemory),
m_pNode(rhs.m_pNode) {}
inline Node::Node(Zombie) inline Node::Node(Zombie)
: m_isValid(false), m_invalidKey{}, m_pMemory{}, m_pNode(nullptr) {} : m_isValid(false), m_invalidKey{}, m_pMemory{}, m_pNode(nullptr) {}
...@@ -53,7 +57,7 @@ inline Node::Node(Zombie, const std::string& key) ...@@ -53,7 +57,7 @@ inline Node::Node(Zombie, const std::string& key)
inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory) inline Node::Node(detail::node& node, detail::shared_memory_holder pMemory)
: m_isValid(true), m_invalidKey{}, m_pMemory(pMemory), m_pNode(&node) {} : m_isValid(true), m_invalidKey{}, m_pMemory(pMemory), m_pNode(&node) {}
inline Node::~Node() = default; inline Node::~Node() {}
inline void Node::EnsureNodeExists() const { inline void Node::EnsureNodeExists() const {
if (!m_isValid) if (!m_isValid)
...@@ -110,8 +114,6 @@ struct as_if<std::string, S> { ...@@ -110,8 +114,6 @@ struct as_if<std::string, S> {
const Node& node; const Node& node;
std::string operator()(const S& fallback) const { std::string operator()(const S& fallback) const {
if (node.Type() == NodeType::Null)
return "null";
if (node.Type() != NodeType::Scalar) if (node.Type() != NodeType::Scalar)
return fallback; return fallback;
return node.Scalar(); return node.Scalar();
...@@ -140,8 +142,6 @@ struct as_if<std::string, void> { ...@@ -140,8 +142,6 @@ struct as_if<std::string, void> {
const Node& node; const Node& node;
std::string operator()() const { std::string operator()() const {
if (node.Type() == NodeType::Null)
return "null";
if (node.Type() != NodeType::Scalar) if (node.Type() != NodeType::Scalar)
throw TypedBadConversion<std::string>(node.Mark()); throw TypedBadConversion<std::string>(node.Mark());
return node.Scalar(); return node.Scalar();
...@@ -176,6 +176,8 @@ inline const std::string& Node::Tag() const { ...@@ -176,6 +176,8 @@ inline const std::string& Node::Tag() const {
} }
inline void Node::SetTag(const std::string& tag) { inline void Node::SetTag(const std::string& tag) {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
m_pNode->set_tag(tag); m_pNode->set_tag(tag);
} }
...@@ -187,6 +189,8 @@ inline EmitterStyle::value Node::Style() const { ...@@ -187,6 +189,8 @@ inline EmitterStyle::value Node::Style() const {
} }
inline void Node::SetStyle(EmitterStyle::value style) { inline void Node::SetStyle(EmitterStyle::value style) {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
m_pNode->set_style(style); m_pNode->set_style(style);
} }
...@@ -202,11 +206,15 @@ inline bool Node::is(const Node& rhs) const { ...@@ -202,11 +206,15 @@ inline bool Node::is(const Node& rhs) const {
template <typename T> template <typename T>
inline Node& Node::operator=(const T& rhs) { inline Node& Node::operator=(const T& rhs) {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
Assign(rhs); Assign(rhs);
return *this; return *this;
} }
inline Node& Node::operator=(const Node& rhs) { inline Node& Node::operator=(const Node& rhs) {
if (!m_isValid || !rhs.m_isValid)
throw InvalidNode(m_invalidKey);
if (is(rhs)) if (is(rhs))
return *this; return *this;
AssignNode(rhs); AssignNode(rhs);
...@@ -229,21 +237,29 @@ inline void Node::Assign(const T& rhs) { ...@@ -229,21 +237,29 @@ inline void Node::Assign(const T& rhs) {
template <> template <>
inline void Node::Assign(const std::string& rhs) { inline void Node::Assign(const std::string& rhs) {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
m_pNode->set_scalar(rhs); m_pNode->set_scalar(rhs);
} }
inline void Node::Assign(const char* rhs) { inline void Node::Assign(const char* rhs) {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
m_pNode->set_scalar(rhs); m_pNode->set_scalar(rhs);
} }
inline void Node::Assign(char* rhs) { inline void Node::Assign(char* rhs) {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
m_pNode->set_scalar(rhs); m_pNode->set_scalar(rhs);
} }
inline void Node::AssignData(const Node& rhs) { inline void Node::AssignData(const Node& rhs) {
if (!m_isValid || !rhs.m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
rhs.EnsureNodeExists(); rhs.EnsureNodeExists();
...@@ -252,7 +268,7 @@ inline void Node::AssignData(const Node& rhs) { ...@@ -252,7 +268,7 @@ inline void Node::AssignData(const Node& rhs) {
} }
inline void Node::AssignNode(const Node& rhs) { inline void Node::AssignNode(const Node& rhs) {
if (!m_isValid) if (!m_isValid || !rhs.m_isValid)
throw InvalidNode(m_invalidKey); throw InvalidNode(m_invalidKey);
rhs.EnsureNodeExists(); rhs.EnsureNodeExists();
...@@ -308,6 +324,8 @@ inline void Node::push_back(const T& rhs) { ...@@ -308,6 +324,8 @@ inline void Node::push_back(const T& rhs) {
} }
inline void Node::push_back(const Node& rhs) { inline void Node::push_back(const Node& rhs) {
if (!m_isValid || !rhs.m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
rhs.EnsureNodeExists(); rhs.EnsureNodeExists();
...@@ -315,6 +333,51 @@ inline void Node::push_back(const Node& rhs) { ...@@ -315,6 +333,51 @@ inline void Node::push_back(const Node& rhs) {
m_pMemory->merge(*rhs.m_pMemory); 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)();
}
} // namespace detail
template<typename Key> template<typename Key>
std::string key_to_string(const Key& key) { std::string key_to_string(const Key& key) {
return streamable_to_string<Key, is_streamable<std::stringstream, Key>::value>().impl(key); return streamable_to_string<Key, is_streamable<std::stringstream, Key>::value>().impl(key);
...@@ -323,9 +386,11 @@ std::string key_to_string(const Key& key) { ...@@ -323,9 +386,11 @@ std::string key_to_string(const Key& key) {
// indexing // indexing
template <typename Key> template <typename Key>
inline const Node Node::operator[](const Key& key) const { inline const Node Node::operator[](const Key& key) const {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
detail::node* value = detail::node* value = static_cast<const detail::node&>(*m_pNode).get(
static_cast<const detail::node&>(*m_pNode).get(key, m_pMemory); detail::to_value(key), m_pMemory);
if (!value) { if (!value) {
return Node(ZombieNode, key_to_string(key)); return Node(ZombieNode, key_to_string(key));
} }
...@@ -334,18 +399,24 @@ inline const Node Node::operator[](const Key& key) const { ...@@ -334,18 +399,24 @@ inline const Node Node::operator[](const Key& key) const {
template <typename Key> template <typename Key>
inline Node Node::operator[](const Key& key) { inline Node Node::operator[](const Key& key) {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
detail::node& value = m_pNode->get(key, m_pMemory); detail::node& value = m_pNode->get(detail::to_value(key), m_pMemory);
return Node(value, m_pMemory); return Node(value, m_pMemory);
} }
template <typename Key> template <typename Key>
inline bool Node::remove(const Key& key) { inline bool Node::remove(const Key& key) {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
return m_pNode->remove(key, m_pMemory); return m_pNode->remove(detail::to_value(key), m_pMemory);
} }
inline const Node Node::operator[](const Node& key) const { inline const Node Node::operator[](const Node& key) const {
if (!m_isValid || !key.m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
key.EnsureNodeExists(); key.EnsureNodeExists();
m_pMemory->merge(*key.m_pMemory); m_pMemory->merge(*key.m_pMemory);
...@@ -358,6 +429,8 @@ inline const Node Node::operator[](const Node& key) const { ...@@ -358,6 +429,8 @@ inline const Node Node::operator[](const Node& key) const {
} }
inline Node Node::operator[](const Node& key) { inline Node Node::operator[](const Node& key) {
if (!m_isValid || !key.m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
key.EnsureNodeExists(); key.EnsureNodeExists();
m_pMemory->merge(*key.m_pMemory); m_pMemory->merge(*key.m_pMemory);
...@@ -366,6 +439,8 @@ inline Node Node::operator[](const Node& key) { ...@@ -366,6 +439,8 @@ inline Node Node::operator[](const Node& key) {
} }
inline bool Node::remove(const Node& key) { inline bool Node::remove(const Node& key) {
if (!m_isValid || !key.m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
key.EnsureNodeExists(); key.EnsureNodeExists();
return m_pNode->remove(*key.m_pNode, m_pMemory); return m_pNode->remove(*key.m_pNode, m_pMemory);
...@@ -374,8 +449,11 @@ inline bool Node::remove(const Node& key) { ...@@ -374,8 +449,11 @@ inline bool Node::remove(const Node& key) {
// map // map
template <typename Key, typename Value> template <typename Key, typename Value>
inline void Node::force_insert(const Key& key, const Value& value) { inline void Node::force_insert(const Key& key, const Value& value) {
if (!m_isValid)
throw InvalidNode(m_invalidKey);
EnsureNodeExists(); EnsureNodeExists();
m_pNode->force_insert(key, value, m_pMemory); m_pNode->force_insert(detail::to_value(key), detail::to_value(value),
m_pMemory);
} }
// free functions // free functions
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
namespace YAML { namespace YAML {
namespace detail { namespace detail {
struct iterator_value : public Node, std::pair<Node, Node> { struct iterator_value : public Node, std::pair<Node, Node> {
iterator_value() = default; iterator_value() {}
explicit iterator_value(const Node& rhs) explicit iterator_value(const Node& rhs)
: Node(rhs), : Node(rhs),
std::pair<Node, Node>(Node(Node::ZombieNode), Node(Node::ZombieNode)) {} std::pair<Node, Node>(Node(Node::ZombieNode), Node(Node::ZombieNode)) {}
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "yaml-cpp/dll.h" #include "yaml-cpp/dll.h"
#include "yaml-cpp/emitterstyle.h" #include "yaml-cpp/emitterstyle.h"
#include "yaml-cpp/mark.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/detail/iterator_fwd.h"
#include "yaml-cpp/node/ptr.h" #include "yaml-cpp/node/ptr.h"
#include "yaml-cpp/node/type.h" #include "yaml-cpp/node/type.h"
...@@ -38,8 +39,8 @@ class YAML_CPP_API Node { ...@@ -38,8 +39,8 @@ class YAML_CPP_API Node {
template <typename T, typename S> template <typename T, typename S>
friend struct as_if; friend struct as_if;
using iterator = YAML::iterator; typedef YAML::iterator iterator;
using const_iterator = YAML::const_iterator; typedef YAML::const_iterator const_iterator;
Node(); Node();
explicit Node(NodeType::value type); explicit Node(NodeType::value type);
...@@ -58,7 +59,7 @@ class YAML_CPP_API Node { ...@@ -58,7 +59,7 @@ class YAML_CPP_API Node {
bool IsMap() const { return Type() == NodeType::Map; } bool IsMap() const { return Type() == NodeType::Map; }
// bool conversions // bool conversions
explicit operator bool() const { return IsDefined(); } YAML_CPP_OPERATOR_BOOL()
bool operator!() const { return !IsDefined(); } bool operator!() const { return !IsDefined(); }
// access // access
......
...@@ -18,11 +18,11 @@ class node_data; ...@@ -18,11 +18,11 @@ class node_data;
class memory; class memory;
class memory_holder; class memory_holder;
using shared_node = std::shared_ptr<node>; typedef std::shared_ptr<node> shared_node;
using shared_node_ref = std::shared_ptr<node_ref>; typedef std::shared_ptr<node_ref> shared_node_ref;
using shared_node_data = std::shared_ptr<node_data>; typedef std::shared_ptr<node_data> shared_node_data;
using shared_memory_holder = std::shared_ptr<memory_holder>; typedef std::shared_ptr<memory_holder> shared_memory_holder;
using shared_memory = std::shared_ptr<memory>; typedef std::shared_ptr<memory> shared_memory;
} }
} }
......
...@@ -16,8 +16,8 @@ namespace YAML { ...@@ -16,8 +16,8 @@ namespace YAML {
template <typename Seq> template <typename Seq>
inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) { inline Emitter& EmitSeq(Emitter& emitter, const Seq& seq) {
emitter << BeginSeq; emitter << BeginSeq;
for (const auto& v : seq) for (typename Seq::const_iterator it = seq.begin(); it != seq.end(); ++it)
emitter << v; emitter << *it;
emitter << EndSeq; emitter << EndSeq;
return emitter; return emitter;
} }
...@@ -39,9 +39,10 @@ inline Emitter& operator<<(Emitter& emitter, const std::set<T>& v) { ...@@ -39,9 +39,10 @@ inline Emitter& operator<<(Emitter& emitter, const std::set<T>& v) {
template <typename K, typename V> template <typename K, typename V>
inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) { inline Emitter& operator<<(Emitter& emitter, const std::map<K, V>& m) {
typedef typename std::map<K, V> map;
emitter << BeginMap; emitter << BeginMap;
for (const auto& v : m) for (typename map::const_iterator it = m.begin(); it != m.end(); ++it)
emitter << Key << v.first << Value << v.second; emitter << Key << it->first << Value << it->second;
emitter << EndMap; emitter << EndMap;
return emitter; return emitter;
} }
......
...@@ -84,7 +84,7 @@ struct is_numeric<long double> { ...@@ -84,7 +84,7 @@ struct is_numeric<long double> {
template <bool, class T = void> template <bool, class T = void>
struct enable_if_c { struct enable_if_c {
using type = T; typedef T type;
}; };
template <class T> template <class T>
...@@ -95,7 +95,7 @@ struct enable_if : public enable_if_c<Cond::value, T> {}; ...@@ -95,7 +95,7 @@ struct enable_if : public enable_if_c<Cond::value, T> {};
template <bool, class T = void> template <bool, class T = void>
struct disable_if_c { struct disable_if_c {
using type = T; typedef T type;
}; };
template <class T> template <class T>
......
No preview for this file type
# This is a basic version file for the Config-mode of find_package().
# It is used by write_basic_package_version_file() as input file for configure_file()
# to create a version-file which can be installed along a config.cmake file.
#
# The created file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.
# The variable CVF_VERSION must be set before calling configure_file().
set(PACKAGE_VERSION "0.6.3")
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
# if the installed project requested no architecture check, don't perform the check
if("FALSE")
return()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "")
return()
endif()
# check that the installed version has the same 32/64bit-ness as the one which is currently searching:
if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8")
math(EXPR installedBits "8 * 8")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment