mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-10-26 23:11:34 +03:00
AK: Remove JsonObject::get_deprecated() and ::get_ptr() :^)
This commit is contained in:
parent
d48e632696
commit
7d0529b89c
Notes:
sideshowbarker
2024-07-17 00:50:29 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/7d0529b89c Pull-request: https://github.com/SerenityOS/serenity/pull/16627 Reviewed-by: https://github.com/trflynn89
@ -47,26 +47,6 @@ bool JsonObject::is_empty() const
|
|||||||
return m_members.is_empty();
|
return m_members.is_empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
JsonValue const& JsonObject::get_deprecated(StringView key) const
|
|
||||||
{
|
|
||||||
auto const* value = get_ptr(key);
|
|
||||||
static JsonValue* s_null_value { nullptr };
|
|
||||||
if (!value) {
|
|
||||||
if (!s_null_value)
|
|
||||||
s_null_value = new JsonValue;
|
|
||||||
return *s_null_value;
|
|
||||||
}
|
|
||||||
return *value;
|
|
||||||
}
|
|
||||||
|
|
||||||
JsonValue const* JsonObject::get_ptr(StringView key) const
|
|
||||||
{
|
|
||||||
auto it = m_members.find(key);
|
|
||||||
if (it == m_members.end())
|
|
||||||
return nullptr;
|
|
||||||
return &(*it).value;
|
|
||||||
}
|
|
||||||
|
|
||||||
Optional<JsonValue const&> JsonObject::get(StringView key) const
|
Optional<JsonValue const&> JsonObject::get(StringView key) const
|
||||||
{
|
{
|
||||||
auto it = m_members.find(key);
|
auto it = m_members.find(key);
|
||||||
|
@ -35,10 +35,6 @@ public:
|
|||||||
[[nodiscard]] size_t size() const;
|
[[nodiscard]] size_t size() const;
|
||||||
[[nodiscard]] bool is_empty() const;
|
[[nodiscard]] bool is_empty() const;
|
||||||
|
|
||||||
[[nodiscard]] JsonValue const& get_deprecated(StringView key) const;
|
|
||||||
|
|
||||||
[[nodiscard]] JsonValue const* get_ptr(StringView key) const;
|
|
||||||
|
|
||||||
[[nodiscard]] bool has(StringView key) const;
|
[[nodiscard]] bool has(StringView key) const;
|
||||||
|
|
||||||
[[nodiscard]] bool has_null(StringView key) const;
|
[[nodiscard]] bool has_null(StringView key) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user