1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:37:36 +00:00

LibJS: Convert MarkupGenerator to the new String

This commit is contained in:
Linus Groh 2022-12-06 20:42:59 +00:00
parent f23b55ae86
commit 112b3f7342
5 changed files with 92 additions and 85 deletions

View file

@ -6,8 +6,8 @@
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/HashTable.h>
#include <AK/String.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Error.h>
@ -15,9 +15,9 @@ namespace JS {
class MarkupGenerator {
public:
static DeprecatedString html_from_source(StringView);
static DeprecatedString html_from_value(Value);
static DeprecatedString html_from_error(Error const&, bool);
static ErrorOr<String> html_from_source(StringView);
static ErrorOr<String> html_from_value(Value);
static ErrorOr<String> html_from_error(Error const&, bool);
private:
enum class StyleType {
@ -33,18 +33,18 @@ private:
ObjectType,
};
static void value_to_html(Value, StringBuilder& output_html, HashTable<Object*> seen_objects = {});
static void array_to_html(Array const&, StringBuilder& output_html, HashTable<Object*>&);
static void object_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
static void function_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
static void date_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
static void error_to_html(Error const&, StringBuilder& output_html, bool in_promise);
static void trace_to_html(TracebackFrame const&, StringBuilder& output_html);
static ErrorOr<void> value_to_html(Value, StringBuilder& output_html, HashTable<Object*> seen_objects = {});
static ErrorOr<void> array_to_html(Array const&, StringBuilder& output_html, HashTable<Object*>&);
static ErrorOr<void> object_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
static ErrorOr<void> function_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
static ErrorOr<void> date_to_html(Object const&, StringBuilder& output_html, HashTable<Object*>&);
static ErrorOr<void> error_to_html(Error const&, StringBuilder& output_html, bool in_promise);
static ErrorOr<void> trace_to_html(TracebackFrame const&, StringBuilder& output_html);
static DeprecatedString style_from_style_type(StyleType);
static StringView style_from_style_type(StyleType);
static StyleType style_type_for_token(Token);
static DeprecatedString open_style_type(StyleType type);
static DeprecatedString wrap_string_in_style(DeprecatedString source, StyleType type);
static ErrorOr<String> open_style_type(StyleType type);
static ErrorOr<String> wrap_string_in_style(StringView source, StyleType type);
};
}