mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Allow constructing a JsonValue from a StringView explicitly
The next commit will destroy overload detection otherwise, so let's add this constructor. Currently, the same work is already done implicitly through the implicit `String(StringView)` constructor.
This commit is contained in:
parent
07977ad94c
commit
2f631f7dc0
Notes:
sideshowbarker
2024-07-17 22:41:14 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/2f631f7dc0d Pull-request: https://github.com/SerenityOS/serenity/pull/12162 Reviewed-by: https://github.com/AtkinsSJ
2 changed files with 7 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <AK/StringView.h>
|
||||
|
||||
#ifndef KERNEL
|
||||
# include <AK/JsonParser.h>
|
||||
|
@ -184,6 +185,11 @@ JsonValue::JsonValue(const String& value)
|
|||
}
|
||||
}
|
||||
|
||||
JsonValue::JsonValue(StringView value)
|
||||
: JsonValue(value.to_string())
|
||||
{
|
||||
}
|
||||
|
||||
JsonValue::JsonValue(const JsonObject& value)
|
||||
: m_type(Type::Object)
|
||||
{
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
JsonValue(bool);
|
||||
JsonValue(const char*);
|
||||
JsonValue(const String&);
|
||||
JsonValue(StringView);
|
||||
JsonValue(const JsonArray&);
|
||||
JsonValue(const JsonObject&);
|
||||
|
||||
|
|
Loading…
Reference in a new issue