]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
include/filepath: add iterators for components
authorPatrick Donnelly <pdonnell@ibm.com>
Tue, 11 Mar 2025 14:50:50 +0000 (10:50 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Mon, 17 Mar 2025 19:43:23 +0000 (15:43 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
(cherry picked from commit a33faa7c413c4b166b267a1d4892d0ffdf01490c)

src/include/filepath.h

index dcdfe76e7974b94b89c2dbe4416d36c7e6b44da4..03ae03ee239a3bcec99555bf06611787bb10482d 100644 (file)
@@ -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());