Debugger: Cleanups, no functional change.
- Remove out-of-place accessor to type lookup info on ValueLoader. Instead, adjust CreateChildren() and CreateChildrenInRange() to take a TeamTypeInformation parameter. This can then be used by value nodes that need to be able to look up type information in order to properly publish their children, such as BList and BMessage. Refactor subclasses and callers accordingly
This commit is contained in:
parent
5ea6993dc2
commit
d2a6418f63
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2012-2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -9,6 +9,7 @@
|
||||
#include "AutoLocker.h"
|
||||
|
||||
#include "StackFrame.h"
|
||||
#include "Team.h"
|
||||
#include "Thread.h"
|
||||
#include "TypeHandlerRoster.h"
|
||||
#include "ValueNode.h"
|
||||
@ -107,7 +108,7 @@ ValueNodeManager::ValueNodeChanged(ValueNodeChild* nodeChild,
|
||||
fListeners.ItemAt(i)->ValueNodeChanged(nodeChild, oldNode, newNode);
|
||||
|
||||
if (oldNode != NULL)
|
||||
newNode->CreateChildren();
|
||||
newNode->CreateChildren(fThread->GetTeam()->GetTeamTypeInformation());
|
||||
|
||||
}
|
||||
|
||||
@ -149,7 +150,8 @@ ValueNodeManager::ValueNodeValueChanged(ValueNode* valueNode)
|
||||
|
||||
if (valueNode->ChildCreationNeedsValue()
|
||||
&& !valueNode->ChildrenCreated()) {
|
||||
status_t error = valueNode->CreateChildren();
|
||||
status_t error = valueNode->CreateChildren(
|
||||
fThread->GetTeam()->GetTeamTypeInformation());
|
||||
if (error == B_OK) {
|
||||
for (int32 i = 0; i < valueNode->CountChildren(); i++) {
|
||||
ValueNodeChild* child = valueNode->ChildAt(i);
|
||||
@ -230,5 +232,6 @@ ValueNodeManager::AddChildNodes(ValueNodeChild* nodeChild)
|
||||
if (valueNode->ChildrenCreated())
|
||||
return B_OK;
|
||||
|
||||
return valueNode->CreateChildren();
|
||||
return valueNode->CreateChildren(
|
||||
fThread->GetTeam()->GetTeamTypeInformation());
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2012-2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -154,8 +154,7 @@ ResolveValueNodeValueJob::_ResolveNodeValue()
|
||||
|
||||
// resolve the node location and value
|
||||
ValueLoader valueLoader(fArchitecture, fDebuggerInterface,
|
||||
fTypeInformation, variableCpuState != NULL ? variableCpuState
|
||||
: fCpuState);
|
||||
variableCpuState != NULL ? variableCpuState : fCpuState);
|
||||
ValueLocation* location;
|
||||
Value* value;
|
||||
status_t error = fValueNode->ResolvedLocationAndValue(&valueLoader,
|
||||
@ -186,8 +185,7 @@ status_t
|
||||
ResolveValueNodeValueJob::_ResolveNodeChildLocation(ValueNodeChild* nodeChild)
|
||||
{
|
||||
// resolve the location
|
||||
ValueLoader valueLoader(fArchitecture, fDebuggerInterface,
|
||||
fTypeInformation, fCpuState);
|
||||
ValueLoader valueLoader(fArchitecture, fDebuggerInterface, fCpuState);
|
||||
ValueLocation* location = NULL;
|
||||
status_t error = nodeChild->ResolveLocation(&valueLoader, location);
|
||||
BReference<ValueLocation> locationReference(location, true);
|
||||
|
@ -2027,6 +2027,7 @@ VariablesView::MessageReceived(BMessage* message)
|
||||
for (int32 i = 0; i < ranges.CountRanges(); i++) {
|
||||
const Range* range = ranges.RangeAt(i);
|
||||
result = valueNode->CreateChildrenInRange(
|
||||
fThread->GetTeam()->GetTeamTypeInformation(),
|
||||
range->lowerBound, range->upperBound);
|
||||
if (result != B_OK)
|
||||
break;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2013-2015, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -12,38 +12,19 @@
|
||||
#include "CpuState.h"
|
||||
#include "Register.h"
|
||||
#include "TeamMemory.h"
|
||||
#include "TeamTypeInformation.h"
|
||||
#include "Tracing.h"
|
||||
#include "TypeLookupConstraints.h"
|
||||
#include "ValueLocation.h"
|
||||
|
||||
|
||||
ValueLoader::ValueLoader(Architecture* architecture, TeamMemory* teamMemory,
|
||||
TeamTypeInformation* typeInformation, CpuState* cpuState)
|
||||
CpuState* cpuState)
|
||||
:
|
||||
fArchitecture(architecture),
|
||||
fTeamMemory(teamMemory),
|
||||
fTypeInformation(typeInformation),
|
||||
fCpuState(cpuState)
|
||||
{
|
||||
fArchitecture->AcquireReference();
|
||||
fTeamMemory->AcquireReference();
|
||||
fTypeInformation->AcquireReference();
|
||||
if (fCpuState != NULL)
|
||||
fCpuState->AcquireReference();
|
||||
}
|
||||
|
||||
|
||||
ValueLoader::ValueLoader(const ValueLoader& other)
|
||||
:
|
||||
fArchitecture(other.fArchitecture),
|
||||
fTeamMemory(other.fTeamMemory),
|
||||
fTypeInformation(other.fTypeInformation),
|
||||
fCpuState(other.fCpuState)
|
||||
{
|
||||
fArchitecture->AcquireReference();
|
||||
fTeamMemory->AcquireReference();
|
||||
fTypeInformation->AcquireReference();
|
||||
if (fCpuState != NULL)
|
||||
fCpuState->AcquireReference();
|
||||
}
|
||||
@ -53,7 +34,6 @@ ValueLoader::~ValueLoader()
|
||||
{
|
||||
fArchitecture->ReleaseReference();
|
||||
fTeamMemory->ReleaseReference();
|
||||
fTypeInformation->ReleaseReference();
|
||||
if (fCpuState != NULL)
|
||||
fCpuState->ReleaseReference();
|
||||
}
|
||||
@ -252,11 +232,3 @@ ValueLoader::LoadStringValue(BVariant& location, size_t maxSize, BString& _value
|
||||
return fTeamMemory->ReadMemoryString(location.ToUInt64(),
|
||||
std::min(maxSize, kMaxStringSize), _value);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ValueLoader::LookupTypeByName(const BString& name,
|
||||
const TypeLookupConstraints& constraints, Type*& _type)
|
||||
{
|
||||
return fTypeInformation->LookupTypeByName(name, constraints, _type);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -14,9 +15,6 @@
|
||||
class Architecture;
|
||||
class CpuState;
|
||||
class TeamMemory;
|
||||
class TeamTypeInformation;
|
||||
class Type;
|
||||
class TypeLookupConstraints;
|
||||
class ValueLocation;
|
||||
|
||||
|
||||
@ -24,10 +22,8 @@ class ValueLoader {
|
||||
public:
|
||||
ValueLoader(Architecture* architecture,
|
||||
TeamMemory* teamMemory,
|
||||
TeamTypeInformation* typeInformation,
|
||||
CpuState* cpuState);
|
||||
// cpuState can be NULL
|
||||
ValueLoader(const ValueLoader& other);
|
||||
~ValueLoader();
|
||||
|
||||
Architecture* GetArchitecture() const
|
||||
@ -43,16 +39,9 @@ public:
|
||||
status_t LoadStringValue(BVariant& location,
|
||||
size_t maxSize, BString& _value);
|
||||
|
||||
status_t LookupTypeByName(const BString& name,
|
||||
const TypeLookupConstraints& constraints,
|
||||
Type*& _type);
|
||||
// returns reference
|
||||
|
||||
private:
|
||||
Architecture* fArchitecture;
|
||||
TeamMemory* fTeamMemory;
|
||||
TeamTypeInformation*
|
||||
fTypeInformation;
|
||||
CpuState* fCpuState;
|
||||
};
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -85,7 +86,8 @@ ValueNode::ClearChildren()
|
||||
|
||||
|
||||
status_t
|
||||
ValueNode::CreateChildrenInRange(int32 lowIndex, int32 highIndex)
|
||||
ValueNode::CreateChildrenInRange(TeamTypeInformation* info, int32 lowIndex,
|
||||
int32 highIndex)
|
||||
{
|
||||
return B_NOT_SUPPORTED;
|
||||
}
|
||||
@ -245,7 +247,7 @@ ChildlessValueNode::ChildlessValueNode(ValueNodeChild* nodeChild)
|
||||
|
||||
|
||||
status_t
|
||||
ChildlessValueNode::CreateChildren()
|
||||
ChildlessValueNode::CreateChildren(TeamTypeInformation* info)
|
||||
{
|
||||
return B_OK;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -11,6 +12,7 @@
|
||||
#include <Referenceable.h>
|
||||
|
||||
|
||||
class TeamTypeInformation;
|
||||
class Type;
|
||||
class Value;
|
||||
class ValueLoader;
|
||||
@ -52,7 +54,7 @@ public:
|
||||
bool ChildrenCreated() const
|
||||
{ return fChildrenCreated; }
|
||||
|
||||
virtual status_t CreateChildren() = 0;
|
||||
virtual status_t CreateChildren(TeamTypeInformation* info) = 0;
|
||||
virtual int32 CountChildren() const = 0;
|
||||
virtual ValueNodeChild* ChildAt(int32 index) const = 0;
|
||||
|
||||
@ -67,8 +69,9 @@ public:
|
||||
// arbitrarily go outside of the
|
||||
// specified/supported range.
|
||||
virtual void ClearChildren();
|
||||
virtual status_t CreateChildrenInRange(int32 lowIndex,
|
||||
int32 highIndex);
|
||||
virtual status_t CreateChildrenInRange(
|
||||
TeamTypeInformation* info,
|
||||
int32 lowIndex, int32 highIndex);
|
||||
virtual status_t SupportedChildRange(int32& lowIndex,
|
||||
int32& highIndex) const;
|
||||
|
||||
@ -134,7 +137,7 @@ class ChildlessValueNode : public ValueNode {
|
||||
public:
|
||||
ChildlessValueNode(ValueNodeChild* nodeChild);
|
||||
|
||||
virtual status_t CreateChildren();
|
||||
virtual status_t CreateChildren(TeamTypeInformation* info);
|
||||
virtual int32 CountChildren() const;
|
||||
virtual ValueNodeChild* ChildAt(int32 index) const;
|
||||
};
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -87,7 +88,7 @@ AddressValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
|
||||
|
||||
|
||||
status_t
|
||||
AddressValueNode::CreateChildren()
|
||||
AddressValueNode::CreateChildren(TeamTypeInformation* info)
|
||||
{
|
||||
if (fChild != NULL)
|
||||
return B_OK;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -28,7 +29,7 @@ public:
|
||||
|
||||
// locking required
|
||||
|
||||
virtual status_t CreateChildren();
|
||||
virtual status_t CreateChildren(TeamTypeInformation* info);
|
||||
virtual int32 CountChildren() const;
|
||||
virtual ValueNodeChild* ChildAt(int32 index) const;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2013-2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -75,12 +75,12 @@ AbstractArrayValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
|
||||
|
||||
|
||||
status_t
|
||||
AbstractArrayValueNode::CreateChildren()
|
||||
AbstractArrayValueNode::CreateChildren(TeamTypeInformation* info)
|
||||
{
|
||||
if (!fChildren.IsEmpty())
|
||||
return B_OK;
|
||||
|
||||
return CreateChildrenInRange(0, kMaxArrayElementCount - 1);
|
||||
return CreateChildrenInRange(info, 0, kMaxArrayElementCount - 1);
|
||||
}
|
||||
|
||||
|
||||
@ -117,8 +117,8 @@ AbstractArrayValueNode::ClearChildren()
|
||||
|
||||
|
||||
status_t
|
||||
AbstractArrayValueNode::CreateChildrenInRange(int32 lowIndex,
|
||||
int32 highIndex)
|
||||
AbstractArrayValueNode::CreateChildrenInRange(TeamTypeInformation* info,
|
||||
int32 lowIndex, int32 highIndex)
|
||||
{
|
||||
// TODO: ensure that we don't already have children in the specified
|
||||
// index range. These need to be skipped if so.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2013-2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -37,14 +37,15 @@ public:
|
||||
|
||||
// locking required
|
||||
|
||||
virtual status_t CreateChildren();
|
||||
virtual status_t CreateChildren(TeamTypeInformation* info);
|
||||
virtual int32 CountChildren() const;
|
||||
virtual ValueNodeChild* ChildAt(int32 index) const;
|
||||
|
||||
virtual bool IsRangedContainer() const;
|
||||
virtual void ClearChildren();
|
||||
virtual status_t CreateChildrenInRange(int32 lowIndex,
|
||||
int32 highIndex);
|
||||
virtual status_t CreateChildrenInRange(
|
||||
TeamTypeInformation* info,
|
||||
int32 lowIndex, int32 highIndex);
|
||||
virtual status_t SupportedChildRange(int32& lowIndex,
|
||||
int32& highIndex) const;
|
||||
protected:
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013, Rene Gollent, rene@gollent.com
|
||||
* Copyright 2012-2015, Rene Gollent, rene@gollent.com
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include "AddressValueNode.h"
|
||||
#include "Architecture.h"
|
||||
#include "StringValue.h"
|
||||
#include "TeamTypeInformation.h"
|
||||
#include "Tracing.h"
|
||||
#include "Type.h"
|
||||
#include "TypeLookupConstraints.h"
|
||||
@ -163,7 +164,6 @@ BListValueNode::BListValueNode(ValueNodeChild* nodeChild,
|
||||
:
|
||||
ValueNode(nodeChild),
|
||||
fType(type),
|
||||
fLoader(NULL),
|
||||
fItemCountType(NULL),
|
||||
fItemCount(0),
|
||||
fCountChildCreated(false)
|
||||
@ -180,8 +180,6 @@ BListValueNode::~BListValueNode()
|
||||
|
||||
if (fItemCountType != NULL)
|
||||
fItemCountType->ReleaseReference();
|
||||
|
||||
delete fLoader;
|
||||
}
|
||||
|
||||
|
||||
@ -292,20 +290,14 @@ BListValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
|
||||
memberLocation = NULL;
|
||||
}
|
||||
|
||||
if (fLoader == NULL) {
|
||||
fLoader = new(std::nothrow)ValueLoader(*valueLoader);
|
||||
if (fLoader == NULL)
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BListValueNode::CreateChildren()
|
||||
BListValueNode::CreateChildren(TeamTypeInformation* info)
|
||||
{
|
||||
return CreateChildrenInRange(0, kMaxArrayElementCount);
|
||||
return CreateChildrenInRange(info, 0, kMaxArrayElementCount);
|
||||
}
|
||||
|
||||
|
||||
@ -348,7 +340,8 @@ BListValueNode::ClearChildren()
|
||||
|
||||
|
||||
status_t
|
||||
BListValueNode::CreateChildrenInRange(int32 lowIndex, int32 highIndex)
|
||||
BListValueNode::CreateChildrenInRange(TeamTypeInformation* info,
|
||||
int32 lowIndex, int32 highIndex)
|
||||
{
|
||||
if (fLocationResolutionState != B_OK)
|
||||
return fLocationResolutionState;
|
||||
@ -387,7 +380,8 @@ BListValueNode::CreateChildrenInRange(int32 lowIndex, int32 highIndex)
|
||||
TypeLookupConstraints constraints;
|
||||
constraints.SetTypeKind(TYPE_ADDRESS);
|
||||
constraints.SetBaseTypeName("void");
|
||||
status_t result = fLoader->LookupTypeByName(typeName, constraints, type);
|
||||
status_t result = info->LookupTypeByName(typeName, constraints,
|
||||
type);
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2012-2015, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef BLIST_VALUE_NODE_H
|
||||
@ -32,15 +32,16 @@ public:
|
||||
|
||||
virtual bool ChildCreationNeedsValue() const
|
||||
{ return true; }
|
||||
virtual status_t CreateChildren();
|
||||
virtual status_t CreateChildren(TeamTypeInformation* info);
|
||||
virtual int32 CountChildren() const;
|
||||
virtual ValueNodeChild* ChildAt(int32 index) const;
|
||||
|
||||
virtual bool IsRangedContainer() const;
|
||||
virtual bool IsContainerRangeFixed() const;
|
||||
virtual void ClearChildren();
|
||||
virtual status_t CreateChildrenInRange(int32 lowIndex,
|
||||
int32 highIndex);
|
||||
virtual status_t CreateChildrenInRange(
|
||||
TeamTypeInformation* info,
|
||||
int32 lowIndex, int32 highIndex);
|
||||
virtual status_t SupportedChildRange(int32& lowIndex,
|
||||
int32& highIndex) const;
|
||||
private:
|
||||
@ -57,7 +58,6 @@ private:
|
||||
|
||||
Type* fType;
|
||||
ChildNodeList fChildren;
|
||||
ValueLoader* fLoader;
|
||||
BVariant fDataLocation;
|
||||
BVariant fItemCountLocation;
|
||||
Type* fItemCountType;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013, Rene Gollent, rene@gollent.com
|
||||
* Copyright 2011-2015, Rene Gollent, rene@gollent.com
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
|
||||
#include "Architecture.h"
|
||||
#include "StringValue.h"
|
||||
#include "TeamTypeInformation.h"
|
||||
#include "Tracing.h"
|
||||
#include "Type.h"
|
||||
#include "TypeLookupConstraints.h"
|
||||
@ -109,7 +110,6 @@ BMessageValueNode::BMessageValueNode(ValueNodeChild* nodeChild,
|
||||
:
|
||||
ValueNode(nodeChild),
|
||||
fType(type),
|
||||
fLoader(NULL),
|
||||
fHeader(NULL),
|
||||
fFields(NULL),
|
||||
fData(NULL),
|
||||
@ -125,7 +125,6 @@ BMessageValueNode::~BMessageValueNode()
|
||||
for (int32 i = 0; i < fChildren.CountItems(); i++)
|
||||
fChildren.ItemAt(i)->ReleaseReference();
|
||||
|
||||
delete fLoader;
|
||||
delete fHeader;
|
||||
delete[] fFields;
|
||||
delete[] fData;
|
||||
@ -319,18 +318,12 @@ BMessageValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
if (fLoader == NULL) {
|
||||
fLoader = new(std::nothrow)ValueLoader(*valueLoader);
|
||||
if (fLoader == NULL)
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
BMessageValueNode::CreateChildren()
|
||||
BMessageValueNode::CreateChildren(TeamTypeInformation* info)
|
||||
{
|
||||
DataMember* member = NULL;
|
||||
CompoundType* messageType = dynamic_cast<CompoundType*>(fType);
|
||||
@ -358,7 +351,7 @@ BMessageValueNode::CreateChildren()
|
||||
&count) == B_OK; i++) {
|
||||
fieldType = NULL;
|
||||
|
||||
_GetTypeForTypeCode(type, fieldType);
|
||||
_GetTypeForTypeCode(info, type, fieldType);
|
||||
if (fieldType != NULL)
|
||||
typeRef.SetTo(fieldType, true);
|
||||
|
||||
@ -397,8 +390,8 @@ BMessageValueNode::ChildAt(int32 index) const
|
||||
|
||||
|
||||
status_t
|
||||
BMessageValueNode::_GetTypeForTypeCode(type_code type,
|
||||
Type*& _type)
|
||||
BMessageValueNode::_GetTypeForTypeCode(TeamTypeInformation* info,
|
||||
type_code type, Type*& _type)
|
||||
{
|
||||
BString typeName;
|
||||
TypeLookupConstraints constraints;
|
||||
@ -494,7 +487,7 @@ BMessageValueNode::_GetTypeForTypeCode(type_code type,
|
||||
typeName = "char";
|
||||
constraints.SetTypeKind(TYPE_PRIMITIVE);
|
||||
Type* baseType = NULL;
|
||||
status_t result = fLoader->LookupTypeByName(typeName, constraints,
|
||||
status_t result = info->LookupTypeByName(typeName, constraints,
|
||||
baseType);
|
||||
if (result != B_OK)
|
||||
return result;
|
||||
@ -517,7 +510,7 @@ BMessageValueNode::_GetTypeForTypeCode(type_code type,
|
||||
break;
|
||||
}
|
||||
|
||||
return fLoader->LookupTypeByName(typeName, constraints, _type);
|
||||
return info->LookupTypeByName(typeName, constraints, _type);
|
||||
}
|
||||
|
||||
|
||||
@ -647,17 +640,18 @@ BMessageValueNode::BMessageFieldNode::GetType() const
|
||||
|
||||
|
||||
status_t
|
||||
BMessageValueNode::BMessageFieldNode::CreateChildren()
|
||||
BMessageValueNode::BMessageFieldNode::CreateChildren(TeamTypeInformation* info)
|
||||
{
|
||||
Type* type = NULL;
|
||||
status_t error = fParent->_GetTypeForTypeCode(fFieldType, type);
|
||||
status_t error = fParent->_GetTypeForTypeCode(info, fFieldType, type);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
BReference<Type> typeRef(type, true);
|
||||
for (int32 i = 0; i < fFieldCount; i++) {
|
||||
BMessageFieldNodeChild* child = new(std::nothrow)
|
||||
BMessageFieldNodeChild(fParent, type, fName, fFieldType, fFieldCount, i);
|
||||
BMessageFieldNodeChild(fParent, type, fName, fFieldType,
|
||||
fFieldCount, i);
|
||||
|
||||
if (child == NULL)
|
||||
return B_NO_MEMORY;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2011-2015, Rene Gollent, rene@gollent.com.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef BMESSAGE_VALUE_NODE_H
|
||||
@ -19,8 +19,8 @@ class CompoundType;
|
||||
|
||||
class BMessageValueNode : public ValueNode {
|
||||
public:
|
||||
BMessageValueNode(ValueNodeChild* nodeChild,
|
||||
Type* type);
|
||||
BMessageValueNode(
|
||||
ValueNodeChild* nodeChild, Type* type);
|
||||
virtual ~BMessageValueNode();
|
||||
|
||||
virtual Type* GetType() const;
|
||||
@ -31,13 +31,15 @@ public:
|
||||
|
||||
virtual bool ChildCreationNeedsValue() const
|
||||
{ return true; }
|
||||
virtual status_t CreateChildren();
|
||||
virtual status_t CreateChildren(TeamTypeInformation* info);
|
||||
virtual int32 CountChildren() const;
|
||||
virtual ValueNodeChild* ChildAt(int32 index) const;
|
||||
|
||||
private:
|
||||
|
||||
status_t _GetTypeForTypeCode(type_code type,
|
||||
status_t _GetTypeForTypeCode(
|
||||
TeamTypeInformation* info,
|
||||
type_code type,
|
||||
Type*& _type);
|
||||
status_t _FindField(const char* name,
|
||||
type_code type,
|
||||
@ -61,7 +63,6 @@ private:
|
||||
private:
|
||||
Type* fType;
|
||||
ChildNodeList fChildren;
|
||||
ValueLoader* fLoader;
|
||||
BVariant fDataLocation;
|
||||
BMessage::message_header*
|
||||
fHeader;
|
||||
@ -89,7 +90,7 @@ public:
|
||||
ValueLocation *& _location,
|
||||
Value*& _value);
|
||||
|
||||
virtual status_t CreateChildren();
|
||||
virtual status_t CreateChildren(TeamTypeInformation* info);
|
||||
virtual int32 CountChildren() const;
|
||||
virtual ValueNodeChild* ChildAt(int32 index) const;
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -191,7 +192,7 @@ CompoundValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
|
||||
|
||||
|
||||
status_t
|
||||
CompoundValueNode::CreateChildren()
|
||||
CompoundValueNode::CreateChildren(TeamTypeInformation* info)
|
||||
{
|
||||
if (!fChildren.IsEmpty())
|
||||
return B_OK;
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015, Rene Gollent, rene@gollent.com.
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
@ -29,7 +30,7 @@ public:
|
||||
|
||||
// locking required
|
||||
|
||||
virtual status_t CreateChildren();
|
||||
virtual status_t CreateChildren(TeamTypeInformation* info);
|
||||
virtual int32 CountChildren() const;
|
||||
virtual ValueNodeChild* ChildAt(int32 index) const;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user