other-licenses/7zstub/src/7zip/UI/Common/ArchiveOpenCallback.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/other-licenses/7zstub/src/7zip/UI/Common/ArchiveOpenCallback.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,87 @@
     1.4 +// ArchiveOpenCallback.h
     1.5 +
     1.6 +#ifndef __ARCHIVE_OPEN_CALLBACK_H
     1.7 +#define __ARCHIVE_OPEN_CALLBACK_H
     1.8 +
     1.9 +#include "Common/String.h"
    1.10 +#include "Common/MyCom.h"
    1.11 +#include "Windows/FileFind.h"
    1.12 +
    1.13 +#ifndef _NO_CRYPTO
    1.14 +#include "../../IPassword.h"
    1.15 +#endif  
    1.16 +#include "../../Archive/IArchive.h"
    1.17 +
    1.18 +struct IOpenCallbackUI
    1.19 +{
    1.20 +  virtual HRESULT CheckBreak() = 0;
    1.21 +  virtual HRESULT SetTotal(const UInt64 *files, const UInt64 *bytes) = 0;
    1.22 +  virtual HRESULT SetCompleted(const UInt64 *files, const UInt64 *bytes) = 0;
    1.23 +  #ifndef _NO_CRYPTO
    1.24 +  virtual HRESULT CryptoGetTextPassword(BSTR *password) = 0;
    1.25 +  virtual HRESULT GetPasswordIfAny(UString &password) = 0;
    1.26 +  #endif  
    1.27 +};
    1.28 +
    1.29 +class COpenCallbackImp: 
    1.30 +  public IArchiveOpenCallback,
    1.31 +  public IArchiveOpenVolumeCallback,
    1.32 +  public IArchiveOpenSetSubArchiveName,
    1.33 +  #ifndef _NO_CRYPTO
    1.34 +  public ICryptoGetTextPassword,
    1.35 +  #endif  
    1.36 +  public CMyUnknownImp
    1.37 +{
    1.38 +public:
    1.39 +  #ifndef _NO_CRYPTO
    1.40 +  MY_UNKNOWN_IMP3(
    1.41 +      IArchiveOpenVolumeCallback, 
    1.42 +      ICryptoGetTextPassword,
    1.43 +      IArchiveOpenSetSubArchiveName
    1.44 +      )
    1.45 +  #else
    1.46 +  MY_UNKNOWN_IMP2(
    1.47 +      IArchiveOpenVolumeCallback, 
    1.48 +      IArchiveOpenSetSubArchiveName
    1.49 +      )
    1.50 +  #endif
    1.51 +
    1.52 +  STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes);
    1.53 +  STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes);
    1.54 +
    1.55 +  // IArchiveOpenVolumeCallback
    1.56 +  STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value);
    1.57 +  STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream);
    1.58 +
    1.59 +  #ifndef _NO_CRYPTO
    1.60 +  // ICryptoGetTextPassword
    1.61 +  STDMETHOD(CryptoGetTextPassword)(BSTR *password);
    1.62 +  #endif
    1.63 +
    1.64 +  STDMETHOD(SetSubArchiveName(const wchar_t *name))
    1.65 +  {
    1.66 +    _subArchiveMode = true;
    1.67 +    _subArchiveName = name;
    1.68 +    return  S_OK;
    1.69 +  }
    1.70 +
    1.71 +private:
    1.72 +  UString _folderPrefix;
    1.73 +  NWindows::NFile::NFind::CFileInfoW _fileInfo;
    1.74 +  bool _subArchiveMode;
    1.75 +  UString _subArchiveName;
    1.76 +public:
    1.77 +  UStringVector FileNames;
    1.78 +  IOpenCallbackUI *Callback;
    1.79 +  void Init(const UString &folderPrefix,  const UString &fileName)
    1.80 +  {
    1.81 +    _folderPrefix = folderPrefix;
    1.82 +    if (!NWindows::NFile::NFind::FindFile(_folderPrefix + fileName, _fileInfo))
    1.83 +      throw 1;
    1.84 +    FileNames.Clear();
    1.85 +    _subArchiveMode = false;
    1.86 +  }
    1.87 +  int FindName(const UString &name);
    1.88 +};
    1.89 +
    1.90 +#endif

mercurial