Пример #1
0
 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);
         }
     }
Пример #2
0
    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
        }
Пример #3
0
    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;
    }