From 7d151f694c88f35e19d96efe62640ad03ccf3bb2 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 19 Apr 2013 22:57:55 -0400 Subject: [PATCH] Extend ValueNode API. - Add several new optional hook functions to ValueNode. These allow implementing subclasses to specify that they're a container type that can export a range of items (i.e. arrays, lists, etc.), and expose several operations on said ranges of child items. --- src/apps/debugger/value/ValueNode.cpp | 28 +++++++++++++++++++++++++++ src/apps/debugger/value/ValueNode.h | 13 +++++++++++++ 2 files changed, 41 insertions(+) diff --git a/src/apps/debugger/value/ValueNode.cpp b/src/apps/debugger/value/ValueNode.cpp index a88ce6dfe1..1166f4cabd 100644 --- a/src/apps/debugger/value/ValueNode.cpp +++ b/src/apps/debugger/value/ValueNode.cpp @@ -63,6 +63,34 @@ ValueNode::SetContainer(ValueNodeContainer* container) } +bool +ValueNode::IsRangedContainer() const +{ + return false; +} + + +void +ValueNode::ClearChildren() +{ + // do nothing +} + + +status_t +ValueNode::CreateChildrenInRange(int32 lowIndex, int32 highIndex) +{ + return B_NOT_SUPPORTED; +} + + +status_t +ValueNode::SupportedChildRange(int32& lowIndex, int32& highIndex) const +{ + return B_NOT_SUPPORTED; +} + + void ValueNode::SetLocationAndValue(ValueLocation* location, Value* value, status_t resolutionState) diff --git a/src/apps/debugger/value/ValueNode.h b/src/apps/debugger/value/ValueNode.h index 449aba779d..9b88b77ebf 100644 --- a/src/apps/debugger/value/ValueNode.h +++ b/src/apps/debugger/value/ValueNode.h @@ -51,10 +51,23 @@ public: { return false; } bool ChildrenCreated() const { return fChildrenCreated; } + virtual status_t CreateChildren() = 0; virtual int32 CountChildren() const = 0; virtual ValueNodeChild* ChildAt(int32 index) const = 0; + // optional virtual hooks for container type value nodes such as + // arrays that may contain a variable (and potentially quite large) + // number of children. The calls below should be implemented for such + // node types to allow the upper layers to be aware of this, and to be + // able to request that only a subset of children be created. + virtual bool IsRangedContainer() const; + virtual void ClearChildren(); + virtual status_t CreateChildrenInRange(int32 lowIndex, + int32 highIndex); + virtual status_t SupportedChildRange(int32& lowIndex, + int32& highIndex) const; + status_t LocationAndValueResolutionState() const { return fLocationResolutionState; } void SetLocationAndValue(ValueLocation* location,