/** @param file INI file object to read from @param nPage Number of page to read from @return true if read successfully, false if failed */ bool CCPrintData::PageData::FromFile(class FileINI& file, int nPage) { // Variables TCHAR cName[32]; TCHARSTR2STR data; TCHARSTR2STR::const_iterator iKey; // Clean this object Clear(); // Get INI key/value pairs from the page's section _stprintf_s(cName, _S(cName), DATAFILE_SECTION_PAGE, nPage); if (!file.GetKeys(cName, data) || ((iKey = data.find(DATAFILE_LINK_COUNT)) == data.end())) // None found, just go on return true; // Get the page link count int nLinkCount = _ttoi((*iKey).second.c_str()); if (nLinkCount < 1) // This shouldn't happen return false; // Read all links for (int iLink = 1; iLink <= nLinkCount; iLink++) { LinkData link; if (link.FromFile(data, iLink)) push_back(link); } // Get page width and height if we found them if ((iKey = data.find(DATAFILE_PAGE_WIDTH)) != data.end()) szPage.cx = _ttoi((*iKey).second.c_str()); if ((iKey = data.find(DATAFILE_PAGE_HEIGHT)) != data.end()) szPage.cy = _ttoi((*iKey).second.c_str()); return true; }