This is page 2 of 21. Use http://codebase.md/wasdubya/x64dbgmcp?lines=true&page={x} to view the full context. # Directory Structure ``` ├── build │ ├── MCPx64dbg.dp32 │ └── MCPx64dbg.dp64 ├── CMakeLists.txt ├── deps │ ├── pluginsdk │ │ ├── _dbgfunctions.h │ │ ├── _plugin_types.h │ │ ├── _plugins.h │ │ ├── _scriptapi_argument.h │ │ ├── _scriptapi_assembler.h │ │ ├── _scriptapi_bookmark.h │ │ ├── _scriptapi_comment.h │ │ ├── _scriptapi_debug.h │ │ ├── _scriptapi_flag.h │ │ ├── _scriptapi_function.h │ │ ├── _scriptapi_gui.h │ │ ├── _scriptapi_label.h │ │ ├── _scriptapi_memory.h │ │ ├── _scriptapi_misc.h │ │ ├── _scriptapi_module.h │ │ ├── _scriptapi_pattern.h │ │ ├── _scriptapi_register.h │ │ ├── _scriptapi_stack.h │ │ ├── _scriptapi_symbol.h │ │ ├── _scriptapi.h │ │ ├── bridgegraph.h │ │ ├── bridgelist.h │ │ ├── bridgemain.h │ │ ├── dbghelp │ │ │ ├── dbghelp_x64.a │ │ │ ├── dbghelp_x64.lib │ │ │ ├── dbghelp_x86.a │ │ │ ├── dbghelp_x86.lib │ │ │ └── dbghelp.h │ │ ├── DeviceNameResolver │ │ │ ├── DeviceNameResolver_x64.a │ │ │ ├── DeviceNameResolver_x64.lib │ │ │ ├── DeviceNameResolver_x86.a │ │ │ ├── DeviceNameResolver_x86.lib │ │ │ └── DeviceNameResolver.h │ │ ├── jansson │ │ │ ├── jansson_config.h │ │ │ ├── jansson_x64.a │ │ │ ├── jansson_x64.lib │ │ │ ├── jansson_x64dbg.h │ │ │ ├── jansson_x86.a │ │ │ ├── jansson_x86.lib │ │ │ └── jansson.h │ │ ├── lz4 │ │ │ ├── lz4_x64.a │ │ │ ├── lz4_x64.lib │ │ │ ├── lz4_x86.a │ │ │ ├── lz4_x86.lib │ │ │ ├── lz4.h │ │ │ ├── lz4file.h │ │ │ └── lz4hc.h │ │ ├── nlohmann │ │ │ ├── adl_serializer.hpp │ │ │ ├── byte_container_with_subtype.hpp │ │ │ ├── detail │ │ │ │ ├── abi_macros.hpp │ │ │ │ ├── conversions │ │ │ │ │ ├── from_json.hpp │ │ │ │ │ ├── to_chars.hpp │ │ │ │ │ └── to_json.hpp │ │ │ │ ├── exceptions.hpp │ │ │ │ ├── hash.hpp │ │ │ │ ├── input │ │ │ │ │ ├── binary_reader.hpp │ │ │ │ │ ├── input_adapters.hpp │ │ │ │ │ ├── json_sax.hpp │ │ │ │ │ ├── lexer.hpp │ │ │ │ │ ├── parser.hpp │ │ │ │ │ └── position_t.hpp │ │ │ │ ├── iterators │ │ │ │ │ ├── internal_iterator.hpp │ │ │ │ │ ├── iter_impl.hpp │ │ │ │ │ ├── iteration_proxy.hpp │ │ │ │ │ ├── iterator_traits.hpp │ │ │ │ │ ├── json_reverse_iterator.hpp │ │ │ │ │ └── primitive_iterator.hpp │ │ │ │ ├── json_custom_base_class.hpp │ │ │ │ ├── json_pointer.hpp │ │ │ │ ├── json_ref.hpp │ │ │ │ ├── macro_scope.hpp │ │ │ │ ├── macro_unscope.hpp │ │ │ │ ├── meta │ │ │ │ │ ├── call_std │ │ │ │ │ │ ├── begin.hpp │ │ │ │ │ │ └── end.hpp │ │ │ │ │ ├── cpp_future.hpp │ │ │ │ │ ├── detected.hpp │ │ │ │ │ ├── identity_tag.hpp │ │ │ │ │ ├── is_sax.hpp │ │ │ │ │ ├── std_fs.hpp │ │ │ │ │ ├── type_traits.hpp │ │ │ │ │ └── void_t.hpp │ │ │ │ ├── output │ │ │ │ │ ├── binary_writer.hpp │ │ │ │ │ ├── output_adapters.hpp │ │ │ │ │ └── serializer.hpp │ │ │ │ ├── string_concat.hpp │ │ │ │ ├── string_escape.hpp │ │ │ │ └── value_t.hpp │ │ │ ├── json_fwd.hpp │ │ │ ├── json.hpp │ │ │ ├── ordered_map.hpp │ │ │ └── thirdparty │ │ │ └── hedley │ │ │ ├── hedley_undef.hpp │ │ │ └── hedley.hpp │ │ ├── TitanEngine │ │ │ ├── TitanEngine_x64.a │ │ │ ├── TitanEngine_x64.lib │ │ │ ├── TitanEngine_x86.a │ │ │ ├── TitanEngine_x86.lib │ │ │ └── TitanEngine.h │ │ ├── x32bridge.lib │ │ ├── x32dbg.lib │ │ ├── x64bridge.lib │ │ ├── x64dbg.lib │ │ └── XEDParse │ │ ├── XEDParse_x64.a │ │ ├── XEDParse_x64.lib │ │ ├── XEDParse_x86.a │ │ ├── XEDParse_x86.lib │ │ └── XEDParse.h │ └── x64dbg_sdk │ └── pluginsdk │ ├── _dbgfunctions.h │ ├── _plugin_types.h │ ├── _plugins.h │ ├── _scriptapi_argument.h │ ├── _scriptapi_assembler.h │ ├── _scriptapi_bookmark.h │ ├── _scriptapi_comment.h │ ├── _scriptapi_debug.h │ ├── _scriptapi_flag.h │ ├── _scriptapi_function.h │ ├── _scriptapi_gui.h │ ├── _scriptapi_label.h │ ├── _scriptapi_memory.h │ ├── _scriptapi_misc.h │ ├── _scriptapi_module.h │ ├── _scriptapi_pattern.h │ ├── _scriptapi_register.h │ ├── _scriptapi_stack.h │ ├── _scriptapi_symbol.h │ ├── _scriptapi.h │ ├── bridgegraph.h │ ├── bridgelist.h │ ├── bridgemain.h │ ├── dbghelp │ │ ├── dbghelp_x64.a │ │ ├── dbghelp_x64.lib │ │ ├── dbghelp_x86.a │ │ ├── dbghelp_x86.lib │ │ └── dbghelp.h │ ├── DeviceNameResolver │ │ ├── DeviceNameResolver_x64.a │ │ ├── DeviceNameResolver_x64.lib │ │ ├── DeviceNameResolver_x86.a │ │ ├── DeviceNameResolver_x86.lib │ │ └── DeviceNameResolver.h │ ├── jansson │ │ ├── jansson_config.h │ │ ├── jansson_x64.a │ │ ├── jansson_x64.lib │ │ ├── jansson_x64dbg.h │ │ ├── jansson_x86.a │ │ ├── jansson_x86.lib │ │ └── jansson.h │ ├── lz4 │ │ ├── lz4_x64.a │ │ ├── lz4_x64.lib │ │ ├── lz4_x86.a │ │ ├── lz4_x86.lib │ │ ├── lz4.h │ │ ├── lz4file.h │ │ └── lz4hc.h │ ├── TitanEngine │ │ ├── TitanEngine_x64.a │ │ ├── TitanEngine_x64.lib │ │ ├── TitanEngine_x86.a │ │ ├── TitanEngine_x86.lib │ │ └── TitanEngine.h │ ├── TitanEngine_x64.a │ ├── TitanEngine_x64.lib │ ├── TitanEngine_x86.a │ ├── TitanEngine_x86.lib │ ├── TitanEngine.h │ ├── x32bridge.lib │ ├── x32dbg.lib │ ├── x64bridge.lib │ ├── x64dbg.lib │ └── XEDParse │ ├── XEDParse_x64.a │ ├── XEDParse_x64.lib │ ├── XEDParse_x86.a │ ├── XEDParse_x86.lib │ └── XEDParse.h ├── include │ └── nlohmann │ ├── adl_serializer.hpp │ ├── byte_container_with_subtype.hpp │ ├── detail │ │ ├── abi_macros.hpp │ │ ├── conversions │ │ │ ├── from_json.hpp │ │ │ ├── to_chars.hpp │ │ │ └── to_json.hpp │ │ ├── exceptions.hpp │ │ ├── hash.hpp │ │ ├── input │ │ │ ├── binary_reader.hpp │ │ │ ├── input_adapters.hpp │ │ │ ├── json_sax.hpp │ │ │ ├── lexer.hpp │ │ │ ├── parser.hpp │ │ │ └── position_t.hpp │ │ ├── iterators │ │ │ ├── internal_iterator.hpp │ │ │ ├── iter_impl.hpp │ │ │ ├── iteration_proxy.hpp │ │ │ ├── iterator_traits.hpp │ │ │ ├── json_reverse_iterator.hpp │ │ │ └── primitive_iterator.hpp │ │ ├── json_custom_base_class.hpp │ │ ├── json_pointer.hpp │ │ ├── json_ref.hpp │ │ ├── macro_scope.hpp │ │ ├── macro_unscope.hpp │ │ ├── meta │ │ │ ├── call_std │ │ │ │ ├── begin.hpp │ │ │ │ └── end.hpp │ │ │ ├── cpp_future.hpp │ │ │ ├── detected.hpp │ │ │ ├── identity_tag.hpp │ │ │ ├── is_sax.hpp │ │ │ ├── std_fs.hpp │ │ │ ├── type_traits.hpp │ │ │ └── void_t.hpp │ │ ├── output │ │ │ ├── binary_writer.hpp │ │ │ ├── output_adapters.hpp │ │ │ └── serializer.hpp │ │ ├── string_concat.hpp │ │ ├── string_escape.hpp │ │ └── value_t.hpp │ ├── json_fwd.hpp │ ├── json.hpp │ ├── ordered_map.hpp │ └── thirdparty │ └── hedley │ ├── hedley_undef.hpp │ └── hedley.hpp ├── README.md ├── Showcase.gif ├── side profile of a voxel spider walking.jpg └── src ├── MCPx64dbg.cpp └── x64dbg.py ``` # Files -------------------------------------------------------------------------------- /deps/pluginsdk/nlohmann/detail/output/output_adapters.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <algorithm> // copy 12 | #include <cstddef> // size_t 13 | #include <iterator> // back_inserter 14 | #include <memory> // shared_ptr, make_shared 15 | #include <string> // basic_string 16 | #include <vector> // vector 17 | 18 | #ifndef JSON_NO_IO 19 | #include <ios> // streamsize 20 | #include <ostream> // basic_ostream 21 | #endif // JSON_NO_IO 22 | 23 | #include <nlohmann/detail/macro_scope.hpp> 24 | 25 | NLOHMANN_JSON_NAMESPACE_BEGIN 26 | namespace detail 27 | { 28 | 29 | /// abstract output adapter interface 30 | template<typename CharType> struct output_adapter_protocol 31 | { 32 | virtual void write_character(CharType c) = 0; 33 | virtual void write_characters(const CharType* s, std::size_t length) = 0; 34 | virtual ~output_adapter_protocol() = default; 35 | 36 | output_adapter_protocol() = default; 37 | output_adapter_protocol(const output_adapter_protocol&) = default; 38 | output_adapter_protocol(output_adapter_protocol&&) noexcept = default; 39 | output_adapter_protocol& operator=(const output_adapter_protocol&) = default; 40 | output_adapter_protocol& operator=(output_adapter_protocol&&) noexcept = default; 41 | }; 42 | 43 | /// a type to simplify interfaces 44 | template<typename CharType> 45 | using output_adapter_t = std::shared_ptr<output_adapter_protocol<CharType>>; 46 | 47 | /// output adapter for byte vectors 48 | template<typename CharType, typename AllocatorType = std::allocator<CharType>> 49 | class output_vector_adapter : public output_adapter_protocol<CharType> 50 | { 51 | public: 52 | explicit output_vector_adapter(std::vector<CharType, AllocatorType>& vec) noexcept 53 | : v(vec) 54 | {} 55 | 56 | void write_character(CharType c) override 57 | { 58 | v.push_back(c); 59 | } 60 | 61 | JSON_HEDLEY_NON_NULL(2) 62 | void write_characters(const CharType* s, std::size_t length) override 63 | { 64 | v.insert(v.end(), s, s + length); 65 | } 66 | 67 | private: 68 | std::vector<CharType, AllocatorType>& v; 69 | }; 70 | 71 | #ifndef JSON_NO_IO 72 | /// output adapter for output streams 73 | template<typename CharType> 74 | class output_stream_adapter : public output_adapter_protocol<CharType> 75 | { 76 | public: 77 | explicit output_stream_adapter(std::basic_ostream<CharType>& s) noexcept 78 | : stream(s) 79 | {} 80 | 81 | void write_character(CharType c) override 82 | { 83 | stream.put(c); 84 | } 85 | 86 | JSON_HEDLEY_NON_NULL(2) 87 | void write_characters(const CharType* s, std::size_t length) override 88 | { 89 | stream.write(s, static_cast<std::streamsize>(length)); 90 | } 91 | 92 | private: 93 | std::basic_ostream<CharType>& stream; 94 | }; 95 | #endif // JSON_NO_IO 96 | 97 | /// output adapter for basic_string 98 | template<typename CharType, typename StringType = std::basic_string<CharType>> 99 | class output_string_adapter : public output_adapter_protocol<CharType> 100 | { 101 | public: 102 | explicit output_string_adapter(StringType& s) noexcept 103 | : str(s) 104 | {} 105 | 106 | void write_character(CharType c) override 107 | { 108 | str.push_back(c); 109 | } 110 | 111 | JSON_HEDLEY_NON_NULL(2) 112 | void write_characters(const CharType* s, std::size_t length) override 113 | { 114 | str.append(s, length); 115 | } 116 | 117 | private: 118 | StringType& str; 119 | }; 120 | 121 | template<typename CharType, typename StringType = std::basic_string<CharType>> 122 | class output_adapter 123 | { 124 | public: 125 | template<typename AllocatorType = std::allocator<CharType>> 126 | output_adapter(std::vector<CharType, AllocatorType>& vec) 127 | : oa(std::make_shared<output_vector_adapter<CharType, AllocatorType>>(vec)) {} 128 | 129 | #ifndef JSON_NO_IO 130 | output_adapter(std::basic_ostream<CharType>& s) 131 | : oa(std::make_shared<output_stream_adapter<CharType>>(s)) {} 132 | #endif // JSON_NO_IO 133 | 134 | output_adapter(StringType& s) 135 | : oa(std::make_shared<output_string_adapter<CharType, StringType>>(s)) {} 136 | 137 | operator output_adapter_t<CharType>() 138 | { 139 | return oa; 140 | } 141 | 142 | private: 143 | output_adapter_t<CharType> oa = nullptr; 144 | }; 145 | 146 | } // namespace detail 147 | NLOHMANN_JSON_NAMESPACE_END 148 | ``` -------------------------------------------------------------------------------- /include/nlohmann/detail/output/output_adapters.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <algorithm> // copy 12 | #include <cstddef> // size_t 13 | #include <iterator> // back_inserter 14 | #include <memory> // shared_ptr, make_shared 15 | #include <string> // basic_string 16 | #include <vector> // vector 17 | 18 | #ifndef JSON_NO_IO 19 | #include <ios> // streamsize 20 | #include <ostream> // basic_ostream 21 | #endif // JSON_NO_IO 22 | 23 | #include <nlohmann/detail/macro_scope.hpp> 24 | 25 | NLOHMANN_JSON_NAMESPACE_BEGIN 26 | namespace detail 27 | { 28 | 29 | /// abstract output adapter interface 30 | template<typename CharType> struct output_adapter_protocol 31 | { 32 | virtual void write_character(CharType c) = 0; 33 | virtual void write_characters(const CharType* s, std::size_t length) = 0; 34 | virtual ~output_adapter_protocol() = default; 35 | 36 | output_adapter_protocol() = default; 37 | output_adapter_protocol(const output_adapter_protocol&) = default; 38 | output_adapter_protocol(output_adapter_protocol&&) noexcept = default; 39 | output_adapter_protocol& operator=(const output_adapter_protocol&) = default; 40 | output_adapter_protocol& operator=(output_adapter_protocol&&) noexcept = default; 41 | }; 42 | 43 | /// a type to simplify interfaces 44 | template<typename CharType> 45 | using output_adapter_t = std::shared_ptr<output_adapter_protocol<CharType>>; 46 | 47 | /// output adapter for byte vectors 48 | template<typename CharType, typename AllocatorType = std::allocator<CharType>> 49 | class output_vector_adapter : public output_adapter_protocol<CharType> 50 | { 51 | public: 52 | explicit output_vector_adapter(std::vector<CharType, AllocatorType>& vec) noexcept 53 | : v(vec) 54 | {} 55 | 56 | void write_character(CharType c) override 57 | { 58 | v.push_back(c); 59 | } 60 | 61 | JSON_HEDLEY_NON_NULL(2) 62 | void write_characters(const CharType* s, std::size_t length) override 63 | { 64 | v.insert(v.end(), s, s + length); 65 | } 66 | 67 | private: 68 | std::vector<CharType, AllocatorType>& v; 69 | }; 70 | 71 | #ifndef JSON_NO_IO 72 | /// output adapter for output streams 73 | template<typename CharType> 74 | class output_stream_adapter : public output_adapter_protocol<CharType> 75 | { 76 | public: 77 | explicit output_stream_adapter(std::basic_ostream<CharType>& s) noexcept 78 | : stream(s) 79 | {} 80 | 81 | void write_character(CharType c) override 82 | { 83 | stream.put(c); 84 | } 85 | 86 | JSON_HEDLEY_NON_NULL(2) 87 | void write_characters(const CharType* s, std::size_t length) override 88 | { 89 | stream.write(s, static_cast<std::streamsize>(length)); 90 | } 91 | 92 | private: 93 | std::basic_ostream<CharType>& stream; 94 | }; 95 | #endif // JSON_NO_IO 96 | 97 | /// output adapter for basic_string 98 | template<typename CharType, typename StringType = std::basic_string<CharType>> 99 | class output_string_adapter : public output_adapter_protocol<CharType> 100 | { 101 | public: 102 | explicit output_string_adapter(StringType& s) noexcept 103 | : str(s) 104 | {} 105 | 106 | void write_character(CharType c) override 107 | { 108 | str.push_back(c); 109 | } 110 | 111 | JSON_HEDLEY_NON_NULL(2) 112 | void write_characters(const CharType* s, std::size_t length) override 113 | { 114 | str.append(s, length); 115 | } 116 | 117 | private: 118 | StringType& str; 119 | }; 120 | 121 | template<typename CharType, typename StringType = std::basic_string<CharType>> 122 | class output_adapter 123 | { 124 | public: 125 | template<typename AllocatorType = std::allocator<CharType>> 126 | output_adapter(std::vector<CharType, AllocatorType>& vec) 127 | : oa(std::make_shared<output_vector_adapter<CharType, AllocatorType>>(vec)) {} 128 | 129 | #ifndef JSON_NO_IO 130 | output_adapter(std::basic_ostream<CharType>& s) 131 | : oa(std::make_shared<output_stream_adapter<CharType>>(s)) {} 132 | #endif // JSON_NO_IO 133 | 134 | output_adapter(StringType& s) 135 | : oa(std::make_shared<output_string_adapter<CharType, StringType>>(s)) {} 136 | 137 | operator output_adapter_t<CharType>() 138 | { 139 | return oa; 140 | } 141 | 142 | private: 143 | output_adapter_t<CharType> oa = nullptr; 144 | }; 145 | 146 | } // namespace detail 147 | NLOHMANN_JSON_NAMESPACE_END 148 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/bridgelist.h: -------------------------------------------------------------------------------- ``` 1 | #ifndef _LIST_H 2 | #define _LIST_H 3 | 4 | typedef struct 5 | { 6 | int count; //Number of element in the list. 7 | size_t size; //Size of list in bytes (used for type checking). 8 | void* data; //Pointer to the list contents. Must be deleted by the caller using BridgeFree (or BridgeList::Free). 9 | } ListInfo; 10 | 11 | #define ListOf(Type) ListInfo* 12 | 13 | #ifdef __cplusplus 14 | 15 | #include <vector> 16 | 17 | /** 18 | \brief A list object. This object is NOT thread safe. 19 | \tparam Type BridgeList contents type. 20 | */ 21 | template<typename Type> 22 | class BridgeList 23 | { 24 | public: 25 | /** 26 | \brief BridgeList constructor. 27 | \param _freeData (Optional) the free function. 28 | */ 29 | explicit BridgeList() 30 | { 31 | memset(&_listInfo, 0, sizeof(_listInfo)); 32 | } 33 | 34 | /** 35 | \brief BridgeList destructor. 36 | */ 37 | ~BridgeList() 38 | { 39 | Cleanup(); 40 | } 41 | 42 | /** 43 | \brief Gets the list data. 44 | \return Returns ListInfo->data. Can be null if the list was never initialized. Will be destroyed once this object goes out of scope! 45 | */ 46 | Type* Data() const 47 | { 48 | return reinterpret_cast<Type*>(_listInfo.data); 49 | } 50 | 51 | /** 52 | \brief Gets the number of elements in the list. This will crash the program if the data is not consistent with the specified template argument. 53 | \return The number of elements in the list. 54 | */ 55 | int Count() const 56 | { 57 | if(_listInfo.size != _listInfo.count * sizeof(Type)) //make sure the user is using the correct type. 58 | __debugbreak(); 59 | return _listInfo.count; 60 | } 61 | 62 | /** 63 | \brief Cleans up the list, freeing the list data when it is not null. 64 | */ 65 | void Cleanup() 66 | { 67 | if(_listInfo.data) 68 | { 69 | BridgeFree(_listInfo.data); 70 | _listInfo.data = nullptr; 71 | } 72 | } 73 | 74 | /** 75 | \brief Reference operator (cleans up the previous list) 76 | \return Pointer to the ListInfo. 77 | */ 78 | ListInfo* operator&() 79 | { 80 | Cleanup(); 81 | return &_listInfo; 82 | } 83 | 84 | /** 85 | \brief Array indexer operator. This will crash if you try to access out-of-bounds. 86 | \param index Zero-based index of the item you want to get. 87 | \return Reference to a value at that index. 88 | */ 89 | Type & operator[](size_t index) const 90 | { 91 | if(index >= size_t(Count())) //make sure the out-of-bounds access is caught as soon as possible. 92 | __debugbreak(); 93 | return Data()[index]; 94 | } 95 | 96 | /** 97 | \brief Copies data to a ListInfo structure.. 98 | \param [out] listInfo If non-null, information describing the list. 99 | \param listData Data to copy in the ListInfo structure. 100 | \return true if it succeeds, false if it fails. 101 | */ 102 | static bool CopyData(ListInfo* listInfo, const std::vector<Type> & listData) 103 | { 104 | if(!listInfo) 105 | return false; 106 | listInfo->count = int(listData.size()); 107 | listInfo->size = listInfo->count * sizeof(Type); 108 | if(listInfo->count) 109 | { 110 | listInfo->data = BridgeAlloc(listInfo->size); 111 | Type* curItem = reinterpret_cast<Type*>(listInfo->data); 112 | for(const auto & item : listData) 113 | { 114 | *curItem = item; 115 | ++curItem; 116 | } 117 | } 118 | else 119 | listInfo->data = nullptr; 120 | return true; 121 | } 122 | 123 | static bool Free(const ListInfo* listInfo) 124 | { 125 | if(!listInfo || listInfo->size != listInfo->count * sizeof(Type) || (listInfo->count && !listInfo->data)) 126 | return false; 127 | BridgeFree(listInfo->data); 128 | return true; 129 | } 130 | 131 | static bool ToVector(const ListInfo* listInfo, std::vector<Type> & listData, bool freedata = true) 132 | { 133 | if(!listInfo || listInfo->size != listInfo->count * sizeof(Type) || (listInfo->count && !listInfo->data)) 134 | return false; 135 | listData.resize(listInfo->count); 136 | for(int i = 0; i < listInfo->count; i++) 137 | listData[i] = ((Type*)listInfo->data)[i]; 138 | if(freedata && listInfo->data) 139 | BridgeFree(listInfo->data); 140 | return true; 141 | } 142 | 143 | private: 144 | ListInfo _listInfo; 145 | }; 146 | 147 | #endif //__cplusplus 148 | 149 | #endif //_LIST_H ``` -------------------------------------------------------------------------------- /deps/x64dbg_sdk/pluginsdk/bridgelist.h: -------------------------------------------------------------------------------- ``` 1 | #ifndef _LIST_H 2 | #define _LIST_H 3 | 4 | typedef struct 5 | { 6 | int count; //Number of element in the list. 7 | size_t size; //Size of list in bytes (used for type checking). 8 | void* data; //Pointer to the list contents. Must be deleted by the caller using BridgeFree (or BridgeList::Free). 9 | } ListInfo; 10 | 11 | #define ListOf(Type) ListInfo* 12 | 13 | #ifdef __cplusplus 14 | 15 | #include <vector> 16 | 17 | /** 18 | \brief A list object. This object is NOT thread safe. 19 | \tparam Type BridgeList contents type. 20 | */ 21 | template<typename Type> 22 | class BridgeList 23 | { 24 | public: 25 | /** 26 | \brief BridgeList constructor. 27 | \param _freeData (Optional) the free function. 28 | */ 29 | explicit BridgeList() 30 | { 31 | memset(&_listInfo, 0, sizeof(_listInfo)); 32 | } 33 | 34 | /** 35 | \brief BridgeList destructor. 36 | */ 37 | ~BridgeList() 38 | { 39 | Cleanup(); 40 | } 41 | 42 | /** 43 | \brief Gets the list data. 44 | \return Returns ListInfo->data. Can be null if the list was never initialized. Will be destroyed once this object goes out of scope! 45 | */ 46 | Type* Data() const 47 | { 48 | return reinterpret_cast<Type*>(_listInfo.data); 49 | } 50 | 51 | /** 52 | \brief Gets the number of elements in the list. This will crash the program if the data is not consistent with the specified template argument. 53 | \return The number of elements in the list. 54 | */ 55 | int Count() const 56 | { 57 | if(_listInfo.size != _listInfo.count * sizeof(Type)) //make sure the user is using the correct type. 58 | __debugbreak(); 59 | return _listInfo.count; 60 | } 61 | 62 | /** 63 | \brief Cleans up the list, freeing the list data when it is not null. 64 | */ 65 | void Cleanup() 66 | { 67 | if(_listInfo.data) 68 | { 69 | BridgeFree(_listInfo.data); 70 | _listInfo.data = nullptr; 71 | } 72 | } 73 | 74 | /** 75 | \brief Reference operator (cleans up the previous list) 76 | \return Pointer to the ListInfo. 77 | */ 78 | ListInfo* operator&() 79 | { 80 | Cleanup(); 81 | return &_listInfo; 82 | } 83 | 84 | /** 85 | \brief Array indexer operator. This will crash if you try to access out-of-bounds. 86 | \param index Zero-based index of the item you want to get. 87 | \return Reference to a value at that index. 88 | */ 89 | Type & operator[](size_t index) const 90 | { 91 | if(index >= size_t(Count())) //make sure the out-of-bounds access is caught as soon as possible. 92 | __debugbreak(); 93 | return Data()[index]; 94 | } 95 | 96 | /** 97 | \brief Copies data to a ListInfo structure.. 98 | \param [out] listInfo If non-null, information describing the list. 99 | \param listData Data to copy in the ListInfo structure. 100 | \return true if it succeeds, false if it fails. 101 | */ 102 | static bool CopyData(ListInfo* listInfo, const std::vector<Type> & listData) 103 | { 104 | if(!listInfo) 105 | return false; 106 | listInfo->count = int(listData.size()); 107 | listInfo->size = listInfo->count * sizeof(Type); 108 | if(listInfo->count) 109 | { 110 | listInfo->data = BridgeAlloc(listInfo->size); 111 | Type* curItem = reinterpret_cast<Type*>(listInfo->data); 112 | for(const auto & item : listData) 113 | { 114 | *curItem = item; 115 | ++curItem; 116 | } 117 | } 118 | else 119 | listInfo->data = nullptr; 120 | return true; 121 | } 122 | 123 | static bool Free(const ListInfo* listInfo) 124 | { 125 | if(!listInfo || listInfo->size != listInfo->count * sizeof(Type) || (listInfo->count && !listInfo->data)) 126 | return false; 127 | BridgeFree(listInfo->data); 128 | return true; 129 | } 130 | 131 | static bool ToVector(const ListInfo* listInfo, std::vector<Type> & listData, bool freedata = true) 132 | { 133 | if(!listInfo || listInfo->size != listInfo->count * sizeof(Type) || (listInfo->count && !listInfo->data)) 134 | return false; 135 | listData.resize(listInfo->count); 136 | for(int i = 0; i < listInfo->count; i++) 137 | listData[i] = ((Type*)listInfo->data)[i]; 138 | if(freedata && listInfo->data) 139 | BridgeFree(listInfo->data); 140 | return true; 141 | } 142 | 143 | private: 144 | ListInfo _listInfo; 145 | }; 146 | 147 | #endif //__cplusplus 148 | 149 | #endif //_LIST_H ``` -------------------------------------------------------------------------------- /deps/pluginsdk/nlohmann/detail/value_t.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <array> // array 12 | #include <cstddef> // size_t 13 | #include <cstdint> // uint8_t 14 | #include <string> // string 15 | 16 | #include <nlohmann/detail/macro_scope.hpp> 17 | #if JSON_HAS_THREE_WAY_COMPARISON 18 | #include <compare> // partial_ordering 19 | #endif 20 | 21 | NLOHMANN_JSON_NAMESPACE_BEGIN 22 | namespace detail 23 | { 24 | 25 | /////////////////////////// 26 | // JSON type enumeration // 27 | /////////////////////////// 28 | 29 | /*! 30 | @brief the JSON type enumeration 31 | 32 | This enumeration collects the different JSON types. It is internally used to 33 | distinguish the stored values, and the functions @ref basic_json::is_null(), 34 | @ref basic_json::is_object(), @ref basic_json::is_array(), 35 | @ref basic_json::is_string(), @ref basic_json::is_boolean(), 36 | @ref basic_json::is_number() (with @ref basic_json::is_number_integer(), 37 | @ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), 38 | @ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and 39 | @ref basic_json::is_structured() rely on it. 40 | 41 | @note There are three enumeration entries (number_integer, number_unsigned, and 42 | number_float), because the library distinguishes these three types for numbers: 43 | @ref basic_json::number_unsigned_t is used for unsigned integers, 44 | @ref basic_json::number_integer_t is used for signed integers, and 45 | @ref basic_json::number_float_t is used for floating-point numbers or to 46 | approximate integers which do not fit in the limits of their respective type. 47 | 48 | @sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON 49 | value with the default value for a given type 50 | 51 | @since version 1.0.0 52 | */ 53 | enum class value_t : std::uint8_t 54 | { 55 | null, ///< null value 56 | object, ///< object (unordered set of name/value pairs) 57 | array, ///< array (ordered collection of values) 58 | string, ///< string value 59 | boolean, ///< boolean value 60 | number_integer, ///< number value (signed integer) 61 | number_unsigned, ///< number value (unsigned integer) 62 | number_float, ///< number value (floating-point) 63 | binary, ///< binary array (ordered collection of bytes) 64 | discarded ///< discarded by the parser callback function 65 | }; 66 | 67 | /*! 68 | @brief comparison operator for JSON types 69 | 70 | Returns an ordering that is similar to Python: 71 | - order: null < boolean < number < object < array < string < binary 72 | - furthermore, each type is not smaller than itself 73 | - discarded values are not comparable 74 | - binary is represented as a b"" string in python and directly comparable to a 75 | string; however, making a binary array directly comparable with a string would 76 | be surprising behavior in a JSON file. 77 | 78 | @since version 1.0.0 79 | */ 80 | #if JSON_HAS_THREE_WAY_COMPARISON 81 | inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* 82 | #else 83 | inline bool operator<(const value_t lhs, const value_t rhs) noexcept 84 | #endif 85 | { 86 | static constexpr std::array<std::uint8_t, 9> order = {{ 87 | 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, 88 | 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, 89 | 6 /* binary */ 90 | } 91 | }; 92 | 93 | const auto l_index = static_cast<std::size_t>(lhs); 94 | const auto r_index = static_cast<std::size_t>(rhs); 95 | #if JSON_HAS_THREE_WAY_COMPARISON 96 | if (l_index < order.size() && r_index < order.size()) 97 | { 98 | return order[l_index] <=> order[r_index]; // *NOPAD* 99 | } 100 | return std::partial_ordering::unordered; 101 | #else 102 | return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; 103 | #endif 104 | } 105 | 106 | // GCC selects the built-in operator< over an operator rewritten from 107 | // a user-defined spaceship operator 108 | // Clang, MSVC, and ICC select the rewritten candidate 109 | // (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) 110 | #if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) 111 | inline bool operator<(const value_t lhs, const value_t rhs) noexcept 112 | { 113 | return std::is_lt(lhs <=> rhs); // *NOPAD* 114 | } 115 | #endif 116 | 117 | } // namespace detail 118 | NLOHMANN_JSON_NAMESPACE_END 119 | ``` -------------------------------------------------------------------------------- /include/nlohmann/detail/value_t.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <array> // array 12 | #include <cstddef> // size_t 13 | #include <cstdint> // uint8_t 14 | #include <string> // string 15 | 16 | #include <nlohmann/detail/macro_scope.hpp> 17 | #if JSON_HAS_THREE_WAY_COMPARISON 18 | #include <compare> // partial_ordering 19 | #endif 20 | 21 | NLOHMANN_JSON_NAMESPACE_BEGIN 22 | namespace detail 23 | { 24 | 25 | /////////////////////////// 26 | // JSON type enumeration // 27 | /////////////////////////// 28 | 29 | /*! 30 | @brief the JSON type enumeration 31 | 32 | This enumeration collects the different JSON types. It is internally used to 33 | distinguish the stored values, and the functions @ref basic_json::is_null(), 34 | @ref basic_json::is_object(), @ref basic_json::is_array(), 35 | @ref basic_json::is_string(), @ref basic_json::is_boolean(), 36 | @ref basic_json::is_number() (with @ref basic_json::is_number_integer(), 37 | @ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), 38 | @ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and 39 | @ref basic_json::is_structured() rely on it. 40 | 41 | @note There are three enumeration entries (number_integer, number_unsigned, and 42 | number_float), because the library distinguishes these three types for numbers: 43 | @ref basic_json::number_unsigned_t is used for unsigned integers, 44 | @ref basic_json::number_integer_t is used for signed integers, and 45 | @ref basic_json::number_float_t is used for floating-point numbers or to 46 | approximate integers which do not fit in the limits of their respective type. 47 | 48 | @sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON 49 | value with the default value for a given type 50 | 51 | @since version 1.0.0 52 | */ 53 | enum class value_t : std::uint8_t 54 | { 55 | null, ///< null value 56 | object, ///< object (unordered set of name/value pairs) 57 | array, ///< array (ordered collection of values) 58 | string, ///< string value 59 | boolean, ///< boolean value 60 | number_integer, ///< number value (signed integer) 61 | number_unsigned, ///< number value (unsigned integer) 62 | number_float, ///< number value (floating-point) 63 | binary, ///< binary array (ordered collection of bytes) 64 | discarded ///< discarded by the parser callback function 65 | }; 66 | 67 | /*! 68 | @brief comparison operator for JSON types 69 | 70 | Returns an ordering that is similar to Python: 71 | - order: null < boolean < number < object < array < string < binary 72 | - furthermore, each type is not smaller than itself 73 | - discarded values are not comparable 74 | - binary is represented as a b"" string in python and directly comparable to a 75 | string; however, making a binary array directly comparable with a string would 76 | be surprising behavior in a JSON file. 77 | 78 | @since version 1.0.0 79 | */ 80 | #if JSON_HAS_THREE_WAY_COMPARISON 81 | inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* 82 | #else 83 | inline bool operator<(const value_t lhs, const value_t rhs) noexcept 84 | #endif 85 | { 86 | static constexpr std::array<std::uint8_t, 9> order = {{ 87 | 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, 88 | 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, 89 | 6 /* binary */ 90 | } 91 | }; 92 | 93 | const auto l_index = static_cast<std::size_t>(lhs); 94 | const auto r_index = static_cast<std::size_t>(rhs); 95 | #if JSON_HAS_THREE_WAY_COMPARISON 96 | if (l_index < order.size() && r_index < order.size()) 97 | { 98 | return order[l_index] <=> order[r_index]; // *NOPAD* 99 | } 100 | return std::partial_ordering::unordered; 101 | #else 102 | return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; 103 | #endif 104 | } 105 | 106 | // GCC selects the built-in operator< over an operator rewritten from 107 | // a user-defined spaceship operator 108 | // Clang, MSVC, and ICC select the rewritten candidate 109 | // (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) 110 | #if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) 111 | inline bool operator<(const value_t lhs, const value_t rhs) noexcept 112 | { 113 | return std::is_lt(lhs <=> rhs); // *NOPAD* 114 | } 115 | #endif 116 | 117 | } // namespace detail 118 | NLOHMANN_JSON_NAMESPACE_END 119 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/nlohmann/detail/meta/cpp_future.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-FileCopyrightText: 2018 The Abseil Authors 8 | // SPDX-License-Identifier: MIT 9 | 10 | #pragma once 11 | 12 | #include <array> // array 13 | #include <cstddef> // size_t 14 | #include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type 15 | #include <utility> // index_sequence, make_index_sequence, index_sequence_for 16 | 17 | #include <nlohmann/detail/macro_scope.hpp> 18 | 19 | NLOHMANN_JSON_NAMESPACE_BEGIN 20 | namespace detail 21 | { 22 | 23 | template<typename T> 24 | using uncvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type; 25 | 26 | #ifdef JSON_HAS_CPP_14 27 | 28 | // the following utilities are natively available in C++14 29 | using std::enable_if_t; 30 | using std::index_sequence; 31 | using std::make_index_sequence; 32 | using std::index_sequence_for; 33 | 34 | #else 35 | 36 | // alias templates to reduce boilerplate 37 | template<bool B, typename T = void> 38 | using enable_if_t = typename std::enable_if<B, T>::type; 39 | 40 | // The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h 41 | // which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. 42 | 43 | //// START OF CODE FROM GOOGLE ABSEIL 44 | 45 | // integer_sequence 46 | // 47 | // Class template representing a compile-time integer sequence. An instantiation 48 | // of `integer_sequence<T, Ints...>` has a sequence of integers encoded in its 49 | // type through its template arguments (which is a common need when 50 | // working with C++11 variadic templates). `absl::integer_sequence` is designed 51 | // to be a drop-in replacement for C++14's `std::integer_sequence`. 52 | // 53 | // Example: 54 | // 55 | // template< class T, T... Ints > 56 | // void user_function(integer_sequence<T, Ints...>); 57 | // 58 | // int main() 59 | // { 60 | // // user_function's `T` will be deduced to `int` and `Ints...` 61 | // // will be deduced to `0, 1, 2, 3, 4`. 62 | // user_function(make_integer_sequence<int, 5>()); 63 | // } 64 | template <typename T, T... Ints> 65 | struct integer_sequence 66 | { 67 | using value_type = T; 68 | static constexpr std::size_t size() noexcept 69 | { 70 | return sizeof...(Ints); 71 | } 72 | }; 73 | 74 | // index_sequence 75 | // 76 | // A helper template for an `integer_sequence` of `size_t`, 77 | // `absl::index_sequence` is designed to be a drop-in replacement for C++14's 78 | // `std::index_sequence`. 79 | template <size_t... Ints> 80 | using index_sequence = integer_sequence<size_t, Ints...>; 81 | 82 | namespace utility_internal 83 | { 84 | 85 | template <typename Seq, size_t SeqSize, size_t Rem> 86 | struct Extend; 87 | 88 | // Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. 89 | template <typename T, T... Ints, size_t SeqSize> 90 | struct Extend<integer_sequence<T, Ints...>, SeqSize, 0> 91 | { 92 | using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; 93 | }; 94 | 95 | template <typename T, T... Ints, size_t SeqSize> 96 | struct Extend<integer_sequence<T, Ints...>, SeqSize, 1> 97 | { 98 | using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; 99 | }; 100 | 101 | // Recursion helper for 'make_integer_sequence<T, N>'. 102 | // 'Gen<T, N>::type' is an alias for 'integer_sequence<T, 0, 1, ... N-1>'. 103 | template <typename T, size_t N> 104 | struct Gen 105 | { 106 | using type = 107 | typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; 108 | }; 109 | 110 | template <typename T> 111 | struct Gen<T, 0> 112 | { 113 | using type = integer_sequence<T>; 114 | }; 115 | 116 | } // namespace utility_internal 117 | 118 | // Compile-time sequences of integers 119 | 120 | // make_integer_sequence 121 | // 122 | // This template alias is equivalent to 123 | // `integer_sequence<int, 0, 1, ..., N-1>`, and is designed to be a drop-in 124 | // replacement for C++14's `std::make_integer_sequence`. 125 | template <typename T, T N> 126 | using make_integer_sequence = typename utility_internal::Gen<T, N>::type; 127 | 128 | // make_index_sequence 129 | // 130 | // This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, 131 | // and is designed to be a drop-in replacement for C++14's 132 | // `std::make_index_sequence`. 133 | template <size_t N> 134 | using make_index_sequence = make_integer_sequence<size_t, N>; 135 | 136 | // index_sequence_for 137 | // 138 | // Converts a typename pack into an index sequence of the same length, and 139 | // is designed to be a drop-in replacement for C++14's 140 | // `std::index_sequence_for()` 141 | template <typename... Ts> 142 | using index_sequence_for = make_index_sequence<sizeof...(Ts)>; 143 | 144 | //// END OF CODE FROM GOOGLE ABSEIL 145 | 146 | #endif 147 | 148 | // dispatch utility (taken from ranges-v3) 149 | template<unsigned N> struct priority_tag : priority_tag < N - 1 > {}; 150 | template<> struct priority_tag<0> {}; 151 | 152 | // taken from ranges-v3 153 | template<typename T> 154 | struct static_const 155 | { 156 | static JSON_INLINE_VARIABLE constexpr T value{}; 157 | }; 158 | 159 | #ifndef JSON_HAS_CPP_17 160 | template<typename T> 161 | constexpr T static_const<T>::value; 162 | #endif 163 | 164 | template<typename T, typename... Args> 165 | inline constexpr std::array<T, sizeof...(Args)> make_array(Args&& ... args) 166 | { 167 | return std::array<T, sizeof...(Args)> {{static_cast<T>(std::forward<Args>(args))...}}; 168 | } 169 | 170 | } // namespace detail 171 | NLOHMANN_JSON_NAMESPACE_END 172 | ``` -------------------------------------------------------------------------------- /include/nlohmann/detail/meta/cpp_future.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-FileCopyrightText: 2018 The Abseil Authors 8 | // SPDX-License-Identifier: MIT 9 | 10 | #pragma once 11 | 12 | #include <array> // array 13 | #include <cstddef> // size_t 14 | #include <type_traits> // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type 15 | #include <utility> // index_sequence, make_index_sequence, index_sequence_for 16 | 17 | #include <nlohmann/detail/macro_scope.hpp> 18 | 19 | NLOHMANN_JSON_NAMESPACE_BEGIN 20 | namespace detail 21 | { 22 | 23 | template<typename T> 24 | using uncvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type; 25 | 26 | #ifdef JSON_HAS_CPP_14 27 | 28 | // the following utilities are natively available in C++14 29 | using std::enable_if_t; 30 | using std::index_sequence; 31 | using std::make_index_sequence; 32 | using std::index_sequence_for; 33 | 34 | #else 35 | 36 | // alias templates to reduce boilerplate 37 | template<bool B, typename T = void> 38 | using enable_if_t = typename std::enable_if<B, T>::type; 39 | 40 | // The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h 41 | // which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. 42 | 43 | //// START OF CODE FROM GOOGLE ABSEIL 44 | 45 | // integer_sequence 46 | // 47 | // Class template representing a compile-time integer sequence. An instantiation 48 | // of `integer_sequence<T, Ints...>` has a sequence of integers encoded in its 49 | // type through its template arguments (which is a common need when 50 | // working with C++11 variadic templates). `absl::integer_sequence` is designed 51 | // to be a drop-in replacement for C++14's `std::integer_sequence`. 52 | // 53 | // Example: 54 | // 55 | // template< class T, T... Ints > 56 | // void user_function(integer_sequence<T, Ints...>); 57 | // 58 | // int main() 59 | // { 60 | // // user_function's `T` will be deduced to `int` and `Ints...` 61 | // // will be deduced to `0, 1, 2, 3, 4`. 62 | // user_function(make_integer_sequence<int, 5>()); 63 | // } 64 | template <typename T, T... Ints> 65 | struct integer_sequence 66 | { 67 | using value_type = T; 68 | static constexpr std::size_t size() noexcept 69 | { 70 | return sizeof...(Ints); 71 | } 72 | }; 73 | 74 | // index_sequence 75 | // 76 | // A helper template for an `integer_sequence` of `size_t`, 77 | // `absl::index_sequence` is designed to be a drop-in replacement for C++14's 78 | // `std::index_sequence`. 79 | template <size_t... Ints> 80 | using index_sequence = integer_sequence<size_t, Ints...>; 81 | 82 | namespace utility_internal 83 | { 84 | 85 | template <typename Seq, size_t SeqSize, size_t Rem> 86 | struct Extend; 87 | 88 | // Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. 89 | template <typename T, T... Ints, size_t SeqSize> 90 | struct Extend<integer_sequence<T, Ints...>, SeqSize, 0> 91 | { 92 | using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; 93 | }; 94 | 95 | template <typename T, T... Ints, size_t SeqSize> 96 | struct Extend<integer_sequence<T, Ints...>, SeqSize, 1> 97 | { 98 | using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; 99 | }; 100 | 101 | // Recursion helper for 'make_integer_sequence<T, N>'. 102 | // 'Gen<T, N>::type' is an alias for 'integer_sequence<T, 0, 1, ... N-1>'. 103 | template <typename T, size_t N> 104 | struct Gen 105 | { 106 | using type = 107 | typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; 108 | }; 109 | 110 | template <typename T> 111 | struct Gen<T, 0> 112 | { 113 | using type = integer_sequence<T>; 114 | }; 115 | 116 | } // namespace utility_internal 117 | 118 | // Compile-time sequences of integers 119 | 120 | // make_integer_sequence 121 | // 122 | // This template alias is equivalent to 123 | // `integer_sequence<int, 0, 1, ..., N-1>`, and is designed to be a drop-in 124 | // replacement for C++14's `std::make_integer_sequence`. 125 | template <typename T, T N> 126 | using make_integer_sequence = typename utility_internal::Gen<T, N>::type; 127 | 128 | // make_index_sequence 129 | // 130 | // This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, 131 | // and is designed to be a drop-in replacement for C++14's 132 | // `std::make_index_sequence`. 133 | template <size_t N> 134 | using make_index_sequence = make_integer_sequence<size_t, N>; 135 | 136 | // index_sequence_for 137 | // 138 | // Converts a typename pack into an index sequence of the same length, and 139 | // is designed to be a drop-in replacement for C++14's 140 | // `std::index_sequence_for()` 141 | template <typename... Ts> 142 | using index_sequence_for = make_index_sequence<sizeof...(Ts)>; 143 | 144 | //// END OF CODE FROM GOOGLE ABSEIL 145 | 146 | #endif 147 | 148 | // dispatch utility (taken from ranges-v3) 149 | template<unsigned N> struct priority_tag : priority_tag < N - 1 > {}; 150 | template<> struct priority_tag<0> {}; 151 | 152 | // taken from ranges-v3 153 | template<typename T> 154 | struct static_const 155 | { 156 | static JSON_INLINE_VARIABLE constexpr T value{}; 157 | }; 158 | 159 | #ifndef JSON_HAS_CPP_17 160 | template<typename T> 161 | constexpr T static_const<T>::value; 162 | #endif 163 | 164 | template<typename T, typename... Args> 165 | inline constexpr std::array<T, sizeof...(Args)> make_array(Args&& ... args) 166 | { 167 | return std::array<T, sizeof...(Args)> {{static_cast<T>(std::forward<Args>(args))...}}; 168 | } 169 | 170 | } // namespace detail 171 | NLOHMANN_JSON_NAMESPACE_END 172 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/nlohmann/thirdparty/hedley/hedley_undef.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #undef JSON_HEDLEY_ALWAYS_INLINE 12 | #undef JSON_HEDLEY_ARM_VERSION 13 | #undef JSON_HEDLEY_ARM_VERSION_CHECK 14 | #undef JSON_HEDLEY_ARRAY_PARAM 15 | #undef JSON_HEDLEY_ASSUME 16 | #undef JSON_HEDLEY_BEGIN_C_DECLS 17 | #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE 18 | #undef JSON_HEDLEY_CLANG_HAS_BUILTIN 19 | #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE 20 | #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE 21 | #undef JSON_HEDLEY_CLANG_HAS_EXTENSION 22 | #undef JSON_HEDLEY_CLANG_HAS_FEATURE 23 | #undef JSON_HEDLEY_CLANG_HAS_WARNING 24 | #undef JSON_HEDLEY_COMPCERT_VERSION 25 | #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK 26 | #undef JSON_HEDLEY_CONCAT 27 | #undef JSON_HEDLEY_CONCAT3 28 | #undef JSON_HEDLEY_CONCAT3_EX 29 | #undef JSON_HEDLEY_CONCAT_EX 30 | #undef JSON_HEDLEY_CONST 31 | #undef JSON_HEDLEY_CONSTEXPR 32 | #undef JSON_HEDLEY_CONST_CAST 33 | #undef JSON_HEDLEY_CPP_CAST 34 | #undef JSON_HEDLEY_CRAY_VERSION 35 | #undef JSON_HEDLEY_CRAY_VERSION_CHECK 36 | #undef JSON_HEDLEY_C_DECL 37 | #undef JSON_HEDLEY_DEPRECATED 38 | #undef JSON_HEDLEY_DEPRECATED_FOR 39 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL 40 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ 41 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED 42 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES 43 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS 44 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION 45 | #undef JSON_HEDLEY_DIAGNOSTIC_POP 46 | #undef JSON_HEDLEY_DIAGNOSTIC_PUSH 47 | #undef JSON_HEDLEY_DMC_VERSION 48 | #undef JSON_HEDLEY_DMC_VERSION_CHECK 49 | #undef JSON_HEDLEY_EMPTY_BASES 50 | #undef JSON_HEDLEY_EMSCRIPTEN_VERSION 51 | #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK 52 | #undef JSON_HEDLEY_END_C_DECLS 53 | #undef JSON_HEDLEY_FLAGS 54 | #undef JSON_HEDLEY_FLAGS_CAST 55 | #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE 56 | #undef JSON_HEDLEY_GCC_HAS_BUILTIN 57 | #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE 58 | #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE 59 | #undef JSON_HEDLEY_GCC_HAS_EXTENSION 60 | #undef JSON_HEDLEY_GCC_HAS_FEATURE 61 | #undef JSON_HEDLEY_GCC_HAS_WARNING 62 | #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK 63 | #undef JSON_HEDLEY_GCC_VERSION 64 | #undef JSON_HEDLEY_GCC_VERSION_CHECK 65 | #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE 66 | #undef JSON_HEDLEY_GNUC_HAS_BUILTIN 67 | #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE 68 | #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE 69 | #undef JSON_HEDLEY_GNUC_HAS_EXTENSION 70 | #undef JSON_HEDLEY_GNUC_HAS_FEATURE 71 | #undef JSON_HEDLEY_GNUC_HAS_WARNING 72 | #undef JSON_HEDLEY_GNUC_VERSION 73 | #undef JSON_HEDLEY_GNUC_VERSION_CHECK 74 | #undef JSON_HEDLEY_HAS_ATTRIBUTE 75 | #undef JSON_HEDLEY_HAS_BUILTIN 76 | #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE 77 | #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS 78 | #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE 79 | #undef JSON_HEDLEY_HAS_EXTENSION 80 | #undef JSON_HEDLEY_HAS_FEATURE 81 | #undef JSON_HEDLEY_HAS_WARNING 82 | #undef JSON_HEDLEY_IAR_VERSION 83 | #undef JSON_HEDLEY_IAR_VERSION_CHECK 84 | #undef JSON_HEDLEY_IBM_VERSION 85 | #undef JSON_HEDLEY_IBM_VERSION_CHECK 86 | #undef JSON_HEDLEY_IMPORT 87 | #undef JSON_HEDLEY_INLINE 88 | #undef JSON_HEDLEY_INTEL_CL_VERSION 89 | #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK 90 | #undef JSON_HEDLEY_INTEL_VERSION 91 | #undef JSON_HEDLEY_INTEL_VERSION_CHECK 92 | #undef JSON_HEDLEY_IS_CONSTANT 93 | #undef JSON_HEDLEY_IS_CONSTEXPR_ 94 | #undef JSON_HEDLEY_LIKELY 95 | #undef JSON_HEDLEY_MALLOC 96 | #undef JSON_HEDLEY_MCST_LCC_VERSION 97 | #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK 98 | #undef JSON_HEDLEY_MESSAGE 99 | #undef JSON_HEDLEY_MSVC_VERSION 100 | #undef JSON_HEDLEY_MSVC_VERSION_CHECK 101 | #undef JSON_HEDLEY_NEVER_INLINE 102 | #undef JSON_HEDLEY_NON_NULL 103 | #undef JSON_HEDLEY_NO_ESCAPE 104 | #undef JSON_HEDLEY_NO_RETURN 105 | #undef JSON_HEDLEY_NO_THROW 106 | #undef JSON_HEDLEY_NULL 107 | #undef JSON_HEDLEY_PELLES_VERSION 108 | #undef JSON_HEDLEY_PELLES_VERSION_CHECK 109 | #undef JSON_HEDLEY_PGI_VERSION 110 | #undef JSON_HEDLEY_PGI_VERSION_CHECK 111 | #undef JSON_HEDLEY_PREDICT 112 | #undef JSON_HEDLEY_PRINTF_FORMAT 113 | #undef JSON_HEDLEY_PRIVATE 114 | #undef JSON_HEDLEY_PUBLIC 115 | #undef JSON_HEDLEY_PURE 116 | #undef JSON_HEDLEY_REINTERPRET_CAST 117 | #undef JSON_HEDLEY_REQUIRE 118 | #undef JSON_HEDLEY_REQUIRE_CONSTEXPR 119 | #undef JSON_HEDLEY_REQUIRE_MSG 120 | #undef JSON_HEDLEY_RESTRICT 121 | #undef JSON_HEDLEY_RETURNS_NON_NULL 122 | #undef JSON_HEDLEY_SENTINEL 123 | #undef JSON_HEDLEY_STATIC_ASSERT 124 | #undef JSON_HEDLEY_STATIC_CAST 125 | #undef JSON_HEDLEY_STRINGIFY 126 | #undef JSON_HEDLEY_STRINGIFY_EX 127 | #undef JSON_HEDLEY_SUNPRO_VERSION 128 | #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK 129 | #undef JSON_HEDLEY_TINYC_VERSION 130 | #undef JSON_HEDLEY_TINYC_VERSION_CHECK 131 | #undef JSON_HEDLEY_TI_ARMCL_VERSION 132 | #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK 133 | #undef JSON_HEDLEY_TI_CL2000_VERSION 134 | #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK 135 | #undef JSON_HEDLEY_TI_CL430_VERSION 136 | #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK 137 | #undef JSON_HEDLEY_TI_CL6X_VERSION 138 | #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK 139 | #undef JSON_HEDLEY_TI_CL7X_VERSION 140 | #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK 141 | #undef JSON_HEDLEY_TI_CLPRU_VERSION 142 | #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK 143 | #undef JSON_HEDLEY_TI_VERSION 144 | #undef JSON_HEDLEY_TI_VERSION_CHECK 145 | #undef JSON_HEDLEY_UNAVAILABLE 146 | #undef JSON_HEDLEY_UNLIKELY 147 | #undef JSON_HEDLEY_UNPREDICTABLE 148 | #undef JSON_HEDLEY_UNREACHABLE 149 | #undef JSON_HEDLEY_UNREACHABLE_RETURN 150 | #undef JSON_HEDLEY_VERSION 151 | #undef JSON_HEDLEY_VERSION_DECODE_MAJOR 152 | #undef JSON_HEDLEY_VERSION_DECODE_MINOR 153 | #undef JSON_HEDLEY_VERSION_DECODE_REVISION 154 | #undef JSON_HEDLEY_VERSION_ENCODE 155 | #undef JSON_HEDLEY_WARNING 156 | #undef JSON_HEDLEY_WARN_UNUSED_RESULT 157 | #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG 158 | #undef JSON_HEDLEY_FALL_THROUGH 159 | ``` -------------------------------------------------------------------------------- /include/nlohmann/thirdparty/hedley/hedley_undef.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #undef JSON_HEDLEY_ALWAYS_INLINE 12 | #undef JSON_HEDLEY_ARM_VERSION 13 | #undef JSON_HEDLEY_ARM_VERSION_CHECK 14 | #undef JSON_HEDLEY_ARRAY_PARAM 15 | #undef JSON_HEDLEY_ASSUME 16 | #undef JSON_HEDLEY_BEGIN_C_DECLS 17 | #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE 18 | #undef JSON_HEDLEY_CLANG_HAS_BUILTIN 19 | #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE 20 | #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE 21 | #undef JSON_HEDLEY_CLANG_HAS_EXTENSION 22 | #undef JSON_HEDLEY_CLANG_HAS_FEATURE 23 | #undef JSON_HEDLEY_CLANG_HAS_WARNING 24 | #undef JSON_HEDLEY_COMPCERT_VERSION 25 | #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK 26 | #undef JSON_HEDLEY_CONCAT 27 | #undef JSON_HEDLEY_CONCAT3 28 | #undef JSON_HEDLEY_CONCAT3_EX 29 | #undef JSON_HEDLEY_CONCAT_EX 30 | #undef JSON_HEDLEY_CONST 31 | #undef JSON_HEDLEY_CONSTEXPR 32 | #undef JSON_HEDLEY_CONST_CAST 33 | #undef JSON_HEDLEY_CPP_CAST 34 | #undef JSON_HEDLEY_CRAY_VERSION 35 | #undef JSON_HEDLEY_CRAY_VERSION_CHECK 36 | #undef JSON_HEDLEY_C_DECL 37 | #undef JSON_HEDLEY_DEPRECATED 38 | #undef JSON_HEDLEY_DEPRECATED_FOR 39 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL 40 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ 41 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED 42 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES 43 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS 44 | #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION 45 | #undef JSON_HEDLEY_DIAGNOSTIC_POP 46 | #undef JSON_HEDLEY_DIAGNOSTIC_PUSH 47 | #undef JSON_HEDLEY_DMC_VERSION 48 | #undef JSON_HEDLEY_DMC_VERSION_CHECK 49 | #undef JSON_HEDLEY_EMPTY_BASES 50 | #undef JSON_HEDLEY_EMSCRIPTEN_VERSION 51 | #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK 52 | #undef JSON_HEDLEY_END_C_DECLS 53 | #undef JSON_HEDLEY_FLAGS 54 | #undef JSON_HEDLEY_FLAGS_CAST 55 | #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE 56 | #undef JSON_HEDLEY_GCC_HAS_BUILTIN 57 | #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE 58 | #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE 59 | #undef JSON_HEDLEY_GCC_HAS_EXTENSION 60 | #undef JSON_HEDLEY_GCC_HAS_FEATURE 61 | #undef JSON_HEDLEY_GCC_HAS_WARNING 62 | #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK 63 | #undef JSON_HEDLEY_GCC_VERSION 64 | #undef JSON_HEDLEY_GCC_VERSION_CHECK 65 | #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE 66 | #undef JSON_HEDLEY_GNUC_HAS_BUILTIN 67 | #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE 68 | #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE 69 | #undef JSON_HEDLEY_GNUC_HAS_EXTENSION 70 | #undef JSON_HEDLEY_GNUC_HAS_FEATURE 71 | #undef JSON_HEDLEY_GNUC_HAS_WARNING 72 | #undef JSON_HEDLEY_GNUC_VERSION 73 | #undef JSON_HEDLEY_GNUC_VERSION_CHECK 74 | #undef JSON_HEDLEY_HAS_ATTRIBUTE 75 | #undef JSON_HEDLEY_HAS_BUILTIN 76 | #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE 77 | #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS 78 | #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE 79 | #undef JSON_HEDLEY_HAS_EXTENSION 80 | #undef JSON_HEDLEY_HAS_FEATURE 81 | #undef JSON_HEDLEY_HAS_WARNING 82 | #undef JSON_HEDLEY_IAR_VERSION 83 | #undef JSON_HEDLEY_IAR_VERSION_CHECK 84 | #undef JSON_HEDLEY_IBM_VERSION 85 | #undef JSON_HEDLEY_IBM_VERSION_CHECK 86 | #undef JSON_HEDLEY_IMPORT 87 | #undef JSON_HEDLEY_INLINE 88 | #undef JSON_HEDLEY_INTEL_CL_VERSION 89 | #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK 90 | #undef JSON_HEDLEY_INTEL_VERSION 91 | #undef JSON_HEDLEY_INTEL_VERSION_CHECK 92 | #undef JSON_HEDLEY_IS_CONSTANT 93 | #undef JSON_HEDLEY_IS_CONSTEXPR_ 94 | #undef JSON_HEDLEY_LIKELY 95 | #undef JSON_HEDLEY_MALLOC 96 | #undef JSON_HEDLEY_MCST_LCC_VERSION 97 | #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK 98 | #undef JSON_HEDLEY_MESSAGE 99 | #undef JSON_HEDLEY_MSVC_VERSION 100 | #undef JSON_HEDLEY_MSVC_VERSION_CHECK 101 | #undef JSON_HEDLEY_NEVER_INLINE 102 | #undef JSON_HEDLEY_NON_NULL 103 | #undef JSON_HEDLEY_NO_ESCAPE 104 | #undef JSON_HEDLEY_NO_RETURN 105 | #undef JSON_HEDLEY_NO_THROW 106 | #undef JSON_HEDLEY_NULL 107 | #undef JSON_HEDLEY_PELLES_VERSION 108 | #undef JSON_HEDLEY_PELLES_VERSION_CHECK 109 | #undef JSON_HEDLEY_PGI_VERSION 110 | #undef JSON_HEDLEY_PGI_VERSION_CHECK 111 | #undef JSON_HEDLEY_PREDICT 112 | #undef JSON_HEDLEY_PRINTF_FORMAT 113 | #undef JSON_HEDLEY_PRIVATE 114 | #undef JSON_HEDLEY_PUBLIC 115 | #undef JSON_HEDLEY_PURE 116 | #undef JSON_HEDLEY_REINTERPRET_CAST 117 | #undef JSON_HEDLEY_REQUIRE 118 | #undef JSON_HEDLEY_REQUIRE_CONSTEXPR 119 | #undef JSON_HEDLEY_REQUIRE_MSG 120 | #undef JSON_HEDLEY_RESTRICT 121 | #undef JSON_HEDLEY_RETURNS_NON_NULL 122 | #undef JSON_HEDLEY_SENTINEL 123 | #undef JSON_HEDLEY_STATIC_ASSERT 124 | #undef JSON_HEDLEY_STATIC_CAST 125 | #undef JSON_HEDLEY_STRINGIFY 126 | #undef JSON_HEDLEY_STRINGIFY_EX 127 | #undef JSON_HEDLEY_SUNPRO_VERSION 128 | #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK 129 | #undef JSON_HEDLEY_TINYC_VERSION 130 | #undef JSON_HEDLEY_TINYC_VERSION_CHECK 131 | #undef JSON_HEDLEY_TI_ARMCL_VERSION 132 | #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK 133 | #undef JSON_HEDLEY_TI_CL2000_VERSION 134 | #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK 135 | #undef JSON_HEDLEY_TI_CL430_VERSION 136 | #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK 137 | #undef JSON_HEDLEY_TI_CL6X_VERSION 138 | #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK 139 | #undef JSON_HEDLEY_TI_CL7X_VERSION 140 | #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK 141 | #undef JSON_HEDLEY_TI_CLPRU_VERSION 142 | #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK 143 | #undef JSON_HEDLEY_TI_VERSION 144 | #undef JSON_HEDLEY_TI_VERSION_CHECK 145 | #undef JSON_HEDLEY_UNAVAILABLE 146 | #undef JSON_HEDLEY_UNLIKELY 147 | #undef JSON_HEDLEY_UNPREDICTABLE 148 | #undef JSON_HEDLEY_UNREACHABLE 149 | #undef JSON_HEDLEY_UNREACHABLE_RETURN 150 | #undef JSON_HEDLEY_VERSION 151 | #undef JSON_HEDLEY_VERSION_DECODE_MAJOR 152 | #undef JSON_HEDLEY_VERSION_DECODE_MINOR 153 | #undef JSON_HEDLEY_VERSION_DECODE_REVISION 154 | #undef JSON_HEDLEY_VERSION_ENCODE 155 | #undef JSON_HEDLEY_WARNING 156 | #undef JSON_HEDLEY_WARN_UNUSED_RESULT 157 | #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG 158 | #undef JSON_HEDLEY_FALL_THROUGH 159 | ``` -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- ``` 1 | cmake_minimum_required(VERSION 3.15) 2 | project(MCPx64dbg) 3 | 4 | # Set C++ standard 5 | set(CMAKE_CXX_STANDARD 17) 6 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 7 | 8 | # Optionally build both 32-bit and 64-bit plugins via a superbuild 9 | option(BUILD_BOTH_ARCHES "Build both 32-bit and 64-bit plugins from this CMake project" ON) 10 | 11 | # If requested and supported by MSVC, drive two sub-builds that produce dp32 and dp64 12 | if(BUILD_BOTH_ARCHES AND MSVC) 13 | include(ExternalProject) 14 | message(STATUS "Configuring superbuild to produce both dp32 and dp64") 15 | 16 | # 32-bit sub-build 17 | ExternalProject_Add(plugin32 18 | SOURCE_DIR ${CMAKE_SOURCE_DIR} 19 | BINARY_DIR ${CMAKE_BINARY_DIR}/build32 20 | CMAKE_ARGS -G "${CMAKE_GENERATOR}" -DCMAKE_GENERATOR_PLATFORM=Win32 -DCMAKE_BUILD_TYPE=$<IF:$<CONFIG:>,${CMAKE_BUILD_TYPE},Release> -DBUILD_BOTH_ARCHES=OFF 21 | INSTALL_COMMAND "" 22 | ) 23 | 24 | # 64-bit sub-build 25 | ExternalProject_Add(plugin64 26 | SOURCE_DIR ${CMAKE_SOURCE_DIR} 27 | BINARY_DIR ${CMAKE_BINARY_DIR}/build64 28 | CMAKE_ARGS -G "${CMAKE_GENERATOR}" -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_BUILD_TYPE=$<IF:$<CONFIG:>,${CMAKE_BUILD_TYPE},Release> -DBUILD_BOTH_ARCHES=OFF 29 | INSTALL_COMMAND "" 30 | ) 31 | 32 | add_custom_target(all_plugins DEPENDS plugin32 plugin64) 33 | 34 | message(STATUS "Use 'cmake --build . --target all_plugins' to build both dp32 and dp64") 35 | 36 | # Stop processing the single-arch build logic in superbuild mode 37 | return() 38 | endif() 39 | 40 | # Detect target architecture from the generator/toolchain (authoritative) for single-arch builds 41 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 42 | set(PLUGIN_EXT ".dp64") 43 | set(ARCH_BITS 64) 44 | set(ARCH_SUFFIX "_x64") 45 | else() 46 | set(PLUGIN_EXT ".dp32") 47 | set(ARCH_BITS 32) 48 | set(ARCH_SUFFIX "_x86") 49 | endif() 50 | 51 | # Set paths to x64dbg SDK 52 | set(X64DBG_SDK_PATH "${CMAKE_SOURCE_DIR}/deps/x64dbg_sdk") 53 | 54 | # Include directories 55 | include_directories( 56 | ${X64DBG_SDK_PATH} 57 | ${X64DBG_SDK_PATH}/pluginsdk 58 | ${X64DBG_SDK_PATH}/pluginsdk/nlohmann # Add nlohmann include path 59 | ${CMAKE_SOURCE_DIR}/include 60 | ) 61 | 62 | # Add source files 63 | file(GLOB SOURCES "src/*.cpp") 64 | 65 | # Create shared library (plugin) 66 | add_library(${PROJECT_NAME} SHARED ${SOURCES}) 67 | 68 | # Set output name 69 | set_target_properties(${PROJECT_NAME} PROPERTIES 70 | PREFIX "" 71 | OUTPUT_NAME "${PROJECT_NAME}" 72 | SUFFIX "${PLUGIN_EXT}" 73 | ) 74 | 75 | # Define macro for architecture 76 | if(CMAKE_SIZEOF_VOID_P EQUAL 8) 77 | target_compile_definitions(${PROJECT_NAME} PRIVATE -D_WIN64) 78 | else() 79 | target_compile_definitions(${PROJECT_NAME} PRIVATE -D_WIN32) 80 | endif() 81 | 82 | # Add path to library files 83 | link_directories(${X64DBG_SDK_PATH}/pluginsdk) 84 | 85 | # Check if libraries exist and adjust architecture suffix if needed 86 | if(NOT EXISTS "${X64DBG_SDK_PATH}/pluginsdk/TitanEngine/TitanEngine${ARCH_SUFFIX}.lib") 87 | message(STATUS "TitanEngine${ARCH_SUFFIX}.lib not found, trying TitanEngine.lib") 88 | set(TITAN_ENGINE_LIB "${X64DBG_SDK_PATH}/pluginsdk/TitanEngine/TitanEngine.lib") 89 | else() 90 | set(TITAN_ENGINE_LIB "${X64DBG_SDK_PATH}/pluginsdk/TitanEngine/TitanEngine${ARCH_SUFFIX}.lib") 91 | endif() 92 | 93 | if(NOT EXISTS "${X64DBG_SDK_PATH}/pluginsdk/DeviceNameResolver/DeviceNameResolver${ARCH_SUFFIX}.lib") 94 | message(STATUS "DeviceNameResolver${ARCH_SUFFIX}.lib not found, trying DeviceNameResolver.lib") 95 | set(DEVICE_RESOLVER_LIB "${X64DBG_SDK_PATH}/pluginsdk/DeviceNameResolver/DeviceNameResolver.lib") 96 | else() 97 | set(DEVICE_RESOLVER_LIB "${X64DBG_SDK_PATH}/pluginsdk/DeviceNameResolver/DeviceNameResolver${ARCH_SUFFIX}.lib") 98 | endif() 99 | 100 | if(NOT EXISTS "${X64DBG_SDK_PATH}/pluginsdk/jansson/jansson${ARCH_SUFFIX}.lib") 101 | message(STATUS "jansson${ARCH_SUFFIX}.lib not found, trying jansson.lib") 102 | set(JANSSON_LIB "${X64DBG_SDK_PATH}/pluginsdk/jansson/jansson.lib") 103 | else() 104 | set(JANSSON_LIB "${X64DBG_SDK_PATH}/pluginsdk/jansson/jansson${ARCH_SUFFIX}.lib") 105 | endif() 106 | 107 | if(NOT EXISTS "${X64DBG_SDK_PATH}/pluginsdk/lz4/lz4${ARCH_SUFFIX}.lib") 108 | message(STATUS "lz4${ARCH_SUFFIX}.lib not found, trying lz4.lib") 109 | set(LZ4_LIB "${X64DBG_SDK_PATH}/pluginsdk/lz4/lz4.lib") 110 | else() 111 | set(LZ4_LIB "${X64DBG_SDK_PATH}/pluginsdk/lz4/lz4${ARCH_SUFFIX}.lib") 112 | endif() 113 | 114 | if(NOT EXISTS "${X64DBG_SDK_PATH}/pluginsdk/XEDParse/XEDParse${ARCH_SUFFIX}.lib") 115 | message(STATUS "XEDParse${ARCH_SUFFIX}.lib not found, trying XEDParse.lib") 116 | set(XEDPARSE_LIB "${X64DBG_SDK_PATH}/pluginsdk/XEDParse/XEDParse.lib") 117 | else() 118 | set(XEDPARSE_LIB "${X64DBG_SDK_PATH}/pluginsdk/XEDParse/XEDParse${ARCH_SUFFIX}.lib") 119 | endif() 120 | 121 | # Link x64dbg libraries and dependencies 122 | target_link_libraries(${PROJECT_NAME} 123 | ws2_32 # For winsock2 124 | winhttp # WinHTTP library 125 | ${TITAN_ENGINE_LIB} 126 | ${DEVICE_RESOLVER_LIB} 127 | ${JANSSON_LIB} 128 | ${LZ4_LIB} 129 | ${XEDPARSE_LIB} 130 | ) 131 | 132 | if (CMAKE_SIZEOF_VOID_P EQUAL 4) 133 | target_link_libraries(${PROJECT_NAME} 134 | ${X64DBG_SDK_PATH}/pluginsdk/x32dbg.lib 135 | ${X64DBG_SDK_PATH}/pluginsdk/x32bridge.lib 136 | ) 137 | elseif (CMAKE_SIZEOF_VOID_P EQUAL 8) 138 | target_link_libraries(${PROJECT_NAME} 139 | ${X64DBG_SDK_PATH}/pluginsdk/x64dbg.lib 140 | ${X64DBG_SDK_PATH}/pluginsdk/x64bridge.lib 141 | ) 142 | endif() 143 | # Just show information about where the plugin is built 144 | add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD 145 | COMMAND ${CMAKE_COMMAND} -E echo "" 146 | COMMAND ${CMAKE_COMMAND} -E echo "=== Plugin build complete ===" 147 | COMMAND ${CMAKE_COMMAND} -E echo "Plugin built at: ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${PROJECT_NAME}${PLUGIN_EXT}" 148 | COMMAND ${CMAKE_COMMAND} -E echo "Install manually to: $ENV{ProgramFiles}/x64dbg/release/x${ARCH_BITS}/plugins/${PROJECT_NAME}${PLUGIN_EXT}" 149 | COMMAND ${CMAKE_COMMAND} -E echo "=================================" 150 | ) ``` -------------------------------------------------------------------------------- /deps/pluginsdk/nlohmann/detail/string_concat.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <cstring> // strlen 12 | #include <string> // string 13 | #include <utility> // forward 14 | 15 | #include <nlohmann/detail/meta/cpp_future.hpp> 16 | #include <nlohmann/detail/meta/detected.hpp> 17 | 18 | NLOHMANN_JSON_NAMESPACE_BEGIN 19 | namespace detail 20 | { 21 | 22 | inline std::size_t concat_length() 23 | { 24 | return 0; 25 | } 26 | 27 | template<typename... Args> 28 | inline std::size_t concat_length(const char* cstr, const Args& ... rest); 29 | 30 | template<typename StringType, typename... Args> 31 | inline std::size_t concat_length(const StringType& str, const Args& ... rest); 32 | 33 | template<typename... Args> 34 | inline std::size_t concat_length(const char /*c*/, const Args& ... rest) 35 | { 36 | return 1 + concat_length(rest...); 37 | } 38 | 39 | template<typename... Args> 40 | inline std::size_t concat_length(const char* cstr, const Args& ... rest) 41 | { 42 | // cppcheck-suppress ignoredReturnValue 43 | return ::strlen(cstr) + concat_length(rest...); 44 | } 45 | 46 | template<typename StringType, typename... Args> 47 | inline std::size_t concat_length(const StringType& str, const Args& ... rest) 48 | { 49 | return str.size() + concat_length(rest...); 50 | } 51 | 52 | template<typename OutStringType> 53 | inline void concat_into(OutStringType& /*out*/) 54 | {} 55 | 56 | template<typename StringType, typename Arg> 57 | using string_can_append = decltype(std::declval<StringType&>().append(std::declval < Arg && > ())); 58 | 59 | template<typename StringType, typename Arg> 60 | using detect_string_can_append = is_detected<string_can_append, StringType, Arg>; 61 | 62 | template<typename StringType, typename Arg> 63 | using string_can_append_op = decltype(std::declval<StringType&>() += std::declval < Arg && > ()); 64 | 65 | template<typename StringType, typename Arg> 66 | using detect_string_can_append_op = is_detected<string_can_append_op, StringType, Arg>; 67 | 68 | template<typename StringType, typename Arg> 69 | using string_can_append_iter = decltype(std::declval<StringType&>().append(std::declval<const Arg&>().begin(), std::declval<const Arg&>().end())); 70 | 71 | template<typename StringType, typename Arg> 72 | using detect_string_can_append_iter = is_detected<string_can_append_iter, StringType, Arg>; 73 | 74 | template<typename StringType, typename Arg> 75 | using string_can_append_data = decltype(std::declval<StringType&>().append(std::declval<const Arg&>().data(), std::declval<const Arg&>().size())); 76 | 77 | template<typename StringType, typename Arg> 78 | using detect_string_can_append_data = is_detected<string_can_append_data, StringType, Arg>; 79 | 80 | template < typename OutStringType, typename Arg, typename... Args, 81 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 82 | && detect_string_can_append_op<OutStringType, Arg>::value, int > = 0 > 83 | inline void concat_into(OutStringType& out, Arg && arg, Args && ... rest); 84 | 85 | template < typename OutStringType, typename Arg, typename... Args, 86 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 87 | && !detect_string_can_append_op<OutStringType, Arg>::value 88 | && detect_string_can_append_iter<OutStringType, Arg>::value, int > = 0 > 89 | inline void concat_into(OutStringType& out, const Arg& arg, Args && ... rest); 90 | 91 | template < typename OutStringType, typename Arg, typename... Args, 92 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 93 | && !detect_string_can_append_op<OutStringType, Arg>::value 94 | && !detect_string_can_append_iter<OutStringType, Arg>::value 95 | && detect_string_can_append_data<OutStringType, Arg>::value, int > = 0 > 96 | inline void concat_into(OutStringType& out, const Arg& arg, Args && ... rest); 97 | 98 | template<typename OutStringType, typename Arg, typename... Args, 99 | enable_if_t<detect_string_can_append<OutStringType, Arg>::value, int> = 0> 100 | inline void concat_into(OutStringType& out, Arg && arg, Args && ... rest) 101 | { 102 | out.append(std::forward<Arg>(arg)); 103 | concat_into(out, std::forward<Args>(rest)...); 104 | } 105 | 106 | template < typename OutStringType, typename Arg, typename... Args, 107 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 108 | && detect_string_can_append_op<OutStringType, Arg>::value, int > > 109 | inline void concat_into(OutStringType& out, Arg&& arg, Args&& ... rest) 110 | { 111 | out += std::forward<Arg>(arg); 112 | concat_into(out, std::forward<Args>(rest)...); 113 | } 114 | 115 | template < typename OutStringType, typename Arg, typename... Args, 116 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 117 | && !detect_string_can_append_op<OutStringType, Arg>::value 118 | && detect_string_can_append_iter<OutStringType, Arg>::value, int > > 119 | inline void concat_into(OutStringType& out, const Arg& arg, Args&& ... rest) 120 | { 121 | out.append(arg.begin(), arg.end()); 122 | concat_into(out, std::forward<Args>(rest)...); 123 | } 124 | 125 | template < typename OutStringType, typename Arg, typename... Args, 126 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 127 | && !detect_string_can_append_op<OutStringType, Arg>::value 128 | && !detect_string_can_append_iter<OutStringType, Arg>::value 129 | && detect_string_can_append_data<OutStringType, Arg>::value, int > > 130 | inline void concat_into(OutStringType& out, const Arg& arg, Args&& ... rest) 131 | { 132 | out.append(arg.data(), arg.size()); 133 | concat_into(out, std::forward<Args>(rest)...); 134 | } 135 | 136 | template<typename OutStringType = std::string, typename... Args> 137 | inline OutStringType concat(Args && ... args) 138 | { 139 | OutStringType str; 140 | str.reserve(concat_length(args...)); 141 | concat_into(str, std::forward<Args>(args)...); 142 | return str; 143 | } 144 | 145 | } // namespace detail 146 | NLOHMANN_JSON_NAMESPACE_END 147 | ``` -------------------------------------------------------------------------------- /include/nlohmann/detail/string_concat.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <cstring> // strlen 12 | #include <string> // string 13 | #include <utility> // forward 14 | 15 | #include <nlohmann/detail/meta/cpp_future.hpp> 16 | #include <nlohmann/detail/meta/detected.hpp> 17 | 18 | NLOHMANN_JSON_NAMESPACE_BEGIN 19 | namespace detail 20 | { 21 | 22 | inline std::size_t concat_length() 23 | { 24 | return 0; 25 | } 26 | 27 | template<typename... Args> 28 | inline std::size_t concat_length(const char* cstr, const Args& ... rest); 29 | 30 | template<typename StringType, typename... Args> 31 | inline std::size_t concat_length(const StringType& str, const Args& ... rest); 32 | 33 | template<typename... Args> 34 | inline std::size_t concat_length(const char /*c*/, const Args& ... rest) 35 | { 36 | return 1 + concat_length(rest...); 37 | } 38 | 39 | template<typename... Args> 40 | inline std::size_t concat_length(const char* cstr, const Args& ... rest) 41 | { 42 | // cppcheck-suppress ignoredReturnValue 43 | return ::strlen(cstr) + concat_length(rest...); 44 | } 45 | 46 | template<typename StringType, typename... Args> 47 | inline std::size_t concat_length(const StringType& str, const Args& ... rest) 48 | { 49 | return str.size() + concat_length(rest...); 50 | } 51 | 52 | template<typename OutStringType> 53 | inline void concat_into(OutStringType& /*out*/) 54 | {} 55 | 56 | template<typename StringType, typename Arg> 57 | using string_can_append = decltype(std::declval<StringType&>().append(std::declval < Arg && > ())); 58 | 59 | template<typename StringType, typename Arg> 60 | using detect_string_can_append = is_detected<string_can_append, StringType, Arg>; 61 | 62 | template<typename StringType, typename Arg> 63 | using string_can_append_op = decltype(std::declval<StringType&>() += std::declval < Arg && > ()); 64 | 65 | template<typename StringType, typename Arg> 66 | using detect_string_can_append_op = is_detected<string_can_append_op, StringType, Arg>; 67 | 68 | template<typename StringType, typename Arg> 69 | using string_can_append_iter = decltype(std::declval<StringType&>().append(std::declval<const Arg&>().begin(), std::declval<const Arg&>().end())); 70 | 71 | template<typename StringType, typename Arg> 72 | using detect_string_can_append_iter = is_detected<string_can_append_iter, StringType, Arg>; 73 | 74 | template<typename StringType, typename Arg> 75 | using string_can_append_data = decltype(std::declval<StringType&>().append(std::declval<const Arg&>().data(), std::declval<const Arg&>().size())); 76 | 77 | template<typename StringType, typename Arg> 78 | using detect_string_can_append_data = is_detected<string_can_append_data, StringType, Arg>; 79 | 80 | template < typename OutStringType, typename Arg, typename... Args, 81 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 82 | && detect_string_can_append_op<OutStringType, Arg>::value, int > = 0 > 83 | inline void concat_into(OutStringType& out, Arg && arg, Args && ... rest); 84 | 85 | template < typename OutStringType, typename Arg, typename... Args, 86 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 87 | && !detect_string_can_append_op<OutStringType, Arg>::value 88 | && detect_string_can_append_iter<OutStringType, Arg>::value, int > = 0 > 89 | inline void concat_into(OutStringType& out, const Arg& arg, Args && ... rest); 90 | 91 | template < typename OutStringType, typename Arg, typename... Args, 92 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 93 | && !detect_string_can_append_op<OutStringType, Arg>::value 94 | && !detect_string_can_append_iter<OutStringType, Arg>::value 95 | && detect_string_can_append_data<OutStringType, Arg>::value, int > = 0 > 96 | inline void concat_into(OutStringType& out, const Arg& arg, Args && ... rest); 97 | 98 | template<typename OutStringType, typename Arg, typename... Args, 99 | enable_if_t<detect_string_can_append<OutStringType, Arg>::value, int> = 0> 100 | inline void concat_into(OutStringType& out, Arg && arg, Args && ... rest) 101 | { 102 | out.append(std::forward<Arg>(arg)); 103 | concat_into(out, std::forward<Args>(rest)...); 104 | } 105 | 106 | template < typename OutStringType, typename Arg, typename... Args, 107 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 108 | && detect_string_can_append_op<OutStringType, Arg>::value, int > > 109 | inline void concat_into(OutStringType& out, Arg&& arg, Args&& ... rest) 110 | { 111 | out += std::forward<Arg>(arg); 112 | concat_into(out, std::forward<Args>(rest)...); 113 | } 114 | 115 | template < typename OutStringType, typename Arg, typename... Args, 116 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 117 | && !detect_string_can_append_op<OutStringType, Arg>::value 118 | && detect_string_can_append_iter<OutStringType, Arg>::value, int > > 119 | inline void concat_into(OutStringType& out, const Arg& arg, Args&& ... rest) 120 | { 121 | out.append(arg.begin(), arg.end()); 122 | concat_into(out, std::forward<Args>(rest)...); 123 | } 124 | 125 | template < typename OutStringType, typename Arg, typename... Args, 126 | enable_if_t < !detect_string_can_append<OutStringType, Arg>::value 127 | && !detect_string_can_append_op<OutStringType, Arg>::value 128 | && !detect_string_can_append_iter<OutStringType, Arg>::value 129 | && detect_string_can_append_data<OutStringType, Arg>::value, int > > 130 | inline void concat_into(OutStringType& out, const Arg& arg, Args&& ... rest) 131 | { 132 | out.append(arg.data(), arg.size()); 133 | concat_into(out, std::forward<Args>(rest)...); 134 | } 135 | 136 | template<typename OutStringType = std::string, typename... Args> 137 | inline OutStringType concat(Args && ... args) 138 | { 139 | OutStringType str; 140 | str.reserve(concat_length(args...)); 141 | concat_into(str, std::forward<Args>(args)...); 142 | return str; 143 | } 144 | 145 | } // namespace detail 146 | NLOHMANN_JSON_NAMESPACE_END 147 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/bridgegraph.h: -------------------------------------------------------------------------------- ``` 1 | #ifndef _GRAPH_H 2 | #define _GRAPH_H 3 | 4 | typedef struct 5 | { 6 | duint addr; //virtual address of the instruction 7 | unsigned char data[15]; //instruction bytes 8 | } BridgeCFInstruction; 9 | 10 | typedef struct 11 | { 12 | duint parentGraph; //function of which this node is a part 13 | duint start; //start of the block 14 | duint end; //end of the block (inclusive) 15 | duint brtrue; //destination if condition is true 16 | duint brfalse; //destination if condition is false 17 | duint icount; //number of instructions in node 18 | bool terminal; //node is a RET 19 | bool split; //node is a split (brtrue points to the next node) 20 | bool indirectcall; //node contains indirect calls (call reg, call [reg+X]) 21 | void* userdata; //user data 22 | ListInfo exits; //exits (including brtrue and brfalse, duint) 23 | ListInfo instrs; //block instructions 24 | } BridgeCFNodeList; 25 | 26 | typedef struct 27 | { 28 | duint entryPoint; //graph entry point 29 | void* userdata; //user data 30 | ListInfo nodes; //graph nodes (BridgeCFNodeList) 31 | } BridgeCFGraphList; 32 | 33 | #ifdef __cplusplus 34 | #if _MSC_VER >= 1700 && !defined(NO_CPP11) 35 | 36 | #include <unordered_map> 37 | #include <unordered_set> 38 | #include <vector> 39 | #include <utility> 40 | 41 | struct BridgeCFNode 42 | { 43 | duint parentGraph = 0; //function of which this node is a part 44 | duint start = 0; //va of the first instruction in the block 45 | duint end = 0; //va of the last instruction in the block (inclusive) 46 | duint brtrue = 0; //destination if condition is true 47 | duint brfalse = 0; //destination if condition is false 48 | duint icount = 0; //number of instructions in node 49 | bool terminal = false; //node is a RET 50 | bool split = false; //node is a split (brtrue points to the next node) 51 | bool indirectcall = false; //node contains indirect calls (call reg, call [reg+X]) 52 | void* userdata = nullptr; //user data 53 | std::vector<duint> exits; //exits (including brtrue and brfalse) 54 | std::vector<BridgeCFInstruction> instrs; //block instructions 55 | 56 | static void Free(const BridgeCFNodeList* nodeList) 57 | { 58 | if(!BridgeList<duint>::Free(&nodeList->exits)) 59 | __debugbreak(); 60 | if(!BridgeList<BridgeCFInstruction>::Free(&nodeList->instrs)) 61 | __debugbreak(); 62 | } 63 | 64 | BridgeCFNode() = default; 65 | 66 | BridgeCFNode(const BridgeCFNodeList* nodeList, bool freedata) 67 | { 68 | if(!nodeList) 69 | __debugbreak(); 70 | parentGraph = nodeList->parentGraph; 71 | start = nodeList->start; 72 | end = nodeList->end; 73 | brtrue = nodeList->brtrue; 74 | brfalse = nodeList->brfalse; 75 | icount = nodeList->icount; 76 | terminal = nodeList->terminal; 77 | indirectcall = nodeList->indirectcall; 78 | split = nodeList->split; 79 | userdata = nodeList->userdata; 80 | if(!BridgeList<duint>::ToVector(&nodeList->exits, exits, freedata)) 81 | __debugbreak(); 82 | if(!BridgeList<BridgeCFInstruction>::ToVector(&nodeList->instrs, instrs, freedata)) 83 | __debugbreak(); 84 | } 85 | 86 | BridgeCFNode(duint parentGraph, duint start, duint end) 87 | : parentGraph(parentGraph), 88 | start(start), 89 | end(end) 90 | { 91 | } 92 | 93 | BridgeCFNodeList ToNodeList() const 94 | { 95 | BridgeCFNodeList out; 96 | out.parentGraph = parentGraph; 97 | out.start = start; 98 | out.end = end; 99 | out.brtrue = brtrue; 100 | out.brfalse = brfalse; 101 | out.icount = icount; 102 | out.terminal = terminal; 103 | out.indirectcall = indirectcall; 104 | out.split = split; 105 | out.userdata = userdata; 106 | BridgeList<duint>::CopyData(&out.exits, exits); 107 | BridgeList<BridgeCFInstruction>::CopyData(&out.instrs, instrs); 108 | return std::move(out); 109 | } 110 | }; 111 | 112 | struct BridgeCFGraph 113 | { 114 | duint entryPoint; //graph entry point 115 | void* userdata; //user data 116 | std::unordered_map<duint, BridgeCFNode> nodes; //CFNode.start -> CFNode 117 | std::unordered_map<duint, std::unordered_set<duint>> parents; //CFNode.start -> parents 118 | 119 | static void Free(const BridgeCFGraphList* graphList) 120 | { 121 | if(!graphList || graphList->nodes.size != graphList->nodes.count * sizeof(BridgeCFNodeList)) 122 | __debugbreak(); 123 | auto data = (BridgeCFNodeList*)graphList->nodes.data; 124 | for(int i = 0; i < graphList->nodes.count; i++) 125 | BridgeCFNode::Free(&data[i]); 126 | BridgeFree(data); 127 | } 128 | 129 | explicit BridgeCFGraph(const BridgeCFGraphList* graphList, bool freedata) 130 | { 131 | if(!graphList || graphList->nodes.size != graphList->nodes.count * sizeof(BridgeCFNodeList)) 132 | __debugbreak(); 133 | entryPoint = graphList->entryPoint; 134 | userdata = graphList->userdata; 135 | auto data = (BridgeCFNodeList*)graphList->nodes.data; 136 | for(int i = 0; i < graphList->nodes.count; i++) 137 | AddNode(BridgeCFNode(&data[i], freedata)); 138 | if(freedata && data) 139 | BridgeFree(data); 140 | } 141 | 142 | explicit BridgeCFGraph(duint entryPoint) 143 | : entryPoint(entryPoint), 144 | userdata(nullptr) 145 | { 146 | } 147 | 148 | void AddNode(const BridgeCFNode & node) 149 | { 150 | nodes[node.start] = node; 151 | AddParent(node.start, node.brtrue); 152 | AddParent(node.start, node.brfalse); 153 | } 154 | 155 | void AddParent(duint child, duint parent) 156 | { 157 | if(!child || !parent) 158 | return; 159 | auto found = parents.find(child); 160 | if(found == parents.end()) 161 | { 162 | parents[child] = std::unordered_set<duint>(); 163 | parents[child].insert(parent); 164 | } 165 | else 166 | found->second.insert(parent); 167 | } 168 | 169 | BridgeCFGraphList ToGraphList() const 170 | { 171 | BridgeCFGraphList out; 172 | out.entryPoint = entryPoint; 173 | out.userdata = userdata; 174 | std::vector<BridgeCFNodeList> nodeList; 175 | nodeList.reserve(nodes.size()); 176 | for(const auto & nodeIt : nodes) 177 | nodeList.push_back(nodeIt.second.ToNodeList()); 178 | BridgeList<BridgeCFNodeList>::CopyData(&out.nodes, nodeList); 179 | return std::move(out); 180 | } 181 | }; 182 | 183 | #endif //_MSC_VER 184 | #endif //__cplusplus 185 | 186 | #endif //_GRAPH_H ``` -------------------------------------------------------------------------------- /deps/x64dbg_sdk/pluginsdk/bridgegraph.h: -------------------------------------------------------------------------------- ``` 1 | #ifndef _GRAPH_H 2 | #define _GRAPH_H 3 | 4 | typedef struct 5 | { 6 | duint addr; //virtual address of the instruction 7 | unsigned char data[15]; //instruction bytes 8 | } BridgeCFInstruction; 9 | 10 | typedef struct 11 | { 12 | duint parentGraph; //function of which this node is a part 13 | duint start; //start of the block 14 | duint end; //end of the block (inclusive) 15 | duint brtrue; //destination if condition is true 16 | duint brfalse; //destination if condition is false 17 | duint icount; //number of instructions in node 18 | bool terminal; //node is a RET 19 | bool split; //node is a split (brtrue points to the next node) 20 | bool indirectcall; //node contains indirect calls (call reg, call [reg+X]) 21 | void* userdata; //user data 22 | ListInfo exits; //exits (including brtrue and brfalse, duint) 23 | ListInfo instrs; //block instructions 24 | } BridgeCFNodeList; 25 | 26 | typedef struct 27 | { 28 | duint entryPoint; //graph entry point 29 | void* userdata; //user data 30 | ListInfo nodes; //graph nodes (BridgeCFNodeList) 31 | } BridgeCFGraphList; 32 | 33 | #ifdef __cplusplus 34 | #if _MSC_VER >= 1700 && !defined(NO_CPP11) 35 | 36 | #include <unordered_map> 37 | #include <unordered_set> 38 | #include <vector> 39 | #include <utility> 40 | 41 | struct BridgeCFNode 42 | { 43 | duint parentGraph = 0; //function of which this node is a part 44 | duint start = 0; //va of the first instruction in the block 45 | duint end = 0; //va of the last instruction in the block (inclusive) 46 | duint brtrue = 0; //destination if condition is true 47 | duint brfalse = 0; //destination if condition is false 48 | duint icount = 0; //number of instructions in node 49 | bool terminal = false; //node is a RET 50 | bool split = false; //node is a split (brtrue points to the next node) 51 | bool indirectcall = false; //node contains indirect calls (call reg, call [reg+X]) 52 | void* userdata = nullptr; //user data 53 | std::vector<duint> exits; //exits (including brtrue and brfalse) 54 | std::vector<BridgeCFInstruction> instrs; //block instructions 55 | 56 | static void Free(const BridgeCFNodeList* nodeList) 57 | { 58 | if(!BridgeList<duint>::Free(&nodeList->exits)) 59 | __debugbreak(); 60 | if(!BridgeList<BridgeCFInstruction>::Free(&nodeList->instrs)) 61 | __debugbreak(); 62 | } 63 | 64 | BridgeCFNode() = default; 65 | 66 | BridgeCFNode(const BridgeCFNodeList* nodeList, bool freedata) 67 | { 68 | if(!nodeList) 69 | __debugbreak(); 70 | parentGraph = nodeList->parentGraph; 71 | start = nodeList->start; 72 | end = nodeList->end; 73 | brtrue = nodeList->brtrue; 74 | brfalse = nodeList->brfalse; 75 | icount = nodeList->icount; 76 | terminal = nodeList->terminal; 77 | indirectcall = nodeList->indirectcall; 78 | split = nodeList->split; 79 | userdata = nodeList->userdata; 80 | if(!BridgeList<duint>::ToVector(&nodeList->exits, exits, freedata)) 81 | __debugbreak(); 82 | if(!BridgeList<BridgeCFInstruction>::ToVector(&nodeList->instrs, instrs, freedata)) 83 | __debugbreak(); 84 | } 85 | 86 | BridgeCFNode(duint parentGraph, duint start, duint end) 87 | : parentGraph(parentGraph), 88 | start(start), 89 | end(end) 90 | { 91 | } 92 | 93 | BridgeCFNodeList ToNodeList() const 94 | { 95 | BridgeCFNodeList out; 96 | out.parentGraph = parentGraph; 97 | out.start = start; 98 | out.end = end; 99 | out.brtrue = brtrue; 100 | out.brfalse = brfalse; 101 | out.icount = icount; 102 | out.terminal = terminal; 103 | out.indirectcall = indirectcall; 104 | out.split = split; 105 | out.userdata = userdata; 106 | BridgeList<duint>::CopyData(&out.exits, exits); 107 | BridgeList<BridgeCFInstruction>::CopyData(&out.instrs, instrs); 108 | return std::move(out); 109 | } 110 | }; 111 | 112 | struct BridgeCFGraph 113 | { 114 | duint entryPoint; //graph entry point 115 | void* userdata; //user data 116 | std::unordered_map<duint, BridgeCFNode> nodes; //CFNode.start -> CFNode 117 | std::unordered_map<duint, std::unordered_set<duint>> parents; //CFNode.start -> parents 118 | 119 | static void Free(const BridgeCFGraphList* graphList) 120 | { 121 | if(!graphList || graphList->nodes.size != graphList->nodes.count * sizeof(BridgeCFNodeList)) 122 | __debugbreak(); 123 | auto data = (BridgeCFNodeList*)graphList->nodes.data; 124 | for(int i = 0; i < graphList->nodes.count; i++) 125 | BridgeCFNode::Free(&data[i]); 126 | BridgeFree(data); 127 | } 128 | 129 | explicit BridgeCFGraph(const BridgeCFGraphList* graphList, bool freedata) 130 | { 131 | if(!graphList || graphList->nodes.size != graphList->nodes.count * sizeof(BridgeCFNodeList)) 132 | __debugbreak(); 133 | entryPoint = graphList->entryPoint; 134 | userdata = graphList->userdata; 135 | auto data = (BridgeCFNodeList*)graphList->nodes.data; 136 | for(int i = 0; i < graphList->nodes.count; i++) 137 | AddNode(BridgeCFNode(&data[i], freedata)); 138 | if(freedata && data) 139 | BridgeFree(data); 140 | } 141 | 142 | explicit BridgeCFGraph(duint entryPoint) 143 | : entryPoint(entryPoint), 144 | userdata(nullptr) 145 | { 146 | } 147 | 148 | void AddNode(const BridgeCFNode & node) 149 | { 150 | nodes[node.start] = node; 151 | AddParent(node.start, node.brtrue); 152 | AddParent(node.start, node.brfalse); 153 | } 154 | 155 | void AddParent(duint child, duint parent) 156 | { 157 | if(!child || !parent) 158 | return; 159 | auto found = parents.find(child); 160 | if(found == parents.end()) 161 | { 162 | parents[child] = std::unordered_set<duint>(); 163 | parents[child].insert(parent); 164 | } 165 | else 166 | found->second.insert(parent); 167 | } 168 | 169 | BridgeCFGraphList ToGraphList() const 170 | { 171 | BridgeCFGraphList out; 172 | out.entryPoint = entryPoint; 173 | out.userdata = userdata; 174 | std::vector<BridgeCFNodeList> nodeList; 175 | nodeList.reserve(nodes.size()); 176 | for(const auto & nodeIt : nodes) 177 | nodeList.push_back(nodeIt.second.ToNodeList()); 178 | BridgeList<BridgeCFNodeList>::CopyData(&out.nodes, nodeList); 179 | return std::move(out); 180 | } 181 | }; 182 | 183 | #endif //_MSC_VER 184 | #endif //__cplusplus 185 | 186 | #endif //_GRAPH_H ``` -------------------------------------------------------------------------------- /deps/pluginsdk/nlohmann/detail/meta/is_sax.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <cstdint> // size_t 12 | #include <utility> // declval 13 | #include <string> // string 14 | 15 | #include <nlohmann/detail/abi_macros.hpp> 16 | #include <nlohmann/detail/meta/detected.hpp> 17 | #include <nlohmann/detail/meta/type_traits.hpp> 18 | 19 | NLOHMANN_JSON_NAMESPACE_BEGIN 20 | namespace detail 21 | { 22 | 23 | template<typename T> 24 | using null_function_t = decltype(std::declval<T&>().null()); 25 | 26 | template<typename T> 27 | using boolean_function_t = 28 | decltype(std::declval<T&>().boolean(std::declval<bool>())); 29 | 30 | template<typename T, typename Integer> 31 | using number_integer_function_t = 32 | decltype(std::declval<T&>().number_integer(std::declval<Integer>())); 33 | 34 | template<typename T, typename Unsigned> 35 | using number_unsigned_function_t = 36 | decltype(std::declval<T&>().number_unsigned(std::declval<Unsigned>())); 37 | 38 | template<typename T, typename Float, typename String> 39 | using number_float_function_t = decltype(std::declval<T&>().number_float( 40 | std::declval<Float>(), std::declval<const String&>())); 41 | 42 | template<typename T, typename String> 43 | using string_function_t = 44 | decltype(std::declval<T&>().string(std::declval<String&>())); 45 | 46 | template<typename T, typename Binary> 47 | using binary_function_t = 48 | decltype(std::declval<T&>().binary(std::declval<Binary&>())); 49 | 50 | template<typename T> 51 | using start_object_function_t = 52 | decltype(std::declval<T&>().start_object(std::declval<std::size_t>())); 53 | 54 | template<typename T, typename String> 55 | using key_function_t = 56 | decltype(std::declval<T&>().key(std::declval<String&>())); 57 | 58 | template<typename T> 59 | using end_object_function_t = decltype(std::declval<T&>().end_object()); 60 | 61 | template<typename T> 62 | using start_array_function_t = 63 | decltype(std::declval<T&>().start_array(std::declval<std::size_t>())); 64 | 65 | template<typename T> 66 | using end_array_function_t = decltype(std::declval<T&>().end_array()); 67 | 68 | template<typename T, typename Exception> 69 | using parse_error_function_t = decltype(std::declval<T&>().parse_error( 70 | std::declval<std::size_t>(), std::declval<const std::string&>(), 71 | std::declval<const Exception&>())); 72 | 73 | template<typename SAX, typename BasicJsonType> 74 | struct is_sax 75 | { 76 | private: 77 | static_assert(is_basic_json<BasicJsonType>::value, 78 | "BasicJsonType must be of type basic_json<...>"); 79 | 80 | using number_integer_t = typename BasicJsonType::number_integer_t; 81 | using number_unsigned_t = typename BasicJsonType::number_unsigned_t; 82 | using number_float_t = typename BasicJsonType::number_float_t; 83 | using string_t = typename BasicJsonType::string_t; 84 | using binary_t = typename BasicJsonType::binary_t; 85 | using exception_t = typename BasicJsonType::exception; 86 | 87 | public: 88 | static constexpr bool value = 89 | is_detected_exact<bool, null_function_t, SAX>::value && 90 | is_detected_exact<bool, boolean_function_t, SAX>::value && 91 | is_detected_exact<bool, number_integer_function_t, SAX, number_integer_t>::value && 92 | is_detected_exact<bool, number_unsigned_function_t, SAX, number_unsigned_t>::value && 93 | is_detected_exact<bool, number_float_function_t, SAX, number_float_t, string_t>::value && 94 | is_detected_exact<bool, string_function_t, SAX, string_t>::value && 95 | is_detected_exact<bool, binary_function_t, SAX, binary_t>::value && 96 | is_detected_exact<bool, start_object_function_t, SAX>::value && 97 | is_detected_exact<bool, key_function_t, SAX, string_t>::value && 98 | is_detected_exact<bool, end_object_function_t, SAX>::value && 99 | is_detected_exact<bool, start_array_function_t, SAX>::value && 100 | is_detected_exact<bool, end_array_function_t, SAX>::value && 101 | is_detected_exact<bool, parse_error_function_t, SAX, exception_t>::value; 102 | }; 103 | 104 | template<typename SAX, typename BasicJsonType> 105 | struct is_sax_static_asserts 106 | { 107 | private: 108 | static_assert(is_basic_json<BasicJsonType>::value, 109 | "BasicJsonType must be of type basic_json<...>"); 110 | 111 | using number_integer_t = typename BasicJsonType::number_integer_t; 112 | using number_unsigned_t = typename BasicJsonType::number_unsigned_t; 113 | using number_float_t = typename BasicJsonType::number_float_t; 114 | using string_t = typename BasicJsonType::string_t; 115 | using binary_t = typename BasicJsonType::binary_t; 116 | using exception_t = typename BasicJsonType::exception; 117 | 118 | public: 119 | static_assert(is_detected_exact<bool, null_function_t, SAX>::value, 120 | "Missing/invalid function: bool null()"); 121 | static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value, 122 | "Missing/invalid function: bool boolean(bool)"); 123 | static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value, 124 | "Missing/invalid function: bool boolean(bool)"); 125 | static_assert( 126 | is_detected_exact<bool, number_integer_function_t, SAX, 127 | number_integer_t>::value, 128 | "Missing/invalid function: bool number_integer(number_integer_t)"); 129 | static_assert( 130 | is_detected_exact<bool, number_unsigned_function_t, SAX, 131 | number_unsigned_t>::value, 132 | "Missing/invalid function: bool number_unsigned(number_unsigned_t)"); 133 | static_assert(is_detected_exact<bool, number_float_function_t, SAX, 134 | number_float_t, string_t>::value, 135 | "Missing/invalid function: bool number_float(number_float_t, const string_t&)"); 136 | static_assert( 137 | is_detected_exact<bool, string_function_t, SAX, string_t>::value, 138 | "Missing/invalid function: bool string(string_t&)"); 139 | static_assert( 140 | is_detected_exact<bool, binary_function_t, SAX, binary_t>::value, 141 | "Missing/invalid function: bool binary(binary_t&)"); 142 | static_assert(is_detected_exact<bool, start_object_function_t, SAX>::value, 143 | "Missing/invalid function: bool start_object(std::size_t)"); 144 | static_assert(is_detected_exact<bool, key_function_t, SAX, string_t>::value, 145 | "Missing/invalid function: bool key(string_t&)"); 146 | static_assert(is_detected_exact<bool, end_object_function_t, SAX>::value, 147 | "Missing/invalid function: bool end_object()"); 148 | static_assert(is_detected_exact<bool, start_array_function_t, SAX>::value, 149 | "Missing/invalid function: bool start_array(std::size_t)"); 150 | static_assert(is_detected_exact<bool, end_array_function_t, SAX>::value, 151 | "Missing/invalid function: bool end_array()"); 152 | static_assert( 153 | is_detected_exact<bool, parse_error_function_t, SAX, exception_t>::value, 154 | "Missing/invalid function: bool parse_error(std::size_t, const " 155 | "std::string&, const exception&)"); 156 | }; 157 | 158 | } // namespace detail 159 | NLOHMANN_JSON_NAMESPACE_END 160 | ``` -------------------------------------------------------------------------------- /include/nlohmann/detail/meta/is_sax.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <cstdint> // size_t 12 | #include <utility> // declval 13 | #include <string> // string 14 | 15 | #include <nlohmann/detail/abi_macros.hpp> 16 | #include <nlohmann/detail/meta/detected.hpp> 17 | #include <nlohmann/detail/meta/type_traits.hpp> 18 | 19 | NLOHMANN_JSON_NAMESPACE_BEGIN 20 | namespace detail 21 | { 22 | 23 | template<typename T> 24 | using null_function_t = decltype(std::declval<T&>().null()); 25 | 26 | template<typename T> 27 | using boolean_function_t = 28 | decltype(std::declval<T&>().boolean(std::declval<bool>())); 29 | 30 | template<typename T, typename Integer> 31 | using number_integer_function_t = 32 | decltype(std::declval<T&>().number_integer(std::declval<Integer>())); 33 | 34 | template<typename T, typename Unsigned> 35 | using number_unsigned_function_t = 36 | decltype(std::declval<T&>().number_unsigned(std::declval<Unsigned>())); 37 | 38 | template<typename T, typename Float, typename String> 39 | using number_float_function_t = decltype(std::declval<T&>().number_float( 40 | std::declval<Float>(), std::declval<const String&>())); 41 | 42 | template<typename T, typename String> 43 | using string_function_t = 44 | decltype(std::declval<T&>().string(std::declval<String&>())); 45 | 46 | template<typename T, typename Binary> 47 | using binary_function_t = 48 | decltype(std::declval<T&>().binary(std::declval<Binary&>())); 49 | 50 | template<typename T> 51 | using start_object_function_t = 52 | decltype(std::declval<T&>().start_object(std::declval<std::size_t>())); 53 | 54 | template<typename T, typename String> 55 | using key_function_t = 56 | decltype(std::declval<T&>().key(std::declval<String&>())); 57 | 58 | template<typename T> 59 | using end_object_function_t = decltype(std::declval<T&>().end_object()); 60 | 61 | template<typename T> 62 | using start_array_function_t = 63 | decltype(std::declval<T&>().start_array(std::declval<std::size_t>())); 64 | 65 | template<typename T> 66 | using end_array_function_t = decltype(std::declval<T&>().end_array()); 67 | 68 | template<typename T, typename Exception> 69 | using parse_error_function_t = decltype(std::declval<T&>().parse_error( 70 | std::declval<std::size_t>(), std::declval<const std::string&>(), 71 | std::declval<const Exception&>())); 72 | 73 | template<typename SAX, typename BasicJsonType> 74 | struct is_sax 75 | { 76 | private: 77 | static_assert(is_basic_json<BasicJsonType>::value, 78 | "BasicJsonType must be of type basic_json<...>"); 79 | 80 | using number_integer_t = typename BasicJsonType::number_integer_t; 81 | using number_unsigned_t = typename BasicJsonType::number_unsigned_t; 82 | using number_float_t = typename BasicJsonType::number_float_t; 83 | using string_t = typename BasicJsonType::string_t; 84 | using binary_t = typename BasicJsonType::binary_t; 85 | using exception_t = typename BasicJsonType::exception; 86 | 87 | public: 88 | static constexpr bool value = 89 | is_detected_exact<bool, null_function_t, SAX>::value && 90 | is_detected_exact<bool, boolean_function_t, SAX>::value && 91 | is_detected_exact<bool, number_integer_function_t, SAX, number_integer_t>::value && 92 | is_detected_exact<bool, number_unsigned_function_t, SAX, number_unsigned_t>::value && 93 | is_detected_exact<bool, number_float_function_t, SAX, number_float_t, string_t>::value && 94 | is_detected_exact<bool, string_function_t, SAX, string_t>::value && 95 | is_detected_exact<bool, binary_function_t, SAX, binary_t>::value && 96 | is_detected_exact<bool, start_object_function_t, SAX>::value && 97 | is_detected_exact<bool, key_function_t, SAX, string_t>::value && 98 | is_detected_exact<bool, end_object_function_t, SAX>::value && 99 | is_detected_exact<bool, start_array_function_t, SAX>::value && 100 | is_detected_exact<bool, end_array_function_t, SAX>::value && 101 | is_detected_exact<bool, parse_error_function_t, SAX, exception_t>::value; 102 | }; 103 | 104 | template<typename SAX, typename BasicJsonType> 105 | struct is_sax_static_asserts 106 | { 107 | private: 108 | static_assert(is_basic_json<BasicJsonType>::value, 109 | "BasicJsonType must be of type basic_json<...>"); 110 | 111 | using number_integer_t = typename BasicJsonType::number_integer_t; 112 | using number_unsigned_t = typename BasicJsonType::number_unsigned_t; 113 | using number_float_t = typename BasicJsonType::number_float_t; 114 | using string_t = typename BasicJsonType::string_t; 115 | using binary_t = typename BasicJsonType::binary_t; 116 | using exception_t = typename BasicJsonType::exception; 117 | 118 | public: 119 | static_assert(is_detected_exact<bool, null_function_t, SAX>::value, 120 | "Missing/invalid function: bool null()"); 121 | static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value, 122 | "Missing/invalid function: bool boolean(bool)"); 123 | static_assert(is_detected_exact<bool, boolean_function_t, SAX>::value, 124 | "Missing/invalid function: bool boolean(bool)"); 125 | static_assert( 126 | is_detected_exact<bool, number_integer_function_t, SAX, 127 | number_integer_t>::value, 128 | "Missing/invalid function: bool number_integer(number_integer_t)"); 129 | static_assert( 130 | is_detected_exact<bool, number_unsigned_function_t, SAX, 131 | number_unsigned_t>::value, 132 | "Missing/invalid function: bool number_unsigned(number_unsigned_t)"); 133 | static_assert(is_detected_exact<bool, number_float_function_t, SAX, 134 | number_float_t, string_t>::value, 135 | "Missing/invalid function: bool number_float(number_float_t, const string_t&)"); 136 | static_assert( 137 | is_detected_exact<bool, string_function_t, SAX, string_t>::value, 138 | "Missing/invalid function: bool string(string_t&)"); 139 | static_assert( 140 | is_detected_exact<bool, binary_function_t, SAX, binary_t>::value, 141 | "Missing/invalid function: bool binary(binary_t&)"); 142 | static_assert(is_detected_exact<bool, start_object_function_t, SAX>::value, 143 | "Missing/invalid function: bool start_object(std::size_t)"); 144 | static_assert(is_detected_exact<bool, key_function_t, SAX, string_t>::value, 145 | "Missing/invalid function: bool key(string_t&)"); 146 | static_assert(is_detected_exact<bool, end_object_function_t, SAX>::value, 147 | "Missing/invalid function: bool end_object()"); 148 | static_assert(is_detected_exact<bool, start_array_function_t, SAX>::value, 149 | "Missing/invalid function: bool start_array(std::size_t)"); 150 | static_assert(is_detected_exact<bool, end_array_function_t, SAX>::value, 151 | "Missing/invalid function: bool end_array()"); 152 | static_assert( 153 | is_detected_exact<bool, parse_error_function_t, SAX, exception_t>::value, 154 | "Missing/invalid function: bool parse_error(std::size_t, const " 155 | "std::string&, const exception&)"); 156 | }; 157 | 158 | } // namespace detail 159 | NLOHMANN_JSON_NAMESPACE_END 160 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/nlohmann/detail/iterators/iteration_proxy.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <cstddef> // size_t 12 | #include <iterator> // input_iterator_tag 13 | #include <string> // string, to_string 14 | #include <tuple> // tuple_size, get, tuple_element 15 | #include <utility> // move 16 | 17 | #if JSON_HAS_RANGES 18 | #include <ranges> // enable_borrowed_range 19 | #endif 20 | 21 | #include <nlohmann/detail/abi_macros.hpp> 22 | #include <nlohmann/detail/meta/type_traits.hpp> 23 | #include <nlohmann/detail/value_t.hpp> 24 | 25 | NLOHMANN_JSON_NAMESPACE_BEGIN 26 | namespace detail 27 | { 28 | 29 | template<typename string_type> 30 | void int_to_string( string_type& target, std::size_t value ) 31 | { 32 | // For ADL 33 | using std::to_string; 34 | target = to_string(value); 35 | } 36 | template<typename IteratorType> class iteration_proxy_value 37 | { 38 | public: 39 | using difference_type = std::ptrdiff_t; 40 | using value_type = iteration_proxy_value; 41 | using pointer = value_type *; 42 | using reference = value_type &; 43 | using iterator_category = std::input_iterator_tag; 44 | using string_type = typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type; 45 | 46 | private: 47 | /// the iterator 48 | IteratorType anchor{}; 49 | /// an index for arrays (used to create key names) 50 | std::size_t array_index = 0; 51 | /// last stringified array index 52 | mutable std::size_t array_index_last = 0; 53 | /// a string representation of the array index 54 | mutable string_type array_index_str = "0"; 55 | /// an empty string (to return a reference for primitive values) 56 | string_type empty_str{}; 57 | 58 | public: 59 | explicit iteration_proxy_value() = default; 60 | explicit iteration_proxy_value(IteratorType it, std::size_t array_index_ = 0) 61 | noexcept(std::is_nothrow_move_constructible<IteratorType>::value 62 | && std::is_nothrow_default_constructible<string_type>::value) 63 | : anchor(std::move(it)) 64 | , array_index(array_index_) 65 | {} 66 | 67 | iteration_proxy_value(iteration_proxy_value const&) = default; 68 | iteration_proxy_value& operator=(iteration_proxy_value const&) = default; 69 | // older GCCs are a bit fussy and require explicit noexcept specifiers on defaulted functions 70 | iteration_proxy_value(iteration_proxy_value&&) 71 | noexcept(std::is_nothrow_move_constructible<IteratorType>::value 72 | && std::is_nothrow_move_constructible<string_type>::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor,cppcoreguidelines-noexcept-move-operations) 73 | iteration_proxy_value& operator=(iteration_proxy_value&&) 74 | noexcept(std::is_nothrow_move_assignable<IteratorType>::value 75 | && std::is_nothrow_move_assignable<string_type>::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor,cppcoreguidelines-noexcept-move-operations) 76 | ~iteration_proxy_value() = default; 77 | 78 | /// dereference operator (needed for range-based for) 79 | const iteration_proxy_value& operator*() const 80 | { 81 | return *this; 82 | } 83 | 84 | /// increment operator (needed for range-based for) 85 | iteration_proxy_value& operator++() 86 | { 87 | ++anchor; 88 | ++array_index; 89 | 90 | return *this; 91 | } 92 | 93 | iteration_proxy_value operator++(int)& // NOLINT(cert-dcl21-cpp) 94 | { 95 | auto tmp = iteration_proxy_value(anchor, array_index); 96 | ++anchor; 97 | ++array_index; 98 | return tmp; 99 | } 100 | 101 | /// equality operator (needed for InputIterator) 102 | bool operator==(const iteration_proxy_value& o) const 103 | { 104 | return anchor == o.anchor; 105 | } 106 | 107 | /// inequality operator (needed for range-based for) 108 | bool operator!=(const iteration_proxy_value& o) const 109 | { 110 | return anchor != o.anchor; 111 | } 112 | 113 | /// return key of the iterator 114 | const string_type& key() const 115 | { 116 | JSON_ASSERT(anchor.m_object != nullptr); 117 | 118 | switch (anchor.m_object->type()) 119 | { 120 | // use integer array index as key 121 | case value_t::array: 122 | { 123 | if (array_index != array_index_last) 124 | { 125 | int_to_string( array_index_str, array_index ); 126 | array_index_last = array_index; 127 | } 128 | return array_index_str; 129 | } 130 | 131 | // use key from the object 132 | case value_t::object: 133 | return anchor.key(); 134 | 135 | // use an empty key for all primitive types 136 | case value_t::null: 137 | case value_t::string: 138 | case value_t::boolean: 139 | case value_t::number_integer: 140 | case value_t::number_unsigned: 141 | case value_t::number_float: 142 | case value_t::binary: 143 | case value_t::discarded: 144 | default: 145 | return empty_str; 146 | } 147 | } 148 | 149 | /// return value of the iterator 150 | typename IteratorType::reference value() const 151 | { 152 | return anchor.value(); 153 | } 154 | }; 155 | 156 | /// proxy class for the items() function 157 | template<typename IteratorType> class iteration_proxy 158 | { 159 | private: 160 | /// the container to iterate 161 | typename IteratorType::pointer container = nullptr; 162 | 163 | public: 164 | explicit iteration_proxy() = default; 165 | 166 | /// construct iteration proxy from a container 167 | explicit iteration_proxy(typename IteratorType::reference cont) noexcept 168 | : container(&cont) {} 169 | 170 | iteration_proxy(iteration_proxy const&) = default; 171 | iteration_proxy& operator=(iteration_proxy const&) = default; 172 | iteration_proxy(iteration_proxy&&) noexcept = default; 173 | iteration_proxy& operator=(iteration_proxy&&) noexcept = default; 174 | ~iteration_proxy() = default; 175 | 176 | /// return iterator begin (needed for range-based for) 177 | iteration_proxy_value<IteratorType> begin() const noexcept 178 | { 179 | return iteration_proxy_value<IteratorType>(container->begin()); 180 | } 181 | 182 | /// return iterator end (needed for range-based for) 183 | iteration_proxy_value<IteratorType> end() const noexcept 184 | { 185 | return iteration_proxy_value<IteratorType>(container->end()); 186 | } 187 | }; 188 | 189 | // Structured Bindings Support 190 | // For further reference see https://blog.tartanllama.xyz/structured-bindings/ 191 | // And see https://github.com/nlohmann/json/pull/1391 192 | template<std::size_t N, typename IteratorType, enable_if_t<N == 0, int> = 0> 193 | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.key()) 194 | { 195 | return i.key(); 196 | } 197 | // Structured Bindings Support 198 | // For further reference see https://blog.tartanllama.xyz/structured-bindings/ 199 | // And see https://github.com/nlohmann/json/pull/1391 200 | template<std::size_t N, typename IteratorType, enable_if_t<N == 1, int> = 0> 201 | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.value()) 202 | { 203 | return i.value(); 204 | } 205 | 206 | } // namespace detail 207 | NLOHMANN_JSON_NAMESPACE_END 208 | 209 | // The Addition to the STD Namespace is required to add 210 | // Structured Bindings Support to the iteration_proxy_value class 211 | // For further reference see https://blog.tartanllama.xyz/structured-bindings/ 212 | // And see https://github.com/nlohmann/json/pull/1391 213 | namespace std 214 | { 215 | 216 | #if defined(__clang__) 217 | // Fix: https://github.com/nlohmann/json/issues/1401 218 | #pragma clang diagnostic push 219 | #pragma clang diagnostic ignored "-Wmismatched-tags" 220 | #endif 221 | template<typename IteratorType> 222 | class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>> // NOLINT(cert-dcl58-cpp) 223 | : public std::integral_constant<std::size_t, 2> {}; 224 | 225 | template<std::size_t N, typename IteratorType> 226 | class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >> // NOLINT(cert-dcl58-cpp) 227 | { 228 | public: 229 | using type = decltype( 230 | get<N>(std::declval < 231 | ::nlohmann::detail::iteration_proxy_value<IteratorType >> ())); 232 | }; 233 | #if defined(__clang__) 234 | #pragma clang diagnostic pop 235 | #endif 236 | 237 | } // namespace std 238 | 239 | #if JSON_HAS_RANGES 240 | template <typename IteratorType> 241 | inline constexpr bool ::std::ranges::enable_borrowed_range<::nlohmann::detail::iteration_proxy<IteratorType>> = true; 242 | #endif 243 | ``` -------------------------------------------------------------------------------- /include/nlohmann/detail/iterators/iteration_proxy.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <cstddef> // size_t 12 | #include <iterator> // input_iterator_tag 13 | #include <string> // string, to_string 14 | #include <tuple> // tuple_size, get, tuple_element 15 | #include <utility> // move 16 | 17 | #if JSON_HAS_RANGES 18 | #include <ranges> // enable_borrowed_range 19 | #endif 20 | 21 | #include <nlohmann/detail/abi_macros.hpp> 22 | #include <nlohmann/detail/meta/type_traits.hpp> 23 | #include <nlohmann/detail/value_t.hpp> 24 | 25 | NLOHMANN_JSON_NAMESPACE_BEGIN 26 | namespace detail 27 | { 28 | 29 | template<typename string_type> 30 | void int_to_string( string_type& target, std::size_t value ) 31 | { 32 | // For ADL 33 | using std::to_string; 34 | target = to_string(value); 35 | } 36 | template<typename IteratorType> class iteration_proxy_value 37 | { 38 | public: 39 | using difference_type = std::ptrdiff_t; 40 | using value_type = iteration_proxy_value; 41 | using pointer = value_type *; 42 | using reference = value_type &; 43 | using iterator_category = std::input_iterator_tag; 44 | using string_type = typename std::remove_cv< typename std::remove_reference<decltype( std::declval<IteratorType>().key() ) >::type >::type; 45 | 46 | private: 47 | /// the iterator 48 | IteratorType anchor{}; 49 | /// an index for arrays (used to create key names) 50 | std::size_t array_index = 0; 51 | /// last stringified array index 52 | mutable std::size_t array_index_last = 0; 53 | /// a string representation of the array index 54 | mutable string_type array_index_str = "0"; 55 | /// an empty string (to return a reference for primitive values) 56 | string_type empty_str{}; 57 | 58 | public: 59 | explicit iteration_proxy_value() = default; 60 | explicit iteration_proxy_value(IteratorType it, std::size_t array_index_ = 0) 61 | noexcept(std::is_nothrow_move_constructible<IteratorType>::value 62 | && std::is_nothrow_default_constructible<string_type>::value) 63 | : anchor(std::move(it)) 64 | , array_index(array_index_) 65 | {} 66 | 67 | iteration_proxy_value(iteration_proxy_value const&) = default; 68 | iteration_proxy_value& operator=(iteration_proxy_value const&) = default; 69 | // older GCCs are a bit fussy and require explicit noexcept specifiers on defaulted functions 70 | iteration_proxy_value(iteration_proxy_value&&) 71 | noexcept(std::is_nothrow_move_constructible<IteratorType>::value 72 | && std::is_nothrow_move_constructible<string_type>::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor,cppcoreguidelines-noexcept-move-operations) 73 | iteration_proxy_value& operator=(iteration_proxy_value&&) 74 | noexcept(std::is_nothrow_move_assignable<IteratorType>::value 75 | && std::is_nothrow_move_assignable<string_type>::value) = default; // NOLINT(hicpp-noexcept-move,performance-noexcept-move-constructor,cppcoreguidelines-noexcept-move-operations) 76 | ~iteration_proxy_value() = default; 77 | 78 | /// dereference operator (needed for range-based for) 79 | const iteration_proxy_value& operator*() const 80 | { 81 | return *this; 82 | } 83 | 84 | /// increment operator (needed for range-based for) 85 | iteration_proxy_value& operator++() 86 | { 87 | ++anchor; 88 | ++array_index; 89 | 90 | return *this; 91 | } 92 | 93 | iteration_proxy_value operator++(int)& // NOLINT(cert-dcl21-cpp) 94 | { 95 | auto tmp = iteration_proxy_value(anchor, array_index); 96 | ++anchor; 97 | ++array_index; 98 | return tmp; 99 | } 100 | 101 | /// equality operator (needed for InputIterator) 102 | bool operator==(const iteration_proxy_value& o) const 103 | { 104 | return anchor == o.anchor; 105 | } 106 | 107 | /// inequality operator (needed for range-based for) 108 | bool operator!=(const iteration_proxy_value& o) const 109 | { 110 | return anchor != o.anchor; 111 | } 112 | 113 | /// return key of the iterator 114 | const string_type& key() const 115 | { 116 | JSON_ASSERT(anchor.m_object != nullptr); 117 | 118 | switch (anchor.m_object->type()) 119 | { 120 | // use integer array index as key 121 | case value_t::array: 122 | { 123 | if (array_index != array_index_last) 124 | { 125 | int_to_string( array_index_str, array_index ); 126 | array_index_last = array_index; 127 | } 128 | return array_index_str; 129 | } 130 | 131 | // use key from the object 132 | case value_t::object: 133 | return anchor.key(); 134 | 135 | // use an empty key for all primitive types 136 | case value_t::null: 137 | case value_t::string: 138 | case value_t::boolean: 139 | case value_t::number_integer: 140 | case value_t::number_unsigned: 141 | case value_t::number_float: 142 | case value_t::binary: 143 | case value_t::discarded: 144 | default: 145 | return empty_str; 146 | } 147 | } 148 | 149 | /// return value of the iterator 150 | typename IteratorType::reference value() const 151 | { 152 | return anchor.value(); 153 | } 154 | }; 155 | 156 | /// proxy class for the items() function 157 | template<typename IteratorType> class iteration_proxy 158 | { 159 | private: 160 | /// the container to iterate 161 | typename IteratorType::pointer container = nullptr; 162 | 163 | public: 164 | explicit iteration_proxy() = default; 165 | 166 | /// construct iteration proxy from a container 167 | explicit iteration_proxy(typename IteratorType::reference cont) noexcept 168 | : container(&cont) {} 169 | 170 | iteration_proxy(iteration_proxy const&) = default; 171 | iteration_proxy& operator=(iteration_proxy const&) = default; 172 | iteration_proxy(iteration_proxy&&) noexcept = default; 173 | iteration_proxy& operator=(iteration_proxy&&) noexcept = default; 174 | ~iteration_proxy() = default; 175 | 176 | /// return iterator begin (needed for range-based for) 177 | iteration_proxy_value<IteratorType> begin() const noexcept 178 | { 179 | return iteration_proxy_value<IteratorType>(container->begin()); 180 | } 181 | 182 | /// return iterator end (needed for range-based for) 183 | iteration_proxy_value<IteratorType> end() const noexcept 184 | { 185 | return iteration_proxy_value<IteratorType>(container->end()); 186 | } 187 | }; 188 | 189 | // Structured Bindings Support 190 | // For further reference see https://blog.tartanllama.xyz/structured-bindings/ 191 | // And see https://github.com/nlohmann/json/pull/1391 192 | template<std::size_t N, typename IteratorType, enable_if_t<N == 0, int> = 0> 193 | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.key()) 194 | { 195 | return i.key(); 196 | } 197 | // Structured Bindings Support 198 | // For further reference see https://blog.tartanllama.xyz/structured-bindings/ 199 | // And see https://github.com/nlohmann/json/pull/1391 200 | template<std::size_t N, typename IteratorType, enable_if_t<N == 1, int> = 0> 201 | auto get(const nlohmann::detail::iteration_proxy_value<IteratorType>& i) -> decltype(i.value()) 202 | { 203 | return i.value(); 204 | } 205 | 206 | } // namespace detail 207 | NLOHMANN_JSON_NAMESPACE_END 208 | 209 | // The Addition to the STD Namespace is required to add 210 | // Structured Bindings Support to the iteration_proxy_value class 211 | // For further reference see https://blog.tartanllama.xyz/structured-bindings/ 212 | // And see https://github.com/nlohmann/json/pull/1391 213 | namespace std 214 | { 215 | 216 | #if defined(__clang__) 217 | // Fix: https://github.com/nlohmann/json/issues/1401 218 | #pragma clang diagnostic push 219 | #pragma clang diagnostic ignored "-Wmismatched-tags" 220 | #endif 221 | template<typename IteratorType> 222 | class tuple_size<::nlohmann::detail::iteration_proxy_value<IteratorType>> // NOLINT(cert-dcl58-cpp) 223 | : public std::integral_constant<std::size_t, 2> {}; 224 | 225 | template<std::size_t N, typename IteratorType> 226 | class tuple_element<N, ::nlohmann::detail::iteration_proxy_value<IteratorType >> // NOLINT(cert-dcl58-cpp) 227 | { 228 | public: 229 | using type = decltype( 230 | get<N>(std::declval < 231 | ::nlohmann::detail::iteration_proxy_value<IteratorType >> ())); 232 | }; 233 | #if defined(__clang__) 234 | #pragma clang diagnostic pop 235 | #endif 236 | 237 | } // namespace std 238 | 239 | #if JSON_HAS_RANGES 240 | template <typename IteratorType> 241 | inline constexpr bool ::std::ranges::enable_borrowed_range<::nlohmann::detail::iteration_proxy<IteratorType>> = true; 242 | #endif 243 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/lz4/lz4hc.h: -------------------------------------------------------------------------------- ``` 1 | /* 2 | LZ4 HC - High Compression Mode of LZ4 3 | Header File 4 | Copyright (C) 2011-2014, Yann Collet. 5 | BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following disclaimer 15 | in the documentation and/or other materials provided with the 16 | distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | You can contact the author at : 31 | - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html 32 | - LZ4 source repository : http://code.google.com/p/lz4/ 33 | */ 34 | #ifndef _LZ4HC_H 35 | #define _LZ4HC_H 36 | 37 | #if defined (__cplusplus) 38 | extern "C" 39 | { 40 | #endif 41 | 42 | 43 | __declspec(dllimport) int LZ4_compressHC(const char* source, char* dest, int inputSize); 44 | /* 45 | LZ4_compressHC : 46 | return : the number of bytes in compressed buffer dest 47 | or 0 if compression fails. 48 | note : destination buffer must be already allocated. 49 | To avoid any problem, size it to handle worst cases situations (input data not compressible) 50 | Worst case size evaluation is provided by function LZ4_compressBound() (see "lz4.h") 51 | */ 52 | 53 | __declspec(dllimport) int LZ4_compressHC_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize); 54 | /* 55 | LZ4_compress_limitedOutput() : 56 | Compress 'inputSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'. 57 | If it cannot achieve it, compression will stop, and result of the function will be zero. 58 | This function never writes outside of provided output buffer. 59 | 60 | inputSize : Max supported value is 1 GB 61 | maxOutputSize : is maximum allowed size into the destination buffer (which must be already allocated) 62 | return : the number of output bytes written in buffer 'dest' 63 | or 0 if compression fails. 64 | */ 65 | 66 | 67 | __declspec(dllimport) int LZ4_compressHC2(const char* source, char* dest, int inputSize, int compressionLevel); 68 | __declspec(dllimport) int LZ4_compressHC2_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); 69 | /* 70 | Same functions as above, but with programmable 'compressionLevel'. 71 | Recommended values are between 4 and 9, although any value between 0 and 16 will work. 72 | 'compressionLevel'==0 means use default 'compressionLevel' value. 73 | Values above 16 behave the same as 16. 74 | Equivalent variants exist for all other compression functions below. 75 | */ 76 | 77 | /* Note : 78 | Decompression functions are provided within LZ4 source code (see "lz4.h") (BSD license) 79 | */ 80 | 81 | 82 | /************************************** 83 | Using an external allocation 84 | **************************************/ 85 | __declspec(dllimport) int LZ4_sizeofStateHC(void); 86 | __declspec(dllimport) int LZ4_compressHC_withStateHC(void* state, const char* source, char* dest, int inputSize); 87 | __declspec(dllimport) int LZ4_compressHC_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize); 88 | 89 | __declspec(dllimport) int LZ4_compressHC2_withStateHC(void* state, const char* source, char* dest, int inputSize, int compressionLevel); 90 | __declspec(dllimport) int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); 91 | 92 | /* 93 | These functions are provided should you prefer to allocate memory for compression tables with your own allocation methods. 94 | To know how much memory must be allocated for the compression tables, use : 95 | int LZ4_sizeofStateHC(); 96 | 97 | Note that tables must be aligned for pointer (32 or 64 bits), otherwise compression will fail (return code 0). 98 | 99 | The allocated memory can be provided to the compressions functions using 'void* state' parameter. 100 | LZ4_compress_withStateHC() and LZ4_compress_limitedOutput_withStateHC() are equivalent to previously described functions. 101 | They just use the externally allocated memory area instead of allocating their own (on stack, or on heap). 102 | */ 103 | 104 | 105 | /************************************** 106 | Streaming Functions 107 | **************************************/ 108 | __declspec(dllimport) void* LZ4_createHC(const char* inputBuffer); 109 | __declspec(dllimport) int LZ4_compressHC_continue(void* LZ4HC_Data, const char* source, char* dest, int inputSize); 110 | __declspec(dllimport) int LZ4_compressHC_limitedOutput_continue(void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize); 111 | __declspec(dllimport) char* LZ4_slideInputBufferHC(void* LZ4HC_Data); 112 | __declspec(dllimport) int LZ4_freeHC(void* LZ4HC_Data); 113 | 114 | __declspec(dllimport) int LZ4_compressHC2_continue(void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel); 115 | __declspec(dllimport) int LZ4_compressHC2_limitedOutput_continue(void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); 116 | 117 | /* 118 | These functions allow the compression of dependent blocks, where each block benefits from prior 64 KB within preceding blocks. 119 | In order to achieve this, it is necessary to start creating the LZ4HC Data Structure, thanks to the function : 120 | 121 | void* LZ4_createHC (const char* inputBuffer); 122 | The result of the function is the (void*) pointer on the LZ4HC Data Structure. 123 | This pointer will be needed in all other functions. 124 | If the pointer returned is NULL, then the allocation has failed, and compression must be aborted. 125 | The only parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer. 126 | The input buffer must be already allocated, and size at least 192KB. 127 | 'inputBuffer' will also be the 'const char* source' of the first block. 128 | 129 | All blocks are expected to lay next to each other within the input buffer, starting from 'inputBuffer'. 130 | To compress each block, use either LZ4_compressHC_continue() or LZ4_compressHC_limitedOutput_continue(). 131 | Their behavior are identical to LZ4_compressHC() or LZ4_compressHC_limitedOutput(), 132 | but require the LZ4HC Data Structure as their first argument, and check that each block starts right after the previous one. 133 | If next block does not begin immediately after the previous one, the compression will fail (return 0). 134 | 135 | When it's no longer possible to lay the next block after the previous one (not enough space left into input buffer), a call to : 136 | char* LZ4_slideInputBufferHC(void* LZ4HC_Data); 137 | must be performed. It will typically copy the latest 64KB of input at the beginning of input buffer. 138 | Note that, for this function to work properly, minimum size of an input buffer must be 192KB. 139 | ==> The memory position where the next input data block must start is provided as the result of the function. 140 | 141 | Compression can then resume, using LZ4_compressHC_continue() or LZ4_compressHC_limitedOutput_continue(), as usual. 142 | 143 | When compression is completed, a call to LZ4_freeHC() will release the memory used by the LZ4HC Data Structure. 144 | */ 145 | 146 | __declspec(dllimport) int LZ4_sizeofStreamStateHC(void); 147 | __declspec(dllimport) int LZ4_resetStreamStateHC(void* state, const char* inputBuffer); 148 | 149 | /* 150 | These functions achieve the same result as : 151 | void* LZ4_createHC (const char* inputBuffer); 152 | 153 | They are provided here to allow the user program to allocate memory using its own routines. 154 | 155 | To know how much space must be allocated, use LZ4_sizeofStreamStateHC(); 156 | Note also that space must be aligned for pointers (32 or 64 bits). 157 | 158 | Once space is allocated, you must initialize it using : LZ4_resetStreamStateHC(void* state, const char* inputBuffer); 159 | void* state is a pointer to the space allocated. 160 | It must be aligned for pointers (32 or 64 bits), and be large enough. 161 | The parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer. 162 | The input buffer must be already allocated, and size at least 192KB. 163 | 'inputBuffer' will also be the 'const char* source' of the first block. 164 | 165 | The same space can be re-used multiple times, just by initializing it each time with LZ4_resetStreamState(). 166 | return value of LZ4_resetStreamStateHC() must be 0 is OK. 167 | Any other value means there was an error (typically, state is not aligned for pointers (32 or 64 bits)). 168 | */ 169 | 170 | 171 | #if defined (__cplusplus) 172 | } 173 | #endif 174 | 175 | #endif //_LZ4HC_H 176 | ``` -------------------------------------------------------------------------------- /deps/x64dbg_sdk/pluginsdk/lz4/lz4hc.h: -------------------------------------------------------------------------------- ``` 1 | /* 2 | LZ4 HC - High Compression Mode of LZ4 3 | Header File 4 | Copyright (C) 2011-2014, Yann Collet. 5 | BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | * Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | * Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following disclaimer 15 | in the documentation and/or other materials provided with the 16 | distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | You can contact the author at : 31 | - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html 32 | - LZ4 source repository : http://code.google.com/p/lz4/ 33 | */ 34 | #ifndef _LZ4HC_H 35 | #define _LZ4HC_H 36 | 37 | #if defined (__cplusplus) 38 | extern "C" 39 | { 40 | #endif 41 | 42 | 43 | __declspec(dllimport) int LZ4_compressHC(const char* source, char* dest, int inputSize); 44 | /* 45 | LZ4_compressHC : 46 | return : the number of bytes in compressed buffer dest 47 | or 0 if compression fails. 48 | note : destination buffer must be already allocated. 49 | To avoid any problem, size it to handle worst cases situations (input data not compressible) 50 | Worst case size evaluation is provided by function LZ4_compressBound() (see "lz4.h") 51 | */ 52 | 53 | __declspec(dllimport) int LZ4_compressHC_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize); 54 | /* 55 | LZ4_compress_limitedOutput() : 56 | Compress 'inputSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'. 57 | If it cannot achieve it, compression will stop, and result of the function will be zero. 58 | This function never writes outside of provided output buffer. 59 | 60 | inputSize : Max supported value is 1 GB 61 | maxOutputSize : is maximum allowed size into the destination buffer (which must be already allocated) 62 | return : the number of output bytes written in buffer 'dest' 63 | or 0 if compression fails. 64 | */ 65 | 66 | 67 | __declspec(dllimport) int LZ4_compressHC2(const char* source, char* dest, int inputSize, int compressionLevel); 68 | __declspec(dllimport) int LZ4_compressHC2_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); 69 | /* 70 | Same functions as above, but with programmable 'compressionLevel'. 71 | Recommended values are between 4 and 9, although any value between 0 and 16 will work. 72 | 'compressionLevel'==0 means use default 'compressionLevel' value. 73 | Values above 16 behave the same as 16. 74 | Equivalent variants exist for all other compression functions below. 75 | */ 76 | 77 | /* Note : 78 | Decompression functions are provided within LZ4 source code (see "lz4.h") (BSD license) 79 | */ 80 | 81 | 82 | /************************************** 83 | Using an external allocation 84 | **************************************/ 85 | __declspec(dllimport) int LZ4_sizeofStateHC(void); 86 | __declspec(dllimport) int LZ4_compressHC_withStateHC(void* state, const char* source, char* dest, int inputSize); 87 | __declspec(dllimport) int LZ4_compressHC_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize); 88 | 89 | __declspec(dllimport) int LZ4_compressHC2_withStateHC(void* state, const char* source, char* dest, int inputSize, int compressionLevel); 90 | __declspec(dllimport) int LZ4_compressHC2_limitedOutput_withStateHC(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); 91 | 92 | /* 93 | These functions are provided should you prefer to allocate memory for compression tables with your own allocation methods. 94 | To know how much memory must be allocated for the compression tables, use : 95 | int LZ4_sizeofStateHC(); 96 | 97 | Note that tables must be aligned for pointer (32 or 64 bits), otherwise compression will fail (return code 0). 98 | 99 | The allocated memory can be provided to the compressions functions using 'void* state' parameter. 100 | LZ4_compress_withStateHC() and LZ4_compress_limitedOutput_withStateHC() are equivalent to previously described functions. 101 | They just use the externally allocated memory area instead of allocating their own (on stack, or on heap). 102 | */ 103 | 104 | 105 | /************************************** 106 | Streaming Functions 107 | **************************************/ 108 | __declspec(dllimport) void* LZ4_createHC(const char* inputBuffer); 109 | __declspec(dllimport) int LZ4_compressHC_continue(void* LZ4HC_Data, const char* source, char* dest, int inputSize); 110 | __declspec(dllimport) int LZ4_compressHC_limitedOutput_continue(void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize); 111 | __declspec(dllimport) char* LZ4_slideInputBufferHC(void* LZ4HC_Data); 112 | __declspec(dllimport) int LZ4_freeHC(void* LZ4HC_Data); 113 | 114 | __declspec(dllimport) int LZ4_compressHC2_continue(void* LZ4HC_Data, const char* source, char* dest, int inputSize, int compressionLevel); 115 | __declspec(dllimport) int LZ4_compressHC2_limitedOutput_continue(void* LZ4HC_Data, const char* source, char* dest, int inputSize, int maxOutputSize, int compressionLevel); 116 | 117 | /* 118 | These functions allow the compression of dependent blocks, where each block benefits from prior 64 KB within preceding blocks. 119 | In order to achieve this, it is necessary to start creating the LZ4HC Data Structure, thanks to the function : 120 | 121 | void* LZ4_createHC (const char* inputBuffer); 122 | The result of the function is the (void*) pointer on the LZ4HC Data Structure. 123 | This pointer will be needed in all other functions. 124 | If the pointer returned is NULL, then the allocation has failed, and compression must be aborted. 125 | The only parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer. 126 | The input buffer must be already allocated, and size at least 192KB. 127 | 'inputBuffer' will also be the 'const char* source' of the first block. 128 | 129 | All blocks are expected to lay next to each other within the input buffer, starting from 'inputBuffer'. 130 | To compress each block, use either LZ4_compressHC_continue() or LZ4_compressHC_limitedOutput_continue(). 131 | Their behavior are identical to LZ4_compressHC() or LZ4_compressHC_limitedOutput(), 132 | but require the LZ4HC Data Structure as their first argument, and check that each block starts right after the previous one. 133 | If next block does not begin immediately after the previous one, the compression will fail (return 0). 134 | 135 | When it's no longer possible to lay the next block after the previous one (not enough space left into input buffer), a call to : 136 | char* LZ4_slideInputBufferHC(void* LZ4HC_Data); 137 | must be performed. It will typically copy the latest 64KB of input at the beginning of input buffer. 138 | Note that, for this function to work properly, minimum size of an input buffer must be 192KB. 139 | ==> The memory position where the next input data block must start is provided as the result of the function. 140 | 141 | Compression can then resume, using LZ4_compressHC_continue() or LZ4_compressHC_limitedOutput_continue(), as usual. 142 | 143 | When compression is completed, a call to LZ4_freeHC() will release the memory used by the LZ4HC Data Structure. 144 | */ 145 | 146 | __declspec(dllimport) int LZ4_sizeofStreamStateHC(void); 147 | __declspec(dllimport) int LZ4_resetStreamStateHC(void* state, const char* inputBuffer); 148 | 149 | /* 150 | These functions achieve the same result as : 151 | void* LZ4_createHC (const char* inputBuffer); 152 | 153 | They are provided here to allow the user program to allocate memory using its own routines. 154 | 155 | To know how much space must be allocated, use LZ4_sizeofStreamStateHC(); 156 | Note also that space must be aligned for pointers (32 or 64 bits). 157 | 158 | Once space is allocated, you must initialize it using : LZ4_resetStreamStateHC(void* state, const char* inputBuffer); 159 | void* state is a pointer to the space allocated. 160 | It must be aligned for pointers (32 or 64 bits), and be large enough. 161 | The parameter 'const char* inputBuffer' must, obviously, point at the beginning of input buffer. 162 | The input buffer must be already allocated, and size at least 192KB. 163 | 'inputBuffer' will also be the 'const char* source' of the first block. 164 | 165 | The same space can be re-used multiple times, just by initializing it each time with LZ4_resetStreamState(). 166 | return value of LZ4_resetStreamStateHC() must be 0 is OK. 167 | Any other value means there was an error (typically, state is not aligned for pointers (32 or 64 bits)). 168 | */ 169 | 170 | 171 | #if defined (__cplusplus) 172 | } 173 | #endif 174 | 175 | #endif //_LZ4HC_H 176 | ``` -------------------------------------------------------------------------------- /deps/pluginsdk/nlohmann/detail/exceptions.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <cstddef> // nullptr_t 12 | #include <exception> // exception 13 | #if JSON_DIAGNOSTICS 14 | #include <numeric> // accumulate 15 | #endif 16 | #include <stdexcept> // runtime_error 17 | #include <string> // to_string 18 | #include <vector> // vector 19 | 20 | #include <nlohmann/detail/value_t.hpp> 21 | #include <nlohmann/detail/string_escape.hpp> 22 | #include <nlohmann/detail/input/position_t.hpp> 23 | #include <nlohmann/detail/macro_scope.hpp> 24 | #include <nlohmann/detail/meta/cpp_future.hpp> 25 | #include <nlohmann/detail/meta/type_traits.hpp> 26 | #include <nlohmann/detail/string_concat.hpp> 27 | 28 | NLOHMANN_JSON_NAMESPACE_BEGIN 29 | namespace detail 30 | { 31 | 32 | //////////////// 33 | // exceptions // 34 | //////////////// 35 | 36 | /// @brief general exception of the @ref basic_json class 37 | /// @sa https://json.nlohmann.me/api/basic_json/exception/ 38 | class exception : public std::exception 39 | { 40 | public: 41 | /// returns the explanatory string 42 | const char* what() const noexcept override 43 | { 44 | return m.what(); 45 | } 46 | 47 | /// the id of the exception 48 | const int id; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes) 49 | 50 | protected: 51 | JSON_HEDLEY_NON_NULL(3) 52 | exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} // NOLINT(bugprone-throw-keyword-missing) 53 | 54 | static std::string name(const std::string& ename, int id_) 55 | { 56 | return concat("[json.exception.", ename, '.', std::to_string(id_), "] "); 57 | } 58 | 59 | static std::string diagnostics(std::nullptr_t /*leaf_element*/) 60 | { 61 | return ""; 62 | } 63 | 64 | template<typename BasicJsonType> 65 | static std::string diagnostics(const BasicJsonType* leaf_element) 66 | { 67 | #if JSON_DIAGNOSTICS 68 | std::vector<std::string> tokens; 69 | for (const auto* current = leaf_element; current != nullptr && current->m_parent != nullptr; current = current->m_parent) 70 | { 71 | switch (current->m_parent->type()) 72 | { 73 | case value_t::array: 74 | { 75 | for (std::size_t i = 0; i < current->m_parent->m_data.m_value.array->size(); ++i) 76 | { 77 | if (¤t->m_parent->m_data.m_value.array->operator[](i) == current) 78 | { 79 | tokens.emplace_back(std::to_string(i)); 80 | break; 81 | } 82 | } 83 | break; 84 | } 85 | 86 | case value_t::object: 87 | { 88 | for (const auto& element : *current->m_parent->m_data.m_value.object) 89 | { 90 | if (&element.second == current) 91 | { 92 | tokens.emplace_back(element.first.c_str()); 93 | break; 94 | } 95 | } 96 | break; 97 | } 98 | 99 | case value_t::null: // LCOV_EXCL_LINE 100 | case value_t::string: // LCOV_EXCL_LINE 101 | case value_t::boolean: // LCOV_EXCL_LINE 102 | case value_t::number_integer: // LCOV_EXCL_LINE 103 | case value_t::number_unsigned: // LCOV_EXCL_LINE 104 | case value_t::number_float: // LCOV_EXCL_LINE 105 | case value_t::binary: // LCOV_EXCL_LINE 106 | case value_t::discarded: // LCOV_EXCL_LINE 107 | default: // LCOV_EXCL_LINE 108 | break; // LCOV_EXCL_LINE 109 | } 110 | } 111 | 112 | if (tokens.empty()) 113 | { 114 | return ""; 115 | } 116 | 117 | auto str = std::accumulate(tokens.rbegin(), tokens.rend(), std::string{}, 118 | [](const std::string & a, const std::string & b) 119 | { 120 | return concat(a, '/', detail::escape(b)); 121 | }); 122 | return concat('(', str, ") "); 123 | #else 124 | static_cast<void>(leaf_element); 125 | return ""; 126 | #endif 127 | } 128 | 129 | private: 130 | /// an exception object as storage for error messages 131 | std::runtime_error m; 132 | }; 133 | 134 | /// @brief exception indicating a parse error 135 | /// @sa https://json.nlohmann.me/api/basic_json/parse_error/ 136 | class parse_error : public exception 137 | { 138 | public: 139 | /*! 140 | @brief create a parse error exception 141 | @param[in] id_ the id of the exception 142 | @param[in] pos the position where the error occurred (or with 143 | chars_read_total=0 if the position cannot be 144 | determined) 145 | @param[in] what_arg the explanatory string 146 | @return parse_error object 147 | */ 148 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 149 | static parse_error create(int id_, const position_t& pos, const std::string& what_arg, BasicJsonContext context) 150 | { 151 | const std::string w = concat(exception::name("parse_error", id_), "parse error", 152 | position_string(pos), ": ", exception::diagnostics(context), what_arg); 153 | return {id_, pos.chars_read_total, w.c_str()}; 154 | } 155 | 156 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 157 | static parse_error create(int id_, std::size_t byte_, const std::string& what_arg, BasicJsonContext context) 158 | { 159 | const std::string w = concat(exception::name("parse_error", id_), "parse error", 160 | (byte_ != 0 ? (concat(" at byte ", std::to_string(byte_))) : ""), 161 | ": ", exception::diagnostics(context), what_arg); 162 | return {id_, byte_, w.c_str()}; 163 | } 164 | 165 | /*! 166 | @brief byte index of the parse error 167 | 168 | The byte index of the last read character in the input file. 169 | 170 | @note For an input with n bytes, 1 is the index of the first character and 171 | n+1 is the index of the terminating null byte or the end of file. 172 | This also holds true when reading a byte vector (CBOR or MessagePack). 173 | */ 174 | const std::size_t byte; 175 | 176 | private: 177 | parse_error(int id_, std::size_t byte_, const char* what_arg) 178 | : exception(id_, what_arg), byte(byte_) {} 179 | 180 | static std::string position_string(const position_t& pos) 181 | { 182 | return concat(" at line ", std::to_string(pos.lines_read + 1), 183 | ", column ", std::to_string(pos.chars_read_current_line)); 184 | } 185 | }; 186 | 187 | /// @brief exception indicating errors with iterators 188 | /// @sa https://json.nlohmann.me/api/basic_json/invalid_iterator/ 189 | class invalid_iterator : public exception 190 | { 191 | public: 192 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 193 | static invalid_iterator create(int id_, const std::string& what_arg, BasicJsonContext context) 194 | { 195 | const std::string w = concat(exception::name("invalid_iterator", id_), exception::diagnostics(context), what_arg); 196 | return {id_, w.c_str()}; 197 | } 198 | 199 | private: 200 | JSON_HEDLEY_NON_NULL(3) 201 | invalid_iterator(int id_, const char* what_arg) 202 | : exception(id_, what_arg) {} 203 | }; 204 | 205 | /// @brief exception indicating executing a member function with a wrong type 206 | /// @sa https://json.nlohmann.me/api/basic_json/type_error/ 207 | class type_error : public exception 208 | { 209 | public: 210 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 211 | static type_error create(int id_, const std::string& what_arg, BasicJsonContext context) 212 | { 213 | const std::string w = concat(exception::name("type_error", id_), exception::diagnostics(context), what_arg); 214 | return {id_, w.c_str()}; 215 | } 216 | 217 | private: 218 | JSON_HEDLEY_NON_NULL(3) 219 | type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} 220 | }; 221 | 222 | /// @brief exception indicating access out of the defined range 223 | /// @sa https://json.nlohmann.me/api/basic_json/out_of_range/ 224 | class out_of_range : public exception 225 | { 226 | public: 227 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 228 | static out_of_range create(int id_, const std::string& what_arg, BasicJsonContext context) 229 | { 230 | const std::string w = concat(exception::name("out_of_range", id_), exception::diagnostics(context), what_arg); 231 | return {id_, w.c_str()}; 232 | } 233 | 234 | private: 235 | JSON_HEDLEY_NON_NULL(3) 236 | out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} 237 | }; 238 | 239 | /// @brief exception indicating other library errors 240 | /// @sa https://json.nlohmann.me/api/basic_json/other_error/ 241 | class other_error : public exception 242 | { 243 | public: 244 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 245 | static other_error create(int id_, const std::string& what_arg, BasicJsonContext context) 246 | { 247 | const std::string w = concat(exception::name("other_error", id_), exception::diagnostics(context), what_arg); 248 | return {id_, w.c_str()}; 249 | } 250 | 251 | private: 252 | JSON_HEDLEY_NON_NULL(3) 253 | other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} 254 | }; 255 | 256 | } // namespace detail 257 | NLOHMANN_JSON_NAMESPACE_END 258 | ``` -------------------------------------------------------------------------------- /include/nlohmann/detail/exceptions.hpp: -------------------------------------------------------------------------------- ``` 1 | // __ _____ _____ _____ 2 | // __| | __| | | | JSON for Modern C++ 3 | // | | |__ | | | | | | version 3.11.3 4 | // |_____|_____|_____|_|___| https://github.com/nlohmann/json 5 | // 6 | // SPDX-FileCopyrightText: 2013-2023 Niels Lohmann <https://nlohmann.me> 7 | // SPDX-License-Identifier: MIT 8 | 9 | #pragma once 10 | 11 | #include <cstddef> // nullptr_t 12 | #include <exception> // exception 13 | #if JSON_DIAGNOSTICS 14 | #include <numeric> // accumulate 15 | #endif 16 | #include <stdexcept> // runtime_error 17 | #include <string> // to_string 18 | #include <vector> // vector 19 | 20 | #include <nlohmann/detail/value_t.hpp> 21 | #include <nlohmann/detail/string_escape.hpp> 22 | #include <nlohmann/detail/input/position_t.hpp> 23 | #include <nlohmann/detail/macro_scope.hpp> 24 | #include <nlohmann/detail/meta/cpp_future.hpp> 25 | #include <nlohmann/detail/meta/type_traits.hpp> 26 | #include <nlohmann/detail/string_concat.hpp> 27 | 28 | NLOHMANN_JSON_NAMESPACE_BEGIN 29 | namespace detail 30 | { 31 | 32 | //////////////// 33 | // exceptions // 34 | //////////////// 35 | 36 | /// @brief general exception of the @ref basic_json class 37 | /// @sa https://json.nlohmann.me/api/basic_json/exception/ 38 | class exception : public std::exception 39 | { 40 | public: 41 | /// returns the explanatory string 42 | const char* what() const noexcept override 43 | { 44 | return m.what(); 45 | } 46 | 47 | /// the id of the exception 48 | const int id; // NOLINT(cppcoreguidelines-non-private-member-variables-in-classes) 49 | 50 | protected: 51 | JSON_HEDLEY_NON_NULL(3) 52 | exception(int id_, const char* what_arg) : id(id_), m(what_arg) {} // NOLINT(bugprone-throw-keyword-missing) 53 | 54 | static std::string name(const std::string& ename, int id_) 55 | { 56 | return concat("[json.exception.", ename, '.', std::to_string(id_), "] "); 57 | } 58 | 59 | static std::string diagnostics(std::nullptr_t /*leaf_element*/) 60 | { 61 | return ""; 62 | } 63 | 64 | template<typename BasicJsonType> 65 | static std::string diagnostics(const BasicJsonType* leaf_element) 66 | { 67 | #if JSON_DIAGNOSTICS 68 | std::vector<std::string> tokens; 69 | for (const auto* current = leaf_element; current != nullptr && current->m_parent != nullptr; current = current->m_parent) 70 | { 71 | switch (current->m_parent->type()) 72 | { 73 | case value_t::array: 74 | { 75 | for (std::size_t i = 0; i < current->m_parent->m_data.m_value.array->size(); ++i) 76 | { 77 | if (¤t->m_parent->m_data.m_value.array->operator[](i) == current) 78 | { 79 | tokens.emplace_back(std::to_string(i)); 80 | break; 81 | } 82 | } 83 | break; 84 | } 85 | 86 | case value_t::object: 87 | { 88 | for (const auto& element : *current->m_parent->m_data.m_value.object) 89 | { 90 | if (&element.second == current) 91 | { 92 | tokens.emplace_back(element.first.c_str()); 93 | break; 94 | } 95 | } 96 | break; 97 | } 98 | 99 | case value_t::null: // LCOV_EXCL_LINE 100 | case value_t::string: // LCOV_EXCL_LINE 101 | case value_t::boolean: // LCOV_EXCL_LINE 102 | case value_t::number_integer: // LCOV_EXCL_LINE 103 | case value_t::number_unsigned: // LCOV_EXCL_LINE 104 | case value_t::number_float: // LCOV_EXCL_LINE 105 | case value_t::binary: // LCOV_EXCL_LINE 106 | case value_t::discarded: // LCOV_EXCL_LINE 107 | default: // LCOV_EXCL_LINE 108 | break; // LCOV_EXCL_LINE 109 | } 110 | } 111 | 112 | if (tokens.empty()) 113 | { 114 | return ""; 115 | } 116 | 117 | auto str = std::accumulate(tokens.rbegin(), tokens.rend(), std::string{}, 118 | [](const std::string & a, const std::string & b) 119 | { 120 | return concat(a, '/', detail::escape(b)); 121 | }); 122 | return concat('(', str, ") "); 123 | #else 124 | static_cast<void>(leaf_element); 125 | return ""; 126 | #endif 127 | } 128 | 129 | private: 130 | /// an exception object as storage for error messages 131 | std::runtime_error m; 132 | }; 133 | 134 | /// @brief exception indicating a parse error 135 | /// @sa https://json.nlohmann.me/api/basic_json/parse_error/ 136 | class parse_error : public exception 137 | { 138 | public: 139 | /*! 140 | @brief create a parse error exception 141 | @param[in] id_ the id of the exception 142 | @param[in] pos the position where the error occurred (or with 143 | chars_read_total=0 if the position cannot be 144 | determined) 145 | @param[in] what_arg the explanatory string 146 | @return parse_error object 147 | */ 148 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 149 | static parse_error create(int id_, const position_t& pos, const std::string& what_arg, BasicJsonContext context) 150 | { 151 | const std::string w = concat(exception::name("parse_error", id_), "parse error", 152 | position_string(pos), ": ", exception::diagnostics(context), what_arg); 153 | return {id_, pos.chars_read_total, w.c_str()}; 154 | } 155 | 156 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 157 | static parse_error create(int id_, std::size_t byte_, const std::string& what_arg, BasicJsonContext context) 158 | { 159 | const std::string w = concat(exception::name("parse_error", id_), "parse error", 160 | (byte_ != 0 ? (concat(" at byte ", std::to_string(byte_))) : ""), 161 | ": ", exception::diagnostics(context), what_arg); 162 | return {id_, byte_, w.c_str()}; 163 | } 164 | 165 | /*! 166 | @brief byte index of the parse error 167 | 168 | The byte index of the last read character in the input file. 169 | 170 | @note For an input with n bytes, 1 is the index of the first character and 171 | n+1 is the index of the terminating null byte or the end of file. 172 | This also holds true when reading a byte vector (CBOR or MessagePack). 173 | */ 174 | const std::size_t byte; 175 | 176 | private: 177 | parse_error(int id_, std::size_t byte_, const char* what_arg) 178 | : exception(id_, what_arg), byte(byte_) {} 179 | 180 | static std::string position_string(const position_t& pos) 181 | { 182 | return concat(" at line ", std::to_string(pos.lines_read + 1), 183 | ", column ", std::to_string(pos.chars_read_current_line)); 184 | } 185 | }; 186 | 187 | /// @brief exception indicating errors with iterators 188 | /// @sa https://json.nlohmann.me/api/basic_json/invalid_iterator/ 189 | class invalid_iterator : public exception 190 | { 191 | public: 192 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 193 | static invalid_iterator create(int id_, const std::string& what_arg, BasicJsonContext context) 194 | { 195 | const std::string w = concat(exception::name("invalid_iterator", id_), exception::diagnostics(context), what_arg); 196 | return {id_, w.c_str()}; 197 | } 198 | 199 | private: 200 | JSON_HEDLEY_NON_NULL(3) 201 | invalid_iterator(int id_, const char* what_arg) 202 | : exception(id_, what_arg) {} 203 | }; 204 | 205 | /// @brief exception indicating executing a member function with a wrong type 206 | /// @sa https://json.nlohmann.me/api/basic_json/type_error/ 207 | class type_error : public exception 208 | { 209 | public: 210 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 211 | static type_error create(int id_, const std::string& what_arg, BasicJsonContext context) 212 | { 213 | const std::string w = concat(exception::name("type_error", id_), exception::diagnostics(context), what_arg); 214 | return {id_, w.c_str()}; 215 | } 216 | 217 | private: 218 | JSON_HEDLEY_NON_NULL(3) 219 | type_error(int id_, const char* what_arg) : exception(id_, what_arg) {} 220 | }; 221 | 222 | /// @brief exception indicating access out of the defined range 223 | /// @sa https://json.nlohmann.me/api/basic_json/out_of_range/ 224 | class out_of_range : public exception 225 | { 226 | public: 227 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 228 | static out_of_range create(int id_, const std::string& what_arg, BasicJsonContext context) 229 | { 230 | const std::string w = concat(exception::name("out_of_range", id_), exception::diagnostics(context), what_arg); 231 | return {id_, w.c_str()}; 232 | } 233 | 234 | private: 235 | JSON_HEDLEY_NON_NULL(3) 236 | out_of_range(int id_, const char* what_arg) : exception(id_, what_arg) {} 237 | }; 238 | 239 | /// @brief exception indicating other library errors 240 | /// @sa https://json.nlohmann.me/api/basic_json/other_error/ 241 | class other_error : public exception 242 | { 243 | public: 244 | template<typename BasicJsonContext, enable_if_t<is_basic_json_context<BasicJsonContext>::value, int> = 0> 245 | static other_error create(int id_, const std::string& what_arg, BasicJsonContext context) 246 | { 247 | const std::string w = concat(exception::name("other_error", id_), exception::diagnostics(context), what_arg); 248 | return {id_, w.c_str()}; 249 | } 250 | 251 | private: 252 | JSON_HEDLEY_NON_NULL(3) 253 | other_error(int id_, const char* what_arg) : exception(id_, what_arg) {} 254 | }; 255 | 256 | } // namespace detail 257 | NLOHMANN_JSON_NAMESPACE_END 258 | ```