1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 22:47:45 +00:00

LibWeb: Port Attr interface from DeprecatedString to String

There are an unfortunate number of DeprecatedString conversions required
here, but these should all fall away and look much more pretty again
when other places are also ported away from DeprecatedString.

Leaves only the Element IDL interface left :^)
This commit is contained in:
Shannon Booth 2023-09-10 16:06:58 +12:00 committed by Andreas Kling
parent a41f23a0fc
commit 3bd04d2c58
15 changed files with 172 additions and 117 deletions

View file

@ -8,31 +8,48 @@
#pragma once
#include <AK/DeprecatedFlyString.h>
#include <AK/FlyString.h>
#include <AK/Optional.h>
namespace Web::DOM {
class QualifiedName {
public:
QualifiedName(DeprecatedFlyString const& local_name, DeprecatedFlyString const& prefix, DeprecatedFlyString const& namespace_);
QualifiedName(FlyString const& local_name, Optional<FlyString> const& prefix, Optional<FlyString> const& namespace_);
QualifiedName(FlyString const& local_name, DeprecatedFlyString const& prefix, DeprecatedFlyString const& namespace_);
DeprecatedFlyString const& local_name() const { return m_impl->local_name; }
DeprecatedFlyString const& prefix() const { return m_impl->prefix; }
DeprecatedFlyString const& namespace_() const { return m_impl->namespace_; }
FlyString const& local_name() const { return m_impl->local_name; }
Optional<FlyString> const& prefix() const { return m_impl->prefix; }
Optional<FlyString> const& namespace_() const { return m_impl->namespace_; }
DeprecatedFlyString const& as_string() const { return m_impl->as_string; }
DeprecatedFlyString deprecated_prefix() const
{
if (!m_impl->prefix.has_value())
return {};
return m_impl->prefix->to_deprecated_fly_string();
}
DeprecatedFlyString deprecated_namespace_() const
{
if (!m_impl->namespace_.has_value())
return {};
return m_impl->namespace_->to_deprecated_fly_string();
}
FlyString const& as_string() const { return m_impl->as_string; }
struct Impl : public RefCounted<Impl> {
Impl(DeprecatedFlyString const& local_name, DeprecatedFlyString const& prefix, DeprecatedFlyString const& namespace_);
Impl(FlyString const& local_name, Optional<FlyString> const& prefix, Optional<FlyString> const& namespace_);
~Impl();
void make_internal_string();
DeprecatedFlyString local_name;
DeprecatedFlyString prefix;
DeprecatedFlyString namespace_;
DeprecatedFlyString as_string;
FlyString local_name;
Optional<FlyString> prefix;
Optional<FlyString> namespace_;
FlyString as_string;
};
void set_prefix(DeprecatedFlyString const& value);
void set_prefix(Optional<FlyString> value);
private:
NonnullRefPtr<Impl> m_impl;