diff options
author | Max Wipfli <mail@maxwipfli.ch> | 2021-06-29 17:55:12 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-30 11:13:54 +0200 |
commit | 4c018909f72719b8916cd1480216e9ecb7a16d7a (patch) | |
tree | 3a9f0453bc91cef86866a4806dcafd212bbc63aa /AK/LexicalPath.h | |
parent | 1e80022282ba1e08c8d3a0ca46558d08b02c0570 (diff) | |
download | serenity-4c018909f72719b8916cd1480216e9ecb7a16d7a.zip |
AK: Make LexicalPath immutable
This replaces the current LexicalPath::append() API with a new method
that returns a new LexicalPath object and doesn't touch the this-object.
With this, LexicalPath is now immutable. It also adds a
LexicalPath::parent() method and the relevant test cases.
Diffstat (limited to 'AK/LexicalPath.h')
-rw-r--r-- | AK/LexicalPath.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/AK/LexicalPath.h b/AK/LexicalPath.h index 4c425c4ed3..8c4d71f409 100644 --- a/AK/LexicalPath.h +++ b/AK/LexicalPath.h @@ -30,7 +30,8 @@ public: bool has_extension(StringView const&) const; - void append(String const& component); + [[nodiscard]] LexicalPath append(StringView const&) const; + [[nodiscard]] LexicalPath parent() const; static String canonicalized_path(String); static String relative_path(String absolute_path, String const& prefix); |