-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OMv15: OMLIST is dead, long live JSON
- Loading branch information
bribi5940
committed
Jun 30, 2023
1 parent
f37fc98
commit 4b39a52
Showing
46 changed files
with
24,489 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// __ _____ _____ _____ | ||
// __| | __| | | | JSON for Modern C++ | ||
// | | |__ | | | | | | version 3.11.2 | ||
// |_____|_____|_____|_|___| https://github.com/nlohmann/json | ||
// | ||
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me> | ||
// SPDX-License-Identifier: MIT | ||
|
||
#pragma once | ||
|
||
#include <utility> | ||
|
||
#include <nlohmann/detail/abi_macros.hpp> | ||
#include <nlohmann/detail/conversions/from_json.hpp> | ||
#include <nlohmann/detail/conversions/to_json.hpp> | ||
#include <nlohmann/detail/meta/identity_tag.hpp> | ||
|
||
NLOHMANN_JSON_NAMESPACE_BEGIN | ||
|
||
/// @sa https://json.nlohmann.me/api/adl_serializer/ | ||
template<typename ValueType, typename> | ||
struct adl_serializer | ||
{ | ||
/// @brief convert a JSON value to any value type | ||
/// @sa https://json.nlohmann.me/api/adl_serializer/from_json/ | ||
template<typename BasicJsonType, typename TargetType = ValueType> | ||
static auto from_json(BasicJsonType && j, TargetType& val) noexcept( | ||
noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), val))) | ||
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), val), void()) | ||
{ | ||
::nlohmann::from_json(std::forward<BasicJsonType>(j), val); | ||
} | ||
|
||
/// @brief convert a JSON value to any value type | ||
/// @sa https://json.nlohmann.me/api/adl_serializer/from_json/ | ||
template<typename BasicJsonType, typename TargetType = ValueType> | ||
static auto from_json(BasicJsonType && j) noexcept( | ||
noexcept(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}))) | ||
-> decltype(::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {})) | ||
{ | ||
return ::nlohmann::from_json(std::forward<BasicJsonType>(j), detail::identity_tag<TargetType> {}); | ||
} | ||
|
||
/// @brief convert any value type to a JSON value | ||
/// @sa https://json.nlohmann.me/api/adl_serializer/to_json/ | ||
template<typename BasicJsonType, typename TargetType = ValueType> | ||
static auto to_json(BasicJsonType& j, TargetType && val) noexcept( | ||
noexcept(::nlohmann::to_json(j, std::forward<TargetType>(val)))) | ||
-> decltype(::nlohmann::to_json(j, std::forward<TargetType>(val)), void()) | ||
{ | ||
::nlohmann::to_json(j, std::forward<TargetType>(val)); | ||
} | ||
}; | ||
|
||
NLOHMANN_JSON_NAMESPACE_END |
103 changes: 103 additions & 0 deletions
103
OmniMIDIv2/inc/nlohmann/byte_container_with_subtype.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// __ _____ _____ _____ | ||
// __| | __| | | | JSON for Modern C++ | ||
// | | |__ | | | | | | version 3.11.2 | ||
// |_____|_____|_____|_|___| https://github.com/nlohmann/json | ||
// | ||
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me> | ||
// SPDX-License-Identifier: MIT | ||
|
||
#pragma once | ||
|
||
#include <cstdint> // uint8_t, uint64_t | ||
#include <tuple> // tie | ||
#include <utility> // move | ||
|
||
#include <nlohmann/detail/abi_macros.hpp> | ||
|
||
NLOHMANN_JSON_NAMESPACE_BEGIN | ||
|
||
/// @brief an internal type for a backed binary type | ||
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/ | ||
template<typename BinaryType> | ||
class byte_container_with_subtype : public BinaryType | ||
{ | ||
public: | ||
using container_type = BinaryType; | ||
using subtype_type = std::uint64_t; | ||
|
||
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ | ||
byte_container_with_subtype() noexcept(noexcept(container_type())) | ||
: container_type() | ||
{} | ||
|
||
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ | ||
byte_container_with_subtype(const container_type& b) noexcept(noexcept(container_type(b))) | ||
: container_type(b) | ||
{} | ||
|
||
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ | ||
byte_container_with_subtype(container_type&& b) noexcept(noexcept(container_type(std::move(b)))) | ||
: container_type(std::move(b)) | ||
{} | ||
|
||
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ | ||
byte_container_with_subtype(const container_type& b, subtype_type subtype_) noexcept(noexcept(container_type(b))) | ||
: container_type(b) | ||
, m_subtype(subtype_) | ||
, m_has_subtype(true) | ||
{} | ||
|
||
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/byte_container_with_subtype/ | ||
byte_container_with_subtype(container_type&& b, subtype_type subtype_) noexcept(noexcept(container_type(std::move(b)))) | ||
: container_type(std::move(b)) | ||
, m_subtype(subtype_) | ||
, m_has_subtype(true) | ||
{} | ||
|
||
bool operator==(const byte_container_with_subtype& rhs) const | ||
{ | ||
return std::tie(static_cast<const BinaryType&>(*this), m_subtype, m_has_subtype) == | ||
std::tie(static_cast<const BinaryType&>(rhs), rhs.m_subtype, rhs.m_has_subtype); | ||
} | ||
|
||
bool operator!=(const byte_container_with_subtype& rhs) const | ||
{ | ||
return !(rhs == *this); | ||
} | ||
|
||
/// @brief sets the binary subtype | ||
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/set_subtype/ | ||
void set_subtype(subtype_type subtype_) noexcept | ||
{ | ||
m_subtype = subtype_; | ||
m_has_subtype = true; | ||
} | ||
|
||
/// @brief return the binary subtype | ||
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/subtype/ | ||
constexpr subtype_type subtype() const noexcept | ||
{ | ||
return m_has_subtype ? m_subtype : static_cast<subtype_type>(-1); | ||
} | ||
|
||
/// @brief return whether the value has a subtype | ||
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/has_subtype/ | ||
constexpr bool has_subtype() const noexcept | ||
{ | ||
return m_has_subtype; | ||
} | ||
|
||
/// @brief clears the binary subtype | ||
/// @sa https://json.nlohmann.me/api/byte_container_with_subtype/clear_subtype/ | ||
void clear_subtype() noexcept | ||
{ | ||
m_subtype = 0; | ||
m_has_subtype = false; | ||
} | ||
|
||
private: | ||
subtype_type m_subtype = 0; | ||
bool m_has_subtype = false; | ||
}; | ||
|
||
NLOHMANN_JSON_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// __ _____ _____ _____ | ||
// __| | __| | | | JSON for Modern C++ | ||
// | | |__ | | | | | | version 3.11.2 | ||
// |_____|_____|_____|_|___| https://github.com/nlohmann/json | ||
// | ||
// SPDX-FileCopyrightText: 2013-2022 Niels Lohmann <https://nlohmann.me> | ||
// SPDX-License-Identifier: MIT | ||
|
||
#pragma once | ||
|
||
// This file contains all macro definitions affecting or depending on the ABI | ||
|
||
#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK | ||
#if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) | ||
#if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 2 | ||
#warning "Already included a different version of the library!" | ||
#endif | ||
#endif | ||
#endif | ||
|
||
#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) | ||
#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) | ||
#define NLOHMANN_JSON_VERSION_PATCH 2 // NOLINT(modernize-macro-to-enum) | ||
|
||
#ifndef JSON_DIAGNOSTICS | ||
#define JSON_DIAGNOSTICS 0 | ||
#endif | ||
|
||
#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON | ||
#define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 | ||
#endif | ||
|
||
#if JSON_DIAGNOSTICS | ||
#define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag | ||
#else | ||
#define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS | ||
#endif | ||
|
||
#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON | ||
#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp | ||
#else | ||
#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON | ||
#endif | ||
|
||
#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION | ||
#define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 | ||
#endif | ||
|
||
// Construct the namespace ABI tags component | ||
#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b | ||
#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ | ||
NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) | ||
|
||
#define NLOHMANN_JSON_ABI_TAGS \ | ||
NLOHMANN_JSON_ABI_TAGS_CONCAT( \ | ||
NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ | ||
NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) | ||
|
||
// Construct the namespace version component | ||
#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ | ||
_v ## major ## _ ## minor ## _ ## patch | ||
#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ | ||
NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) | ||
|
||
#if NLOHMANN_JSON_NAMESPACE_NO_VERSION | ||
#define NLOHMANN_JSON_NAMESPACE_VERSION | ||
#else | ||
#define NLOHMANN_JSON_NAMESPACE_VERSION \ | ||
NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ | ||
NLOHMANN_JSON_VERSION_MINOR, \ | ||
NLOHMANN_JSON_VERSION_PATCH) | ||
#endif | ||
|
||
// Combine namespace components | ||
#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b | ||
#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ | ||
NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) | ||
|
||
#ifndef NLOHMANN_JSON_NAMESPACE | ||
#define NLOHMANN_JSON_NAMESPACE \ | ||
nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ | ||
NLOHMANN_JSON_ABI_TAGS, \ | ||
NLOHMANN_JSON_NAMESPACE_VERSION) | ||
#endif | ||
|
||
#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN | ||
#define NLOHMANN_JSON_NAMESPACE_BEGIN \ | ||
namespace nlohmann \ | ||
{ \ | ||
inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ | ||
NLOHMANN_JSON_ABI_TAGS, \ | ||
NLOHMANN_JSON_NAMESPACE_VERSION) \ | ||
{ | ||
#endif | ||
|
||
#ifndef NLOHMANN_JSON_NAMESPACE_END | ||
#define NLOHMANN_JSON_NAMESPACE_END \ | ||
} /* namespace (inline namespace) NOLINT(readability/namespace) */ \ | ||
} // namespace nlohmann | ||
#endif |
Oops, something went wrong.