Mercurial > vba-linux
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:8ced16adf2e1 | 1:f9f4f1b99eed |
---|---|
1 // ProgressUtils.h | |
2 | |
3 #include "StdAfx.h" | |
4 | |
5 #include "ProgressUtils.h" | |
6 | |
7 CLocalProgress::CLocalProgress() | |
8 { | |
9 ProgressOffset = InSize = OutSize = 0; | |
10 SendRatio = SendProgress = true; | |
11 } | |
12 | |
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 } | |
20 | |
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 } | |
38 | |
39 HRESULT CLocalProgress::SetCur() | |
40 { | |
41 return SetRatioInfo(NULL, NULL); | |
42 } |