1/* 2 * Copyright 2012, Rene Gollent, rene@gollent.com. 3 * Distributed under the terms of the MIT License. 4 */ 5 6 7#include "BListTypeHandler.h" 8 9#include <new> 10 11#include "BListValueNode.h" 12#include "Type.h" 13 14 15BListTypeHandler::~BListTypeHandler() 16{ 17} 18 19 20float 21BListTypeHandler::SupportsType(Type* type) 22{ 23 if (dynamic_cast<CompoundType*>(type) != NULL 24 && (type->Name() == "BList" 25 || type->Name().Compare("BObjectList", 11) == 0)) 26 return 1.0f; 27 28 return 0.0f; 29} 30 31 32status_t 33BListTypeHandler::CreateValueNode(ValueNodeChild* nodeChild, Type* type, 34 ValueNode*& _node) 35{ 36 if (SupportsType(type) == 0.0f) 37 return B_BAD_VALUE; 38 39 ValueNode* node = new(std::nothrow) BListValueNode(nodeChild, 40 type); 41 42 if (node == NULL) 43 return B_NO_MEMORY; 44 45 _node = node; 46 47 return B_OK; 48} 49