AK: Use east const style in LexicalPath.{cpp,h}

This commit is contained in:
Max Wipfli 2021-06-29 13:01:56 +02:00 committed by Andreas Kling
parent 37361821dd
commit caa9daf59e
Notes: sideshowbarker 2024-07-18 11:13:47 +09:00
2 changed files with 10 additions and 10 deletions

View file

@ -93,7 +93,7 @@ void LexicalPath::canonicalize()
m_string = builder.to_string(); m_string = builder.to_string();
} }
bool LexicalPath::has_extension(const StringView& extension) const bool LexicalPath::has_extension(StringView const& extension) const
{ {
return m_string.ends_with(extension, CaseSensitivity::CaseInsensitive); return m_string.ends_with(extension, CaseSensitivity::CaseInsensitive);
} }
@ -103,7 +103,7 @@ String LexicalPath::canonicalized_path(String path)
return LexicalPath(move(path)).string(); return LexicalPath(move(path)).string();
} }
String LexicalPath::relative_path(String absolute_path, const String& prefix) String LexicalPath::relative_path(String absolute_path, String const& prefix)
{ {
if (!LexicalPath { absolute_path }.is_absolute() || !LexicalPath { prefix }.is_absolute()) if (!LexicalPath { absolute_path }.is_absolute() || !LexicalPath { prefix }.is_absolute())
return {}; return {};

View file

@ -18,16 +18,16 @@ public:
bool is_valid() const { return m_is_valid; } bool is_valid() const { return m_is_valid; }
bool is_absolute() const { return m_is_absolute; } bool is_absolute() const { return m_is_absolute; }
const String& string() const { return m_string; } String const& string() const { return m_string; }
const String& dirname() const { return m_dirname; } String const& dirname() const { return m_dirname; }
const String& basename() const { return m_basename; } String const& basename() const { return m_basename; }
const String& title() const { return m_title; } String const& title() const { return m_title; }
const String& extension() const { return m_extension; } String const& extension() const { return m_extension; }
const Vector<String>& parts() const { return m_parts; } Vector<String> const& parts() const { return m_parts; }
bool has_extension(const StringView&) const; bool has_extension(StringView const&) const;
void append(String const& component); void append(String const& component);
@ -59,7 +59,7 @@ private:
template<> template<>
struct Formatter<LexicalPath> : Formatter<StringView> { struct Formatter<LexicalPath> : Formatter<StringView> {
void format(FormatBuilder& builder, const LexicalPath& value) void format(FormatBuilder& builder, LexicalPath const& value)
{ {
Formatter<StringView>::format(builder, value.string()); Formatter<StringView>::format(builder, value.string());
} }