mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
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:
parent
6eecc65787
commit
7da00bfa8d
Notes:
sideshowbarker
2024-07-17 09:28:03 +09:00
Author: https://github.com/sin-ack Commit: https://github.com/SerenityOS/serenity/commit/7da00bfa8d Pull-request: https://github.com/SerenityOS/serenity/pull/14555 Reviewed-by: https://github.com/Dexesttp ✅ Reviewed-by: https://github.com/kleinesfilmroellchen
1 changed files with 24 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue