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.
This commit is contained in:
Rene Gollent 2013-04-19 22:57:55 -04:00
parent be1038406b
commit 7d151f694c
2 changed files with 41 additions and 0 deletions

View File

@ -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)

View File

@ -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,