void MainWindow::ChunksToDisplay(CIffHeader *pHead, QTreeWidgetItem *pTopItem) { // root-level chunk-nodes CIffChunk *pChunk = pHead->m_pFirst; while (pChunk != nullptr) { QTreeWidgetItem *pChunkItem = new QTreeWidgetItem(pTopItem); pChunkItem->setText(0, IdToString(pChunk->m_iChunkID)); pChunkItem->setText(1, QString::number(pChunk->m_iOffset)); pChunkItem->setText(2, QString::number(pChunk->m_iChunkSize)); pTopItem->addChild(pChunkItem); CIffSubChunk *pSubChunk = pChunk->m_pSubChunk; while (pSubChunk != nullptr) { QTreeWidgetItem *pSubItem = new QTreeWidgetItem(pChunkItem); pSubItem->setText(0, IdToString(pSubChunk->m_iChunkID)); pSubItem->setText(1, QString::number(pSubChunk->m_iOffset)); pSubItem->setText(2, QString::number(pSubChunk->m_iSize)); pChunkItem->addChild(pSubItem); pSubChunk = pSubChunk->m_pNextSub; } pChunk = pChunk->m_pNext; } }
void MainWindow::onFileSelected(QString szArchiveFile) { ClearAll(); std::wstring szFile = szArchiveFile.toStdWString(); CMemoryMappedFile File; if (File.Create(szFile.c_str()) == false) { ui->statusBar->showMessage("Failure opening file"); return; } CIffContainer Iff; CIffHeader *pHead = Iff.ParseIffFile(File); if (pHead == nullptr) { ui->statusBar->showMessage("No supported header"); return; } setWindowTitle(m_szBaseTitle + " - " + szArchiveFile); QString szMsg; szMsg.append("File size: ").append(QString::number(File.GetSize())) .append(" File type: ").append(IdToString(pHead->m_iTypeID)); ui->statusBar->showMessage(szMsg); // file head-chunk QString szIdString; szIdString = IdToString(pHead->m_iFileID); szIdString += "="; szIdString += IdToString(pHead->m_iTypeID); QTreeWidgetItem *pTopItem = new QTreeWidgetItem((QTreeWidgetItem*)0); pTopItem->setText(0, IdToString(pHead->m_iTypeID)); //pTopItem->setText(0, szIdString); pTopItem->setText(1, QString::number(pHead->m_iOffset)); pTopItem->setText(2, QString::number(pHead->m_iDataSize)); ui->treeWidget->addTopLevelItem(pTopItem); m_FormToItem.insert(pHead, pTopItem); CIffHeader *pComposite = pHead->m_pComposite; while (pComposite != nullptr) { HeaderToDisplay(pComposite); pComposite = pComposite->m_pComposite; } ChunksToDisplay(pHead, pTopItem); ui->treeWidget->expandAll(); ui->treeWidget->resizeColumnToContents(0); //ui->treeWidget->sortByColumn(1); }
void MainWindow::HeaderToDisplay(CIffHeader *pHead) { // note: should have parent when this method is called.. QTreeWidgetItem *pTopItem = m_FormToItem.value(pHead, nullptr); if (pTopItem == nullptr) { // need to rethink.. // note: parent should be added first.. //QTreeWidgetItem *pParent = m_FormToItem.value(pHead->m_pParent, nullptr); //pTopItem = new QTreeWidgetItem(pParent); pTopItem = new QTreeWidgetItem((QTreeWidgetItem*)0); pTopItem->setText(0, IdToString(pHead->m_iTypeID)); pTopItem->setText(1, QString::number(pHead->m_iOffset)); pTopItem->setText(2, QString::number(pHead->m_iDataSize)); //pParent->addChild(pTopItem); m_FormToItem.insert(pHead, pTopItem); } ChunksToDisplay(pHead, pTopItem); }
BOOL CALLBACK EnumLangProc( HMODULE Module, PCWSTR Type, PCWSTR Name, WORD Language, LONG Param ) { WCHAR TypeBuffer[20]; WCHAR NameBuffer[20]; wprintf( L"module:%p type:%ls name:%ls lang:%x\n", Module, IdToString(Type, TypeBuffer, NUMBER_OF(TypeBuffer)), IdToString(Name, NameBuffer, NUMBER_OF(NameBuffer)), Language); return TRUE; }
BEGIN_NCBI_SCOPE //------------------------------------------------------------------------- void CMaskWriterTabular::Print( objects::CBioseq_Handle& bsh, const TMaskList & mask, bool parsed_id ) { const string id = IdToString(bsh, parsed_id); ITERATE(TMaskList, i, mask) { os << id << "\t" << i->first << "\t" << i->second << "\n"; } }
BOOL CALLBACK EnumTypesProc( HMODULE Module, PWSTR Type, LONG Param ) { if (!EnumResourceNamesW(Module, Type = Uppercase(Type), EnumNamesProc, 0)) { WCHAR Buffer[20]; DWORD Error = GetLastError(); wprintf(L"EnumResourceNames(%p, %x %ls) failed %x\n", Module, Type, IdToString(Type, Buffer, NUMBER_OF(Buffer)), Error); } return TRUE; }