diff options
author | MacDue <macdue@dueutil.tech> | 2023-04-13 23:29:51 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-15 06:37:04 +0200 |
commit | 5db1eb996173b34960f48c7ea8ce4fd33acde157 (patch) | |
tree | 3821497e14788bebd9a675ca44d73d574cb3f420 /AK/URL.h | |
parent | 35612c6a7f7602ff46d56bbbbc8b33b28b411409 (diff) | |
download | serenity-5db1eb996173b34960f48c7ea8ce4fd33acde157.zip |
AK+Everywhere: Replace URL::paths() with path_segment_at_index()
This allows accessing and looping over the path segments in a URL
without necessarily allocating a new vector if you want them percent
decoded too (which path_segment_at_index() has an option for).
Diffstat (limited to 'AK/URL.h')
-rw-r--r-- | AK/URL.h | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -65,6 +65,8 @@ public: DeprecatedString query(ApplyPercentDecoding = ApplyPercentDecoding::No) const; DeprecatedString fragment(ApplyPercentDecoding = ApplyPercentDecoding::Yes) const; Optional<u16> port() const { return m_port; } + DeprecatedString path_segment_at_index(size_t index, ApplyPercentDecoding = ApplyPercentDecoding::Yes) const; + size_t path_segment_count() const { return m_paths.size(); } u16 port_or_default() const { return m_port.value_or(default_port_for_scheme(m_scheme)); } bool cannot_be_a_base_url() const { return m_cannot_be_a_base_url; } |