From 9dcdcf68f6a60741cbdd287e7eda23b4a21a080e Mon Sep 17 00:00:00 2001 From: rtk0c Date: Sat, 19 Feb 2022 13:30:03 -0800 Subject: Fix build errors and update all dependencies to latest version - Fixed doctest executable not compiling - Fixed class accessibility error in Workflow_Main.cpp - Fixed selection of OpenGL loader in imgui OpenGL 2 & 3 backends - All loading is handled in our code now, the imgui_*_backend.cpp files are instructed to do nothing --- 3rdparty/imgui-node-editor/crude_json.h | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to '3rdparty/imgui-node-editor/crude_json.h') diff --git a/3rdparty/imgui-node-editor/crude_json.h b/3rdparty/imgui-node-editor/crude_json.h index a95abb9..f1eff29 100644 --- a/3rdparty/imgui-node-editor/crude_json.h +++ b/3rdparty/imgui-node-editor/crude_json.h @@ -1,4 +1,6 @@ -// Crude implementation of JSON value object and parser. +// Crude implementation of JSON value object and parser. +// +// VERSION 0.1 // // LICENSE // This software is dual-licensed to the public domain and under the following @@ -24,6 +26,10 @@ # define CRUDE_ASSERT(expr) assert(expr) # endif +# ifndef CRUDE_JSON_IO +# define CRUDE_JSON_IO 1 +# endif + namespace crude_json { struct value; @@ -92,6 +98,8 @@ struct value void push_back(const value& value); void push_back(value&& value); + size_t erase(const string& key); + bool is_primitive() const { return is_string() || is_number() || is_boolean() || is_null(); } bool is_structured() const { return is_object() || is_array(); } bool is_null() const { return m_Type == type_t::null; } @@ -105,6 +113,9 @@ struct value template const T& get() const; template T& get(); + template const T* get_ptr() const; + template T* get_ptr(); + string dump(const int indent = -1, const char indent_char = ' ') const; void swap(value& other); @@ -114,6 +125,11 @@ struct value // Returns discarded value for invalid inputs. static value parse(const string& data); +# if CRUDE_JSON_IO + static std::pair load(const string& path); + bool save(const string& path, const int indent = -1, const char indent_char = ' ') const; +# endif + private: struct parser; @@ -217,6 +233,17 @@ template <> inline string& value::get() { CRUDE_ASSERT(m_T template <> inline boolean& value::get() { CRUDE_ASSERT(m_Type == type_t::boolean); return *boolean_ptr(m_Storage); } template <> inline number& value::get() { CRUDE_ASSERT(m_Type == type_t::number); return *number_ptr(m_Storage); } +template <> inline const object* value::get_ptr() const { if (m_Type == type_t::object) return object_ptr(m_Storage); else return nullptr; } +template <> inline const array* value::get_ptr() const { if (m_Type == type_t::array) return array_ptr(m_Storage); else return nullptr; } +template <> inline const string* value::get_ptr() const { if (m_Type == type_t::string) return string_ptr(m_Storage); else return nullptr; } +template <> inline const boolean* value::get_ptr() const { if (m_Type == type_t::boolean) return boolean_ptr(m_Storage); else return nullptr; } +template <> inline const number* value::get_ptr() const { if (m_Type == type_t::number) return number_ptr(m_Storage); else return nullptr; } + +template <> inline object* value::get_ptr() { if (m_Type == type_t::object) return object_ptr(m_Storage); else return nullptr; } +template <> inline array* value::get_ptr() { if (m_Type == type_t::array) return array_ptr(m_Storage); else return nullptr; } +template <> inline string* value::get_ptr() { if (m_Type == type_t::string) return string_ptr(m_Storage); else return nullptr; } +template <> inline boolean* value::get_ptr() { if (m_Type == type_t::boolean) return boolean_ptr(m_Storage); else return nullptr; } +template <> inline number* value::get_ptr() { if (m_Type == type_t::number) return number_ptr(m_Storage); else return nullptr; } } // namespace crude_json -- cgit v1.2.3-70-g09d2