]> git.apps.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>
Thu, 13 Mar 2025 14:07:12 +0000 (10:07 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
src/include/filepath.h

index 9379cb583280fc926aa466fd2fda304fe6e927bc..4b71ef2bedbd34acae07ec9139ec96c84858f3ef 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());