��UIDef���String,Color Table
| 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 | { |
no test coverage detected