-class CIdPathMap : public CInputFile, public map<CIdentity, string>\r
-{\r
-public:\r
- CIdPathMap(istream&);\r
-};\r
-\r
-CIdPathMap::CIdPathMap(istream& is)\r
-: CInputFile(is)\r
-{\r
- static const char cszFileSec[] = "[files]";\r
- static const char cszFfsFile[] = "EFI_FILE_NAME";\r
-\r
- string strALine;\r
-\r
- // Find the [files] section\r
- while (!!GetLine(strALine) && strALine.compare(0, sizeof(cszFileSec) - 1, cszFileSec));\r
-\r
- // m_is error means no FFS files listed in this INF file\r
- if (!m_is)\r
- return;\r
-\r
- // Parse FFS files one by one\r
- while (!!GetLine(strALine))\r
- {\r
- // Test if this begins a new section\r
- if (strALine[0] == '[')\r
- break;\r
-\r
- // Is it a line of FFS file?\r
- if (strALine.compare(0, sizeof(cszFfsFile) - 1, cszFfsFile))\r
- continue;\r
-\r
- string::size_type pos = strALine.find_first_not_of(' ', sizeof(cszFfsFile) - 1);\r
- if (pos == string::npos || strALine[pos] != '=')\r
- throw runtime_error(__FUNCTION__ ": Invalid FV INF format");\r
- pos = strALine.find_first_not_of(' ', pos + 1);\r
- if (pos == string::npos)\r
- throw runtime_error(__FUNCTION__ ": Incomplete line");\r
-\r
- strALine.erase(0, pos);\r
- pos = strALine.rfind('\\');\r
- if (pos == string::npos)\r
- pos = 0;\r
- else pos++;\r
-\r
- CIdentity id(strALine.substr(pos, CIdentity::s_nIdStrLen));\r
- if (!insert(value_type(id, strALine)).second)\r
- throw runtime_error(__FUNCTION__ ": Duplicated FFS files");\r
- }\r
-}\r
-\r