Mercurial > vba-linux
view src/win32/7zip/7z/CPP/7zip/Common/ProgressUtils.cpp @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line source
1 // ProgressUtils.h3 #include "StdAfx.h"5 #include "ProgressUtils.h"7 CLocalProgress::CLocalProgress()8 {9 ProgressOffset = InSize = OutSize = 0;10 SendRatio = SendProgress = true;11 }13 void CLocalProgress::Init(IProgress *progress, bool inSizeIsMain)14 {15 _ratioProgress.Release();16 _progress = progress;17 _progress.QueryInterface(IID_ICompressProgressInfo, &_ratioProgress);18 _inSizeIsMain = inSizeIsMain;19 }21 STDMETHODIMP CLocalProgress::SetRatioInfo(const UInt64 *inSize, const UInt64 *outSize)22 {23 UInt64 inSizeNew = InSize, outSizeNew = OutSize;24 if (inSize)25 inSizeNew += (*inSize);26 if (outSize)27 outSizeNew += (*outSize);28 if (SendRatio && _ratioProgress)29 {30 RINOK(_ratioProgress->SetRatioInfo(&inSizeNew, &outSizeNew));31 }32 inSizeNew += ProgressOffset;33 outSizeNew += ProgressOffset;34 if (SendProgress)35 return _progress->SetCompleted(_inSizeIsMain ? &inSizeNew : &outSizeNew);36 return S_OK;37 }39 HRESULT CLocalProgress::SetCur()40 {41 return SetRatioInfo(NULL, NULL);42 }