ChmTocBuilder(ChmDoc *doc, WStrList *pages, Vec<ChmTocTraceItem> *tocTrace, Allocator *allocator) : doc(doc), pages(pages), tocTrace(tocTrace), allocator(allocator) { for (int i = 0; i < (int)pages->Count(); i++) { const WCHAR *url = pages->At(i); bool inserted = urlsSet.Insert(url, i + 1, NULL); CrashIf(!inserted); } }
ChmTocBuilder(ChmDoc *doc, WStrList *pages, ChmTocItem **root) : doc(doc), pages(pages), root(root), idCounter(0) { #ifdef USE_STR_INT_MAP for (size_t i = 0; i < pages->Count(); i++) { const WCHAR *url = pages->At(i); bool inserted = urlsSet.Insert(url, i + 1, NULL); CrashIf(!inserted); } #endif }
int CreatePageNoForURL(const WCHAR *url) { if (!url || IsExternalUrl(url)) return 0; ScopedMem<WCHAR> plainUrl(str::ToPlainUrl(url)); int pageNo = pages->Count() + 1; bool inserted = urlsSet.Insert(plainUrl, pageNo, &pageNo); if (inserted) { pages->Append(plainUrl.StealData()); CrashIf(pageNo != pages->Count()); } else { CrashIf(pageNo == pages->Count() + 1); } return pageNo; }