mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:57:34 +00:00
AK: Add JsonValue::to_string(default_value = {}).
This commit is contained in:
parent
266fed8c00
commit
643a43f278
1 changed files with 7 additions and 0 deletions
|
@ -44,6 +44,13 @@ public:
|
||||||
String serialized() const;
|
String serialized() const;
|
||||||
void serialize(StringBuilder&) const;
|
void serialize(StringBuilder&) const;
|
||||||
|
|
||||||
|
String to_string(const String& default_value = {}) const
|
||||||
|
{
|
||||||
|
if (is_string())
|
||||||
|
return as_string();
|
||||||
|
return default_value;
|
||||||
|
}
|
||||||
|
|
||||||
String as_string() const
|
String as_string() const
|
||||||
{
|
{
|
||||||
ASSERT(is_string());
|
ASSERT(is_string());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue