Implement special handling for BObjectList.
- BListValueNode now also handles BObjectLists. In the latter's case however, it uses the template type parameters to map the array elements to their actual type. As before, this requires a debug libbe to function.
This commit is contained in:
@@ -21,7 +21,8 @@ float
|
|||||||
BListTypeHandler::SupportsType(Type* type)
|
BListTypeHandler::SupportsType(Type* type)
|
||||||
{
|
{
|
||||||
if (dynamic_cast<CompoundType*>(type) != NULL
|
if (dynamic_cast<CompoundType*>(type) != NULL
|
||||||
&& type->Name() == "BList")
|
&& (type->Name() == "BList"
|
||||||
|
|| type->Name().Compare("BObjectList", 11) == 0))
|
||||||
return 1.0f;
|
return 1.0f;
|
||||||
|
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
|
|||||||
@@ -101,7 +101,8 @@ BListValueNode::BListValueNode(ValueNodeChild* nodeChild,
|
|||||||
:
|
:
|
||||||
ValueNode(nodeChild),
|
ValueNode(nodeChild),
|
||||||
fType(type),
|
fType(type),
|
||||||
fLoader(NULL)
|
fLoader(NULL),
|
||||||
|
fItemCount(0)
|
||||||
{
|
{
|
||||||
fType->AcquireReference();
|
fType->AcquireReference();
|
||||||
}
|
}
|
||||||
@@ -153,6 +154,21 @@ BListValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
|
|||||||
ValueLocation* memberLocation = NULL;
|
ValueLocation* memberLocation = NULL;
|
||||||
CompoundType* baseType = dynamic_cast<CompoundType*>(fType);
|
CompoundType* baseType = dynamic_cast<CompoundType*>(fType);
|
||||||
|
|
||||||
|
if (baseType->CountTemplateParameters()) {
|
||||||
|
// for BObjectList we need to walk up
|
||||||
|
// the hierarchy: BObjectList -> _PointerList_ -> BList
|
||||||
|
baseType = dynamic_cast<CompoundType*>(baseType->BaseTypeAt(0)
|
||||||
|
->GetType());
|
||||||
|
if (baseType == NULL || baseType->Name() != "_PointerList_")
|
||||||
|
return B_BAD_DATA;
|
||||||
|
|
||||||
|
baseType = dynamic_cast<CompoundType*>(baseType->BaseTypeAt(0)
|
||||||
|
->GetType());
|
||||||
|
if (baseType == NULL || baseType->Name() != "BList")
|
||||||
|
return B_BAD_DATA;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
for (int32 i = 0; i < baseType->CountDataMembers(); i++) {
|
for (int32 i = 0; i < baseType->CountDataMembers(); i++) {
|
||||||
DataMember* member = baseType->DataMemberAt(i);
|
DataMember* member = baseType->DataMemberAt(i);
|
||||||
if (strcmp(member->Name(), "fObjectList") == 0) {
|
if (strcmp(member->Name(), "fObjectList") == 0) {
|
||||||
@@ -213,14 +229,30 @@ BListValueNode::ResolvedLocationAndValue(ValueLoader* valueLoader,
|
|||||||
status_t
|
status_t
|
||||||
BListValueNode::CreateChildren()
|
BListValueNode::CreateChildren()
|
||||||
{
|
{
|
||||||
|
if (fItemCount == 0 || fChildrenCreated) {
|
||||||
|
fChildrenCreated = true;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Type* type = NULL;
|
||||||
|
CompoundType* objectType = dynamic_cast<CompoundType*>(fType);
|
||||||
|
if (objectType->CountTemplateParameters() != 0) {
|
||||||
|
AddressType* addressType = NULL;
|
||||||
|
status_t result = objectType->TemplateParameterAt(0)->GetType()
|
||||||
|
->CreateDerivedAddressType(DERIVED_TYPE_POINTER, addressType);
|
||||||
|
if (result != B_OK)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
type = addressType;
|
||||||
|
} else {
|
||||||
BString typeName;
|
BString typeName;
|
||||||
TypeLookupConstraints constraints;
|
TypeLookupConstraints constraints;
|
||||||
constraints.SetTypeKind(TYPE_ADDRESS);
|
constraints.SetTypeKind(TYPE_ADDRESS);
|
||||||
constraints.SetBaseTypeName("void");
|
constraints.SetBaseTypeName("void");
|
||||||
Type* type = NULL;
|
|
||||||
status_t result = fLoader->LookupTypeByName(typeName, constraints, type);
|
status_t result = fLoader->LookupTypeByName(typeName, constraints, type);
|
||||||
if (result != B_OK)
|
if (result != B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
for (int32 i = 0; i < fItemCount && i < kMaxArrayElementCount; i++)
|
for (int32 i = 0; i < fItemCount && i < kMaxArrayElementCount; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user