HTMLTokenizerHelpers.h 639 B

123456789101112131415161718192021222324
  1. /*
  2. * Copyright (c) 2024, Andrew Kaster <akaster@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/String.h>
  8. #include <AK/StringView.h>
  9. #include <LibWeb/HTML/Parser/Entities.h>
  10. #include <optional>
  11. namespace Web::HTML {
  12. // Swift-friendly wrapper for TextCodec::Decoder::to_utf8
  13. using OptionalString = std::optional<String>;
  14. OptionalString decode_to_utf8(StringView text, StringView encoding);
  15. // Swift-friendly wrapper for HTML::code_points_from_entity
  16. using OptionalEntityMatch = std::optional<EntityMatch>;
  17. OptionalEntityMatch match_entity_for_named_character_reference(StringView entity);
  18. }