FaceRegistry: pass face names as StringViews instead of const String&
This commit is contained in:
parent
e46a5697e5
commit
cb16e52179
|
@ -71,7 +71,7 @@ String to_string(Face face)
|
||||||
return format("{},{}{}", face.fg, face.bg, face.attributes);
|
return format("{},{}{}", face.fg, face.bg, face.attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
Face FaceRegistry::operator[](const String& facedesc)
|
Face FaceRegistry::operator[](StringView facedesc)
|
||||||
{
|
{
|
||||||
auto it = m_aliases.find(facedesc);
|
auto it = m_aliases.find(facedesc);
|
||||||
while (it != m_aliases.end())
|
while (it != m_aliases.end())
|
||||||
|
@ -83,7 +83,7 @@ Face FaceRegistry::operator[](const String& facedesc)
|
||||||
return parse_face(facedesc);
|
return parse_face(facedesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FaceRegistry::register_alias(const String& name, const String& facedesc,
|
void FaceRegistry::register_alias(StringView name, StringView facedesc,
|
||||||
bool override)
|
bool override)
|
||||||
{
|
{
|
||||||
if (not override and m_aliases.find(name) != m_aliases.end())
|
if (not override and m_aliases.find(name) != m_aliases.end())
|
||||||
|
@ -110,7 +110,7 @@ void FaceRegistry::register_alias(const String& name, const String& facedesc,
|
||||||
it = m_aliases.find(it->value.alias);
|
it = m_aliases.find(it->value.alias);
|
||||||
}
|
}
|
||||||
|
|
||||||
alias.alias = facedesc;
|
alias.alias = facedesc.str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,8 +14,8 @@ class FaceRegistry : public Singleton<FaceRegistry>
|
||||||
public:
|
public:
|
||||||
FaceRegistry();
|
FaceRegistry();
|
||||||
|
|
||||||
Face operator[](const String& facedesc);
|
Face operator[](StringView facedesc);
|
||||||
void register_alias(const String& name, const String& facedesc,
|
void register_alias(StringView name, StringView facedesc,
|
||||||
bool override = false);
|
bool override = false);
|
||||||
|
|
||||||
CandidateList complete_alias_name(StringView prefix,
|
CandidateList complete_alias_name(StringView prefix,
|
||||||
|
@ -34,7 +34,7 @@ private:
|
||||||
AliasMap m_aliases;
|
AliasMap m_aliases;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Face get_face(const String& facedesc)
|
inline Face get_face(StringView facedesc)
|
||||||
{
|
{
|
||||||
if (FaceRegistry::has_instance())
|
if (FaceRegistry::has_instance())
|
||||||
return FaceRegistry::instance()[facedesc];
|
return FaceRegistry::instance()[facedesc];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user