Esempio n. 1
0
ParamBlock* Block::GetParam(E_BlockType t, const char* name)
{
	for (size_t i = 0; i < m_childParams.size(); ++i)
	{
		Block* child = m_childParams[i];
		if (child->GetType() == t && child->GetName() == name)
			return (ParamBlock*)child;
	}
	
	return NULL;
}
Esempio n. 2
0
//When a config or param is specified, then not only will this include content specific to that platform or config, but also all generic platform or config data
void Block::GetParams(ParamVector* result, E_BlockType t, const char* platformName, const char* configName, bool recurseChildParams) const
{
	std::vector<Block*> childrenToProcess;
	
	for (size_t i = 0; i < m_childParams.size(); ++i)
	{
		Block* child = m_childParams[i];
				
		E_BlockType childType = child->GetType();
		
		if (t != E_BlockType_Unknown && childType != t)
			continue;
		
		if (childType == E_BlockType_PlatformParam)
		{
			if (platformName)
			{
				//If we've specified that we want to include only the given platform, and the name of this platform
				//block does not match this then skip this node.
				if (child->GetName() != platformName)
					continue;
			}
			else
			{
				//Specifying null indicates we want all blocks. To exclude platform specific blocks, pass in "" as the platform
			}
		}

		if (childType == E_BlockType_ConfigParam)
		{
			if (configName)
			{
				//If we've specified that we want to include only the given config, and the name of this config
				//block does not match this then skip this node.
				if (child->GetName() != configName)
					continue;
			}
			else
			{
				//Specifying null indicates we want all blocks. To exclude config specific blocks, pass in "" as the config
			}
		}
		
		if (platformName)
		{
			const char* childPlatform = child->GetParentPlatform();
			assert(!childPlatform || strcmp(platformName, childPlatform) == 0);
		}
		if (configName)
		{
			const char* childConfig = child->GetParentConfig();
			assert(!childConfig || strcmp(configName, childConfig) == 0);
		}

		childrenToProcess.push_back(child);
		result->push_back((ParamBlock*)child);
	}
	
	if (recurseChildParams)
	{
		for (size_t i = 0; i < childrenToProcess.size(); ++i)
		{
			Block* child = childrenToProcess[i];
			child->GetParams(result, t, platformName, configName, recurseChildParams);
		}
	}
}