ladybird/Userland/Libraries/LibWeb/CSS/Serialize.h
Sam Atkins 75c9313d7d LibWeb: Implement more CSS serializers and make them more ergonomic
This implements these algorithms from the CSSOM-1 spec:
- serialize a string
- serialize a URL

Also, we now have two versions of each of the serialization functions:
One that returns a String as before, and the other that takes a
StringBuilder to write into. This saves creating extra StringBuilders
when they are not needed. :^)
2021-10-16 15:16:27 +01:00

27 lines
808 B
C++

/*
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <AK/StringView.h>
namespace Web::CSS {
void escape_a_character(StringBuilder, u32 character);
void escape_a_character_as_code_point(StringBuilder, u32 character);
void serialize_an_identifier(StringBuilder, StringView const& ident);
void serialize_a_string(StringBuilder, StringView const& string);
void serialize_a_url(StringBuilder, StringView const& url);
String escape_a_character(u32 character);
String escape_a_character_as_code_point(u32 character);
String serialize_an_identifier(StringView const& ident);
String serialize_a_string(StringView const& string);
String serialize_a_url(StringView const& url);
}