AK: Add string literal helpers to AK::SourceGenerator

Since all uses of SourceGenerator are with literal strings, there is no
need to burden generators with the sv suffix.
This commit is contained in:
sin-ack 2022-07-12 00:58:29 +00:00 committed by Andreas Kling
parent 6eecc65787
commit 7da00bfa8d

View file

@ -83,6 +83,30 @@ public:
m_builder.append('\n');
}
template<size_t N>
String get(char const (&key)[N])
{
return get(StringView { key, N - 1 });
}
template<size_t N>
void set(char const (&key)[N], String value)
{
set(StringView { key, N - 1 }, value);
}
template<size_t N>
void append(char const (&pattern)[N])
{
append(StringView { pattern, N - 1 });
}
template<size_t N>
void appendln(char const (&pattern)[N])
{
appendln(StringView { pattern, N - 1 });
}
private:
StringBuilder& m_builder;
MappingType m_mapping;