From: Patrick Donnelly Date: Tue, 11 Mar 2025 14:50:50 +0000 (-0400) Subject: include/filepath: add iterators for components X-Git-Tag: v20.3.0~363^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a33faa7c413c4b166b267a1d4892d0ffdf01490c;p=ceph.git include/filepath: add iterators for components Signed-off-by: Patrick Donnelly --- diff --git a/src/include/filepath.h b/src/include/filepath.h index 9379cb583280..4b71ef2bedbd 100644 --- a/src/include/filepath.h +++ b/src/include/filepath.h @@ -130,6 +130,24 @@ class filepath { return bits[i]; } + auto begin() const { + if (bits.empty() && path.length() > 0) parse_bits(); + return std::as_const(bits).begin(); + } + auto rbegin() const { + if (bits.empty() && path.length() > 0) parse_bits(); + return std::as_const(bits).rbegin(); + } + + auto end() const { + if (bits.empty() && path.length() > 0) parse_bits(); + return std::as_const(bits).end(); + } + auto rend() const { + if (bits.empty() && path.length() > 0) parse_bits(); + return std::as_const(bits).rend(); + } + const std::string& last_dentry() const { if (bits.empty() && path.length() > 0) parse_bits(); ceph_assert(!bits.empty());