From b3a0493136c793468bb2625a60fc6b812713c9bd Mon Sep 17 00:00:00 2001 From: Francis Deslauriers Date: Wed, 9 Mar 2022 17:42:44 -0500 Subject: [PATCH] cpp-common: add `begin()` and `end()` to bt2::ConstFieldPath Signed-off-by: Francis Deslauriers Change-Id: Ie442f80bf1d5b055f6707ff516a8094417ff6c1d Reviewed-on: https://review.lttng.org/c/babeltrace/+/7553 Reviewed-by: Philippe Proulx Reviewed-on: https://review.lttng.org/c/babeltrace/+/10792 Tested-by: jenkins CI-Build: Philippe Proulx --- src/cpp-common/bt2/field-path.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/cpp-common/bt2/field-path.hpp b/src/cpp-common/bt2/field-path.hpp index 6bb91211..75f98c68 100644 --- a/src/cpp-common/bt2/field-path.hpp +++ b/src/cpp-common/bt2/field-path.hpp @@ -11,6 +11,7 @@ #include #include "common/assert.h" +#include "common-iter.hpp" #include "internal/borrowed-obj.hpp" #include "internal/shared-obj.hpp" @@ -126,6 +127,8 @@ public: using Shared = internal::SharedObj; + using Iterator = CommonIterator; + enum class Scope { PACKET_CONTEXT = BT_FIELD_PATH_SCOPE_PACKET_CONTEXT, @@ -164,6 +167,16 @@ public: bt_field_path_borrow_item_by_index_const(this->libObjPtr(), index)}; } + Iterator begin() const noexcept + { + return Iterator {*this, 0}; + } + + Iterator end() const noexcept + { + return Iterator {*this, this->size()}; + } + Shared shared() const noexcept { return Shared {*this}; -- 2.34.1