Skip to content

Commit

Permalink
Add Deprecation tags to JSON Module
Browse files Browse the repository at this point in the history
  • Loading branch information
narknon authored and localcc committed Jun 17, 2024
1 parent 452df3c commit d5eb2f5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 19 deletions.
2 changes: 2 additions & 0 deletions deps/first/JSON/include/JSON/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#endif
#endif

#define JSON_DEPRECATED [[deprecated("JSON Module deprecated and may be removed in next release. Please migrate to Glz.")]]

#include <cstdint>

#include <File/File.hpp>
Expand Down
30 changes: 15 additions & 15 deletions deps/first/JSON/include/JSON/Object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,29 @@ namespace RC::JSON
auto operator=(const Object&) -> Object& = delete;

private:
auto find_value_by_key(const StringType& key) const -> Value*;
auto find_value_by_key(const StringType& key) -> Value*;
JSON_DEPRECATED auto find_value_by_key(const StringType& key) const -> Value*;
JSON_DEPRECATED auto find_value_by_key(const StringType& key) -> Value*;

public:
auto new_object(StringType name) -> Object&;
auto new_array(StringType name) -> class Array&;
auto new_string(StringType name, const StringType& value) -> void;
auto new_null(StringType name) -> void;
auto new_bool(StringType name, bool value) -> void;
JSON_DEPRECATED auto new_object(StringType name) -> Object&;
JSON_DEPRECATED auto new_array(StringType name) -> class Array&;
JSON_DEPRECATED auto new_string(StringType name, const StringType& value) -> void;
JSON_DEPRECATED auto new_null(StringType name) -> void;
JSON_DEPRECATED auto new_bool(StringType name, bool value) -> void;

auto add_object(StringType name, std::unique_ptr<Object>) -> void;
JSON_DEPRECATED auto add_object(StringType name, std::unique_ptr<Object>) -> void;

auto get() -> decltype(m_members)&
JSON_DEPRECATED auto get() -> decltype(m_members)&
{
return m_members;
};
auto get() const -> const decltype(m_members)&
JSON_DEPRECATED auto get() const -> const decltype(m_members)&
{
return m_members;
};

template <typename ValueType>
auto get(const StringType& key) const -> ValueType&
JSON_DEPRECATED auto get(const StringType& key) const -> ValueType&
{
auto value = find_value_by_key(key);
if (!value)
Expand All @@ -75,7 +75,7 @@ namespace RC::JSON
}

template <typename ValueType>
auto get(const StringType& key) -> ValueType&
JSON_DEPRECATED auto get(const StringType& key) -> ValueType&
{
auto value = find_value_by_key(key);
if (!value)
Expand All @@ -86,13 +86,13 @@ namespace RC::JSON
}

template <JSONNumber number_type>
auto new_number(StringType name, number_type value) -> void
JSON_DEPRECATED auto new_number(StringType name, number_type value) -> void
{
m_members.emplace(std::move(name), std::make_unique<Number>(value));
}

auto serialize(ShouldFormat should_format = ShouldFormat::No, int32_t* indent_level = nullptr) -> StringType override;
auto get_type() const -> Type override
JSON_DEPRECATED auto serialize(ShouldFormat should_format = ShouldFormat::No, int32_t* indent_level = nullptr) -> StringType override;
JSON_DEPRECATED auto get_type() const -> Type override
{
return Type::Object;
}
Expand Down
4 changes: 2 additions & 2 deletions deps/first/JSON/include/JSON/String.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace RC::JSON
}

public:
RC_JSON_API auto serialize(ShouldFormat should_format = ShouldFormat::No, int32_t* indent_level = nullptr) -> StringType override;
RC_JSON_API auto get_type() const -> Type override
RC_JSON_API JSON_DEPRECATED auto serialize(ShouldFormat should_format = ShouldFormat::No, int32_t* indent_level = nullptr) -> StringType override;
RC_JSON_API JSON_DEPRECATED auto get_type() const -> Type override
{
return Type::String;
}
Expand Down
2 changes: 1 addition & 1 deletion deps/first/JSON/include/JSON/Value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace RC::JSON
Bool,
};

inline auto type_to_string(Type type) -> std::string
JSON_DEPRECATED inline auto type_to_string(Type type) -> std::string
{
switch (type)
{
Expand Down
2 changes: 1 addition & 1 deletion deps/first/JSON/src/Array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace RC::JSON
return static_cast<Array&>(*m_members.emplace_back(std::make_unique<Array>()));
}

auto Array::new_string(const StringType& value) -> void
JSON_DEPRECATED auto Array::new_string(const StringType& value) -> void
{
m_members.emplace_back(std::make_unique<String>(value));
}
Expand Down

0 comments on commit d5eb2f5

Please sign in to comment.