1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-18 14:55:08 +00:00
serenity/Userland/Libraries/LibJS/MarkupGenerator.h
Linus Groh 6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00

50 lines
1.6 KiB
C++

/*
* Copyright (c) 2020, Hunter Salyer <thefalsehonesty@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/HashTable.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Error.h>
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);
private:
enum class StyleType {
Invalid,
String,
Number,
KeywordBold,
Punctuation,
Operator,
Keyword,
ControlKeyword,
Identifier,
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 DeprecatedString 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);
};
}