Exemplo n.º 1
0
	ObjectHandle findFirstMetaData(
		const TypeId& typeId, const MetaData & metaData,
		const IDefinitionManager & definitionManager) override
	{
		auto targetDefinition = definitionManager.getDefinition(typeId.getName());
		return targetDefinition ? findFirstMetaData(*targetDefinition, metaData, definitionManager) : nullptr;
	}
Exemplo n.º 2
0
//==============================================================================
void CompoundCommand::initDisplayData(IDefinitionManager& defManager, IReflectionController* controller)
{
	auto cmdSysProvider = getCommandSystemProvider();
	assert(cmdSysProvider != nullptr);
	const auto pDefinition = defManager.getDefinition(getClassIdentifier<MacroObject>());
	assert(pDefinition != nullptr);

	macroObject_ = defManager.create<MacroObject>(false);
	macroObject_->init(*cmdSysProvider, defManager, controller, id_.c_str());
}
Exemplo n.º 3
0
	//------------------------------------------------------------------------------
	void forEachMetaData(
		const TypeId& typeId, const MetaData & metaData,
		const IDefinitionManager & definitionManager, MetaDataCallback callback) override
	{
		auto targetDefinition = definitionManager.getDefinition(typeId.getName());
		if (targetDefinition == nullptr)
		{
			return;
		}
		forEachMetaData(*targetDefinition, metaData, definitionManager, callback);
	}
Exemplo n.º 4
0
	//==========================================================================
	void Initialise(IComponentContext& contextManager) override
	{
		// register reflected type definition
		IDefinitionManager* defManager = contextManager.queryInterface<IDefinitionManager>();
		assert(defManager != nullptr);

		this->initReflectedTypes(*defManager);
		auto pDefinition = defManager->getDefinition(getClassIdentifier<ProjectManager>());
		assert(pDefinition != nullptr);
		projectManager_ = pDefinition->create();
		projectManager_.getBase<ProjectManager>()->init(contextManager);

		auto uiFramework = contextManager.queryInterface<IUIFramework>();
		auto uiApplication = contextManager.queryInterface<IUIApplication>();
		assert(uiFramework != nullptr && uiApplication != nullptr);
		uiFramework->loadActionData(":/TestingProjectControl/actions.xml", IUIFramework::ResourceType::File);

		newProject_ = uiFramework->createAction("NewProject", std::bind(&EnvrionmentTestPlugin::newProject, this));

		openProject_ = uiFramework->createAction("OpenProject", std::bind(&EnvrionmentTestPlugin::openProject, this),
		                                         std::bind(&EnvrionmentTestPlugin::canOpen, this));

		saveProject_ = uiFramework->createAction("SaveProject", std::bind(&EnvrionmentTestPlugin::saveProject, this),
		                                         std::bind(&EnvrionmentTestPlugin::canSave, this));

		closeProject_ = uiFramework->createAction("CloseProject", std::bind(&EnvrionmentTestPlugin::closeProject, this),
		                                          std::bind(&EnvrionmentTestPlugin::canClose, this));

		uiApplication->addAction(*newProject_);
		uiApplication->addAction(*openProject_);
		uiApplication->addAction(*saveProject_);
		uiApplication->addAction(*closeProject_);

		auto viewCreator = get<IViewCreator>();
		if (viewCreator)
		{
			viewCreator->createWindow(
			"TestingProjectControl/NewProjectDialog.qml", projectManager_, [this](std::unique_ptr<IWindow>& window) {
				newProjectDialog_ = std::move(window);
				if (newProjectDialog_ != nullptr)
				{
					connections_ +=
					newProjectDialog_->signalClose.connect(std::bind(&EnvrionmentTestPlugin::onNewDlgClose, this));
				}
			});
		}
	}
Exemplo n.º 5
0
	//------------------------------------------------------------------------------
	void forEachMetaData(
		const IClassDefinition & targetDefinition, const MetaData & metaData,
		const IDefinitionManager & definitionManager, MetaDataCallback callback) override
	{
		auto meta = &metaData;
		while (*meta != nullptr)
		{
			auto root = reflectedRoot(meta->getHandle(), definitionManager);
			auto rootDefinition = definitionManager.getDefinition(root.type().getName());
			TF_ASSERT(rootDefinition != nullptr);
			if (rootDefinition->canBeCastTo(targetDefinition))
			{
				callback(meta->getHandle());
			}
			meta = &meta->next();
		}
	}
Exemplo n.º 6
0
	//--------------------------------------------------------------------------
	ObjectHandle findFirstMetaData(
		const IClassDefinition& targetDefinition, const MetaData & metaData,
		const IDefinitionManager & definitionManager) override
	{
		auto meta = &metaData;
		while (*meta != nullptr)
		{
			auto root = reflectedRoot(meta->getHandle(), definitionManager);
			auto rootDefinition = definitionManager.getDefinition(root.type().getName());
			TF_ASSERT(rootDefinition != nullptr);
			if (rootDefinition->canBeCastTo(targetDefinition))
			{
				return meta->getHandle();
			}
			meta = &meta->next();
		}
		return nullptr;
	}
Exemplo n.º 7
0
void XMLReader::StackItem::cast(IDefinitionManager& definitionManager)
{
	object = ObjectHandle();
	collection = nullptr;

	if (auto v = value.value<ObjectHandle*>())
	{
		object = *v;
	}
	else if (auto v = value.value<Collection*>())
	{
		collection = v;
	}
	else
	{
		if (auto definition = definitionManager.getDefinition(value.type()->typeId().getName()))
		{
			object = ObjectHandle(&value, definition);
		}
	}
}