Beispiel #1
0
void CompoundCommand::deserialize(ISerializer& serializer)
{
	size_t size = 0;
	serializer.deserialize(size);

	std::string id;
	for (size_t i = 0; i < size; ++i)
	{
		serializer.deserialize(id);
		addCommand(id.c_str(), ObjectHandle());
	}
	getMacroObject().getBase<MacroObject>()->deserialize(serializer);
}
//==============================================================================
bool ContextDefinitionManager::deserializeDefinitions(ISerializer& serializer)
{
	// load generic definitions
	size_t count = 0;
	serializer.deserialize(count);
	for (size_t i = 0; i < count; i++)
	{
		std::string defName;
		serializer.deserialize(defName);

		std::string parentDefName;
		serializer.deserialize(parentDefName);
		auto pDef = getDefinition(defName.c_str());
		IClassDefinitionModifier* modifier = nullptr;
		if (!pDef)
		{
			auto definition = registerDefinition(createGenericDefinition(defName.c_str()));
			modifier = definition->getDetails().getDefinitionModifier();
		}

		size_t size = 0;
		serializer.deserialize(size);
		std::string propName;
		std::string typeName;
		uint32_t flags;
		for (size_t j = 0; j < size; j++)
		{
			propName.clear();
			typeName.clear();
			serializer.deserialize(propName);
			serializer.deserialize(typeName);
			serializer.deserialize(flags);
			IBasePropertyPtr property = nullptr;
			auto metaType = MetaType::find(typeName.c_str());
			if (modifier)
			{
				bool isCollection = flags & ContextDefinitionManagerDetails::IS_COLLECTION;
				auto property = modifier->addProperty(
				propName.c_str(), metaType != nullptr ? metaType->typeId().getName() : typeName.c_str(), nullptr,
				isCollection);
				// TF_ASSERT( property );
			}
		}
	}
	return true;
}