MCPcopy Create free account
hub / github.com/SOUI2/soui / ParseUIDefFile

Function ParseUIDefFile

tools/src/uiresbuilder/residbuilder.cpp:433–524  ·  view source on GitHub ↗

��UIDef���String,Color Table

Source from the content-addressed store, hash-verified

431
432//��UIDef���String,Color Table
433__int64 ParseUIDefFile(map<string,string> &mapFiles, const wchar_t * pszFileName,map<string,int> &mapString,map<string,int> &mapColor)
434{
435 TiXmlDocument xmlUidef;
436 __int64 tmStamp = 0;
437
438 if(xmlUidef.LoadFile(pszFileName))
439 {
440 TiXmlElement *pXmlNode = xmlUidef.RootElement();
441 if(stricmp(pXmlNode->Value(),"uidef")==0)
442 {
443 //���� string table
444 TiXmlElement *pXmlString = pXmlNode->FirstChildElement("string");
445 if(pXmlString)
446 {
447 TiXmlDocument docString;
448 if(pXmlString->Attribute("src")!=NULL)
449 {
450 map<string,string>::iterator it = mapFiles.find(pXmlString->Attribute("src"));
451 if(it == mapFiles.end())
452 {
453 printf("error: can't find string table file that specified by src attribute");
454 pXmlString = NULL;
455 }else
456 {
457 tmStamp += GetLastWriteTime(it->second.c_str());
458 docString.LoadFile(it->second.c_str());
459 pXmlString = docString.FirstChildElement("string");
460 }
461 }
462 if(pXmlString)
463 {
464 TiXmlElement *pStrEle = pXmlString->FirstChildElement();
465 while(pStrEle)
466 {
467 string strName = pStrEle->Value();
468 //Ҫ��֤�ַ�����������Ψһ
469 if(mapString.find(strName)!=mapString.end())
470 {
471 mapString.clear();
472 printf("error: two string nodes in string table have the same name of [%s]!!!",strName.c_str());
473 break;
474 }
475 mapString[strName] = 1;
476 pStrEle = pStrEle->NextSiblingElement();
477 }
478 }
479 }
480
481 //���� color table
482 TiXmlElement *pXmlColor = pXmlNode->FirstChildElement("color");
483 if(pXmlColor)
484 {
485 TiXmlDocument docColor;
486 if(pXmlColor->Attribute("src")!=NULL)
487 {
488 map<string,string>::iterator it = mapFiles.find(pXmlColor->Attribute("src"));
489 if(it == mapFiles.end())
490 {

Callers 1

_tmainFunction · 0.85

Calls 11

GetLastWriteTimeFunction · 0.85
RootElementMethod · 0.80
AttributeMethod · 0.80
LoadFileMethod · 0.45
ValueMethod · 0.45
FirstChildElementMethod · 0.45
findMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
clearMethod · 0.45
NextSiblingElementMethod · 0.45

Tested by

no test coverage detected