Cleanups to simplify handling of pointer vs value types.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42353 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Rene Gollent
2011-07-01 01:54:58 +00:00
parent f74d4e95d9
commit 8a7985745c
2 changed files with 15 additions and 10 deletions
@@ -64,9 +64,7 @@ public:
{
ValueLocation* parentLocation = fParent->Location();
ValueLocation* location;
CompoundType* type = dynamic_cast<CompoundType*>(fParent->GetType());
if (type == NULL)
return B_BAD_VALUE;
CompoundType* type = fParent->GetMessageType();
status_t error = type->ResolveDataMemberLocation(fMember,
*parentLocation, location);
@@ -93,6 +91,7 @@ BMessageValueNode::BMessageValueNode(ValueNodeChild* nodeChild,
:
ValueNode(nodeChild),
fType(type),
fMessageType(NULL),
fMessage()
{
fType->AcquireReference();
@@ -154,6 +153,7 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
pieceLocation.SetToMemory(address.ToUInt64());
location->SetPieceAt(0, pieceLocation);
}
fMessageType = baseType;
_location = location;
_value = NULL;
@@ -300,16 +300,15 @@ BMessageValueNode::CreateChildren()
if (!fChildren.IsEmpty())
return B_OK;
CompoundType* baseType = dynamic_cast<CompoundType*>(
fType->ResolveRawType(false));
if (baseType == NULL)
return B_OK;
if (fMessageType == NULL)
return B_BAD_VALUE;
DataMember* member = NULL;
Type* whatType = NULL;
for (int32 i = 0; i < baseType->CountDataMembers(); i++) {
member = baseType->DataMemberAt(i);
for (int32 i = 0; i < fMessageType->CountDataMembers(); i++) {
member = fMessageType->DataMemberAt(i);
if (strcmp(member->Name(), "what") == 0) {
whatType = member->GetType();
break;
@@ -11,6 +11,9 @@
#include "ValueNode.h"
class CompoundType;
class BMessageValueNode : public ValueNode {
public:
BMessageValueNode(ValueNodeChild* nodeChild,
@@ -18,7 +21,6 @@ public:
virtual ~BMessageValueNode();
virtual Type* GetType() const;
virtual status_t ResolvedLocationAndValue(
ValueLoader* valueLoader,
ValueLocation*& _location,
@@ -30,6 +32,9 @@ public:
virtual int32 CountChildren() const;
virtual ValueNodeChild* ChildAt(int32 index) const;
CompoundType* GetMessageType() const
{ return fMessageType; }
private:
class BMessageFieldHeaderNode;
class BMessageFieldHeaderNodeChild;
@@ -42,6 +47,7 @@ private:
private:
Type* fType;
CompoundType* fMessageType;
BMessage fMessage;
ChildNodeList fChildren;
};