当前位置: 首页>>代码示例>>C++>>正文


C++ CItemEx::IsDirectory方法代码示例

本文整理汇总了C++中CItemEx::IsDirectory方法的典型用法代码示例。如果您正苦于以下问题:C++ CItemEx::IsDirectory方法的具体用法?C++ CItemEx::IsDirectory怎么用?C++ CItemEx::IsDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CItemEx的用法示例。


在下文中一共展示了CItemEx::IsDirectory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Extract

STDMETHODIMP CHandler::Extract(const quint32* indices, quint32 numItems,
                               qint32 _aTestMode, IArchiveExtractCallback *extractCallback)
{
    RefPtr<IArchiveExtractCallback> kungFuGrip(extractCallback);

    CZipDecoder myDecoder;
    bool testMode = (_aTestMode != 0);
    quint64 totalUnPacked = 0, totalPacked = 0;
    bool allFilesMode = (numItems == quint32(-1));
    if (allFilesMode)
        numItems = m_Items.size();
    if (numItems == 0)
        return S_OK;
    quint32 i;
    for (i = 0; i < numItems; i++) {
        const CItemEx &item = *m_Items[allFilesMode ? i : indices[i]];
        totalUnPacked += item.UnPackSize;
        totalPacked += item.PackSize;
    }
    RINOK(extractCallback->SetTotal(totalUnPacked));

    quint64 currentTotalUnPacked = 0, currentTotalPacked = 0;
    quint64 currentItemUnPacked, currentItemPacked;

    for (i = 0; i < numItems; i++, currentTotalUnPacked += currentItemUnPacked,
        currentTotalPacked += currentItemPacked) {
        currentItemUnPacked = 0;
        currentItemPacked = 0;

        qint32 askMode = testMode ?
                         NArchive::NExtract::NAskMode::kTest :
                         NArchive::NExtract::NAskMode::kExtract;
        qint32 index = allFilesMode ? i : indices[i];

        ISequentialOutStream *prealOutStream;
        RINOK(extractCallback->GetStream(index, &prealOutStream, askMode));
        RefPtr<ISequentialOutStream> realOutStream(prealOutStream);

        CItemEx item = *m_Items[index];
        if (!item.FromLocal) {
            HRESULT res = m_Archive.ReadLocalItemAfterCdItem(item);
            if (res == S_FALSE) {
                if (item.IsDirectory() || realOutStream || testMode) {
                    RINOK(extractCallback->PrepareOperation(askMode));
                    realOutStream = 0;
                    RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
                }
                continue;
            }
            RINOK(res);
        }

        if (item.IsDirectory() || item.IgnoreItem()) {
            // if (!testMode)
            {
                RINOK(extractCallback->PrepareOperation(askMode));
                RINOK(extractCallback->SetOperationResult(NArchive::NExtract::NOperationResult::kOK));
            }
            continue;
        }

        currentItemUnPacked = item.UnPackSize;
        currentItemPacked = item.PackSize;

        if (!testMode && (!realOutStream))
            continue;

        RINOK(extractCallback->PrepareOperation(askMode));

        qint32 res;
        RINOK(myDecoder.Decode(
                  m_Archive, item, realOutStream, extractCallback,
                  _numThreads, res));

        RINOK(extractCallback->SetOperationResult(res))
    }
    return S_OK;
}
开发者ID:bks,项目名称:qz7,代码行数:78,代码来源:ZipHandler.cpp


注:本文中的CItemEx::IsDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。