From: Patrick Donnelly Date: Tue, 11 Mar 2025 14:50:50 +0000 (-0400) Subject: include/filepath: add iterators for components X-Git-Tag: v19.2.3~288^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9cb1fb94208150139e4a8688ab4fb14a371b16c8;p=ceph.git include/filepath: add iterators for components Signed-off-by: Patrick Donnelly (cherry picked from commit a33faa7c413c4b166b267a1d4892d0ffdf01490c) --- diff --git a/src/include/filepath.h b/src/include/filepath.h index dcdfe76e7974..03ae03ee239a 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());