X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Fvarobj-iter.h;h=4bbf386e9dc4ee0af7fc3f95a9242fafe4792e03;hb=1ead4b8ed29a8dfb565eb120d527286c3051adfd;hp=1e7889be0294d0f35f5b311a81218d847b8d1a3c;hpb=2f408ecb929bd56613e94cf1e84ace4692c78257;p=binutils-gdb.git
diff --git a/gdb/varobj-iter.h b/gdb/varobj-iter.h
index 1e7889be029..4bbf386e9dc 100644
--- a/gdb/varobj-iter.h
+++ b/gdb/varobj-iter.h
@@ -1,5 +1,5 @@
/* Iterator of varobj.
- Copyright (C) 2013-2016 Free Software Foundation, Inc.
+ Copyright (C) 2013-2022 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -14,59 +14,29 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see . */
+#ifndef VAROBJ_ITER_H
+#define VAROBJ_ITER_H
+
/* A node or item of varobj, composed of the name and the value. */
-typedef struct varobj_item
+struct varobj_item
{
/* Name of this item. */
std::string name;
/* Value of this item. */
- struct value *value;
-} varobj_item;
-
-struct varobj_iter_ops;
+ value_ref_ptr value;
+};
/* A dynamic varobj iterator "class". */
struct varobj_iter
{
- /* The 'vtable'. */
- const struct varobj_iter_ops *ops;
+public:
- /* The varobj this iterator is listing children for. */
- struct varobj *var;
+ virtual ~varobj_iter () = default;
- /* The next raw index we will try to check is available. If it is
- equal to number_of_children, then we've already iterated the
- whole set. */
- int next_raw_index;
+ virtual std::unique_ptr next () = 0;
};
-/* The vtable of the varobj iterator class. */
-
-struct varobj_iter_ops
-{
- /* Destructor. Releases everything from SELF (but not SELF
- itself). */
- void (*dtor) (struct varobj_iter *self);
-
- /* Returns the next object or NULL if it has reached the end. */
- varobj_item *(*next) (struct varobj_iter *self);
-};
-
-/* Returns the next varobj or NULL if it has reached the end. */
-
-#define varobj_iter_next(ITER) (ITER)->ops->next (ITER)
-
-/* Delete a varobj_iter object. */
-
-#define varobj_iter_delete(ITER) \
- do \
- { \
- if ((ITER) != NULL) \
- { \
- (ITER)->ops->dtor (ITER); \
- delete (ITER); \
- } \
- } while (0)
+#endif /* VAROBJ_ITER_H */