diff src/win32/7zip/7z/CPP/7zip/Archive/IArchive.h @ 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/win32/7zip/7z/CPP/7zip/Archive/IArchive.h	Sat Mar 03 10:31:27 2012 -0600
     1.3 @@ -0,0 +1,237 @@
     1.4 +// IArchive.h
     1.5 +
     1.6 +#ifndef __IARCHIVE_H
     1.7 +#define __IARCHIVE_H
     1.8 +
     1.9 +#include "../IStream.h"
    1.10 +#include "../IProgress.h"
    1.11 +#include "../PropID.h"
    1.12 +
    1.13 +#define ARCHIVE_INTERFACE_SUB(i, base, x) DECL_INTERFACE_SUB(i, base, 6, x)
    1.14 +#define ARCHIVE_INTERFACE(i, x) ARCHIVE_INTERFACE_SUB(i, IUnknown, x)
    1.15 +
    1.16 +namespace NFileTimeType
    1.17 +{
    1.18 +  enum EEnum
    1.19 +  {
    1.20 +    kWindows,
    1.21 +    kUnix,
    1.22 +    kDOS
    1.23 +  };
    1.24 +}
    1.25 +
    1.26 +namespace NArchive
    1.27 +{
    1.28 +  enum
    1.29 +  {
    1.30 +    kName = 0,
    1.31 +    kClassID,
    1.32 +    kExtension,
    1.33 +    kAddExtension,
    1.34 +    kUpdate,
    1.35 +    kKeepName,
    1.36 +    kStartSignature,
    1.37 +    kFinishSignature,
    1.38 +    kAssociate
    1.39 +  };
    1.40 +
    1.41 +  namespace NExtract
    1.42 +  {
    1.43 +    namespace NAskMode
    1.44 +    {
    1.45 +      enum
    1.46 +      {
    1.47 +        kExtract = 0,
    1.48 +        kTest,
    1.49 +        kSkip
    1.50 +      };
    1.51 +    }
    1.52 +    namespace NOperationResult
    1.53 +    {
    1.54 +      enum
    1.55 +      {
    1.56 +        kOK = 0,
    1.57 +        kUnSupportedMethod,
    1.58 +        kDataError,
    1.59 +        kCRCError
    1.60 +      };
    1.61 +    }
    1.62 +  }
    1.63 +  namespace NUpdate
    1.64 +  {
    1.65 +    namespace NOperationResult
    1.66 +    {
    1.67 +      enum
    1.68 +      {
    1.69 +        kOK = 0,
    1.70 +        kError
    1.71 +      };
    1.72 +    }
    1.73 +  }
    1.74 +}
    1.75 +
    1.76 +#define INTERFACE_IArchiveOpenCallback(x) \
    1.77 +  STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes) x; \
    1.78 +  STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes) x; \
    1.79 +
    1.80 +ARCHIVE_INTERFACE(IArchiveOpenCallback, 0x10)
    1.81 +{
    1.82 +  INTERFACE_IArchiveOpenCallback(PURE);
    1.83 +};
    1.84 +
    1.85 +
    1.86 +#define INTERFACE_IArchiveExtractCallback(x) \
    1.87 +  INTERFACE_IProgress(x) \
    1.88 +  /* GetStream OUT: S_OK - OK, S_FALSE - skeep this file */ \
    1.89 +  STDMETHOD(GetStream)(UInt32 index, ISequentialOutStream **outStream,  Int32 askExtractMode) x; \
    1.90 +  STDMETHOD(PrepareOperation)(Int32 askExtractMode) x; \
    1.91 +  STDMETHOD(SetOperationResult)(Int32 resultEOperationResult) x; \
    1.92 +
    1.93 +ARCHIVE_INTERFACE_SUB(IArchiveExtractCallback, IProgress, 0x20)
    1.94 +{
    1.95 +  INTERFACE_IArchiveExtractCallback(PURE)
    1.96 +};
    1.97 +
    1.98 +
    1.99 +#define INTERFACE_IArchiveOpenVolumeCallback(x) \
   1.100 +  STDMETHOD(GetProperty)(PROPID propID, PROPVARIANT *value) x; \
   1.101 +  STDMETHOD(GetStream)(const wchar_t *name, IInStream **inStream) x; \
   1.102 +
   1.103 +ARCHIVE_INTERFACE(IArchiveOpenVolumeCallback, 0x30)
   1.104 +{
   1.105 +  INTERFACE_IArchiveOpenVolumeCallback(PURE);
   1.106 +};
   1.107 +
   1.108 +
   1.109 +ARCHIVE_INTERFACE(IInArchiveGetStream, 0x40)
   1.110 +{
   1.111 +  STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **stream) PURE;
   1.112 +};
   1.113 +
   1.114 +
   1.115 +ARCHIVE_INTERFACE(IArchiveOpenSetSubArchiveName, 0x50)
   1.116 +{
   1.117 +  STDMETHOD(SetSubArchiveName)(const wchar_t *name) PURE;
   1.118 +};
   1.119 +
   1.120 +
   1.121 +/*
   1.122 +IInArchive::Extract:
   1.123 +  indices must be sorted
   1.124 +  numItems = 0xFFFFFFFF means "all files"
   1.125 +  testMode != 0 means "test files without writing to outStream"
   1.126 +*/
   1.127 +
   1.128 +#define INTERFACE_IInArchive(x) \
   1.129 +  STDMETHOD(Open)(IInStream *stream, const UInt64 *maxCheckStartPosition, IArchiveOpenCallback *openArchiveCallback) x; \
   1.130 +  STDMETHOD(Close)() x; \
   1.131 +  STDMETHOD(GetNumberOfItems)(UInt32 *numItems) x; \
   1.132 +  STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) x; \
   1.133 +  STDMETHOD(Extract)(const UInt32* indices, UInt32 numItems, Int32 testMode, IArchiveExtractCallback *extractCallback) x; \
   1.134 +  STDMETHOD(GetArchiveProperty)(PROPID propID, PROPVARIANT *value) x; \
   1.135 +  STDMETHOD(GetNumberOfProperties)(UInt32 *numProperties) x; \
   1.136 +  STDMETHOD(GetPropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x; \
   1.137 +  STDMETHOD(GetNumberOfArchiveProperties)(UInt32 *numProperties) x; \
   1.138 +  STDMETHOD(GetArchivePropertyInfo)(UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) x;
   1.139 +
   1.140 +ARCHIVE_INTERFACE(IInArchive, 0x60)
   1.141 +{
   1.142 +  INTERFACE_IInArchive(PURE)
   1.143 +  virtual ~IInArchive() {}
   1.144 +};
   1.145 +
   1.146 +
   1.147 +#define INTERFACE_IArchiveUpdateCallback(x) \
   1.148 +  INTERFACE_IProgress(x); \
   1.149 +  STDMETHOD(GetUpdateItemInfo)(UInt32 index,  \
   1.150 +      Int32 *newData, /*1 - new data, 0 - old data */ \
   1.151 +      Int32 *newProperties, /* 1 - new properties, 0 - old properties */ \
   1.152 +      UInt32 *indexInArchive /* -1 if there is no in archive, or if doesn't matter */ \
   1.153 +      )  x; \
   1.154 +  STDMETHOD(GetProperty)(UInt32 index, PROPID propID, PROPVARIANT *value) x; \
   1.155 +  STDMETHOD(GetStream)(UInt32 index, ISequentialInStream **inStream) x; \
   1.156 +  STDMETHOD(SetOperationResult)(Int32 operationResult) x; \
   1.157 +
   1.158 +ARCHIVE_INTERFACE_SUB(IArchiveUpdateCallback, IProgress, 0x80)
   1.159 +{
   1.160 +  INTERFACE_IArchiveUpdateCallback(PURE);
   1.161 +};
   1.162 +
   1.163 +#define INTERFACE_IArchiveUpdateCallback2(x) \
   1.164 +  INTERFACE_IArchiveUpdateCallback(x) \
   1.165 +  STDMETHOD(GetVolumeSize)(UInt32 index, UInt64 *size) x; \
   1.166 +  STDMETHOD(GetVolumeStream)(UInt32 index, ISequentialOutStream **volumeStream) x; \
   1.167 +
   1.168 +ARCHIVE_INTERFACE_SUB(IArchiveUpdateCallback2, IArchiveUpdateCallback, 0x82)
   1.169 +{
   1.170 +  INTERFACE_IArchiveUpdateCallback2(PURE);
   1.171 +};
   1.172 +
   1.173 +
   1.174 +#ifndef EXTRACT_ONLY
   1.175 +#define INTERFACE_IOutArchive(x) \
   1.176 +  STDMETHOD(UpdateItems)(ISequentialOutStream *outStream, UInt32 numItems, IArchiveUpdateCallback *updateCallback) x; \
   1.177 +  STDMETHOD(GetFileTimeType)(UInt32 *type) x;
   1.178 +#else
   1.179 +#define INTERFACE_IOutArchive(x)
   1.180 +#endif
   1.181 +
   1.182 +ARCHIVE_INTERFACE(IOutArchive, 0xA0)
   1.183 +{
   1.184 +#ifndef EXTRACT_ONLY
   1.185 +  INTERFACE_IOutArchive(PURE)
   1.186 +#endif
   1.187 +};
   1.188 +
   1.189 +
   1.190 +ARCHIVE_INTERFACE(ISetProperties, 0x03)
   1.191 +{
   1.192 +#ifndef EXTRACT_ONLY
   1.193 +  STDMETHOD(SetProperties)(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) PURE;
   1.194 +#endif
   1.195 +};
   1.196 +
   1.197 +
   1.198 +#define IMP_IInArchive_GetProp(k) \
   1.199 +  (UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) \
   1.200 +    { if(index >= sizeof(k) / sizeof(k[0])) return E_INVALIDARG; \
   1.201 +    const STATPROPSTG &srcItem = k[index]; \
   1.202 +    *propID = srcItem.propid; *varType = srcItem.vt; *name = 0; return S_OK; } \
   1.203 +
   1.204 +#define IMP_IInArchive_GetProp_WITH_NAME(k) \
   1.205 +  (UInt32 index, BSTR *name, PROPID *propID, VARTYPE *varType) \
   1.206 +    { if(index >= sizeof(k) / sizeof(k[0])) return E_INVALIDARG; \
   1.207 +    const STATPROPSTG &srcItem = k[index]; \
   1.208 +    *propID = srcItem.propid; *varType = srcItem.vt; \
   1.209 +    if (srcItem.lpwstrName == 0) *name = 0; else *name = ::SysAllocString(srcItem.lpwstrName); return S_OK; } \
   1.210 +
   1.211 +#define IMP_IInArchive_Props \
   1.212 +  STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) \
   1.213 +    { *numProperties = sizeof(kProps) / sizeof(kProps[0]); return S_OK; } \
   1.214 +  STDMETHODIMP CHandler::GetPropertyInfo IMP_IInArchive_GetProp(kProps)
   1.215 +
   1.216 +#define IMP_IInArchive_Props_WITH_NAME \
   1.217 +  STDMETHODIMP CHandler::GetNumberOfProperties(UInt32 *numProperties) \
   1.218 +    { *numProperties = sizeof(kProps) / sizeof(kProps[0]); return S_OK; } \
   1.219 +  STDMETHODIMP CHandler::GetPropertyInfo IMP_IInArchive_GetProp_WITH_NAME(kProps)
   1.220 +
   1.221 +
   1.222 +#define IMP_IInArchive_ArcProps \
   1.223 +  STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) \
   1.224 +    { *numProperties = sizeof(kArcProps) / sizeof(kArcProps[0]); return S_OK; } \
   1.225 +  STDMETHODIMP CHandler::GetArchivePropertyInfo IMP_IInArchive_GetProp(kArcProps)
   1.226 +
   1.227 +#define IMP_IInArchive_ArcProps_WITH_NAME \
   1.228 +  STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) \
   1.229 +    { *numProperties = sizeof(kArcProps) / sizeof(kArcProps[0]); return S_OK; } \
   1.230 +  STDMETHODIMP CHandler::GetArchivePropertyInfo IMP_IInArchive_GetProp_WITH_NAME(kArcProps)
   1.231 +
   1.232 +#define IMP_IInArchive_ArcProps_NO \
   1.233 +  STDMETHODIMP CHandler::GetNumberOfArchiveProperties(UInt32 *numProperties) \
   1.234 +    { *numProperties = 0; return S_OK; } \
   1.235 +  STDMETHODIMP CHandler::GetArchivePropertyInfo(UInt32, BSTR *, PROPID *, VARTYPE *) \
   1.236 +    { return E_NOTIMPL; } \
   1.237 +  STDMETHODIMP CHandler::GetArchiveProperty(PROPID, PROPVARIANT *value) \
   1.238 +    { value->vt = VT_EMPTY; return S_OK; }
   1.239 +
   1.240 +#endif