mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:48:11 +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
1 changed files with 24 additions and 0 deletions
|
@ -83,6 +83,30 @@ public:
|
||||||
m_builder.append('\n');
|
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:
|
private:
|
||||||
StringBuilder& m_builder;
|
StringBuilder& m_builder;
|
||||||
MappingType m_mapping;
|
MappingType m_mapping;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue