コード例 #1
0
ファイル: loaderpatcher.hpp プロジェクト: DmitrySigaev/ncbi
 static string GetLoaderNameFromArgs(CRef<CDataLoader>    data_loader,
                                     CRef<IEditsDBEngine> db_engine,
                                     CRef<IEditSaver>     saver)
 {
     return GetLoaderNameFromArgs(SParam(data_loader, db_engine, saver));
 }
コード例 #2
0
// parseWeapon
void CGameConfig::parseWeapon(io::IXMLReader* xmlRead)
{
	m_gameWeapon.push_back(SWeaponInfo());	
	SWeaponInfo& weapon = m_gameWeapon.back();

	int readState = 0;
	const wchar_t* type = xmlRead->getAttributeValue(L"type");

	char typeA[512];
	uiString::convertUnicodeToUTF8(type, typeA);
	weapon.type = typeA;

	while ( xmlRead->read() )
	{
		switch (xmlRead->getNodeType())
		{		
		case io::EXN_ELEMENT:
			{
				const wchar_t* nodeName = xmlRead->getNodeName();
				
				if ( nodeName == std::wstring(L"name") )
					readState = 1;
				else if ( nodeName == std::wstring(L"model") )
					readState = 2;
				else if ( nodeName == std::wstring(L"snap") )
					readState = 3;
				else if ( nodeName == std::wstring(L"muzzle") )
					readState = 4;
				else if ( nodeName == std::wstring(L"param") )
				{
					const wchar_t* name		= xmlRead->getAttributeValue(L"name");
					const wchar_t* value	= xmlRead->getAttributeValue(L"value");
					
					char nameA[512];
					char valueA[512];

					uiString::convertUnicodeToUTF8(name, nameA);
					uiString::convertUnicodeToUTF8(value, valueA);

					weapon.params.push_back( SParam(nameA, valueA) );
				}
			}
			break;
		case io::EXN_ELEMENT_END:
			{
				const wchar_t* nodeName = xmlRead->getNodeName();
				if ( nodeName == std::wstring(L"weapon") )
					return;
			}
			break;
		case io::EXN_TEXT:
			{
				const wchar_t* text = xmlRead->getNodeData();
				char textA[512];
				uiString::convertUnicodeToUTF8(text, textA);
				
				if ( readState == 1 )
					weapon.name = textA;
				else if ( readState == 2 )
					weapon.model = textA;
				else if ( readState == 3 )
					weapon.snap = textA;
				else if ( readState == 4 )
					weapon.muzzle = textA;

				readState = 0;
			}
			break;
		}
	}
}