本文整理汇总了C++中ncom::CPropVariant类的典型用法代码示例。如果您正苦于以下问题:C++ CPropVariant类的具体用法?C++ CPropVariant怎么用?C++ CPropVariant使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPropVariant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadFormats
HRESULT CCodecs::LoadFormats()
{
const NDLL::CLibrary &lib = Libs.Back().Lib;
GetHandlerPropertyFunc getProp = 0;
GetHandlerPropertyFunc2 getProp2 = (GetHandlerPropertyFunc2)
lib.GetProcAddress("GetHandlerProperty2");
if (getProp2 == NULL)
{
getProp = (GetHandlerPropertyFunc)
lib.GetProcAddress("GetHandlerProperty");
if (getProp == NULL)
return S_OK;
}
UInt32 numFormats = 1;
GetNumberOfFormatsFunc getNumberOfFormats = (GetNumberOfFormatsFunc)
lib.GetProcAddress("GetNumberOfFormats");
if (getNumberOfFormats != NULL)
{
RINOK(getNumberOfFormats(&numFormats));
}
if (getProp2 == NULL)
numFormats = 1;
for(UInt32 i = 0; i < numFormats; i++)
{
CArcInfoEx item;
item.LibIndex = Libs.Size() - 1;
item.FormatIndex = i;
RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kName, item.Name));
NCOM::CPropVariant prop;
if (ReadProp(getProp, getProp2, i, NArchive::kClassID, prop) != S_OK)
continue;
if (prop.vt != VT_BSTR)
continue;
item.ClassID = *(const GUID *)prop.bstrVal;
prop.Clear();
UString ext, addExt;
RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kExtension, ext));
RINOK(ReadStringProp(getProp, getProp2, i, NArchive::kAddExtension, addExt));
item.AddExts(ext, addExt);
ReadBoolProp(getProp, getProp2, i, NArchive::kUpdate, item.UpdateEnabled);
if (item.UpdateEnabled)
ReadBoolProp(getProp, getProp2, i, NArchive::kKeepName, item.KeepName);
if (ReadProp(getProp, getProp2, i, NArchive::kStartSignature, prop) == S_OK)
if (prop.vt == VT_BSTR)
{
UINT len = ::SysStringByteLen(prop.bstrVal);
item.StartSignature.SetCapacity(len);
memmove(item.StartSignature, prop.bstrVal, len);
}
Formats.Add(item);
}
return S_OK;
}
示例2: GetProperty
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
NCOM::CPropVariant prop;
const CSegment &item = _sections[index];
switch(propID)
{
case kpidPath:
{
wchar_t sz[32];
ConvertUInt64ToString(index, sz);
prop = sz;
break;
}
case kpidSize: prop = (UInt64)item.VSize; break;
case kpidPackSize: prop = (UInt64)item.PSize; break;
case kpidOffset: prop = item.Offset; break;
case kpidVa: prop = item.Va; break;
case kpidType: TYPE_TO_PROP(g_SegnmentTypes, item.Type, prop); break;
case kpidCharacts: FLAGS_TO_PROP(g_SegmentFlags, item.Flags, prop); break;
}
prop.Detach(value);
return S_OK;
COM_TRY_END
}
示例3: GetProperty
STDMETHODIMP CAltStreamsFolder::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
{
CAltStream &ss = Streams[index];
switch (propID)
{
case kpidIsDir: prop = false; break;
case kpidIsAltStream: prop = true; break;
case kpidName: prop = ss.Name; break;
case kpidSize: prop = ss.Size; break;
case kpidPackSize:
#ifdef UNDER_CE
prop = ss.Size;
#else
if (!ss.PackSize_Defined)
{
ss.PackSize_Defined = true;
if (!NFsFolder::MyGetCompressedFileSizeW(_pathPrefix + us2fs(ss.Name), ss.PackSize))
ss.PackSize = ss.Size;
}
prop = ss.PackSize;
#endif
break;
}
}
prop.Detach(value);
return S_OK;
}
示例4: GetArchiveProperty
IMP_IInArchive_Props
IMP_IInArchive_ArcProps
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
switch (propID)
{
case kpidPhySize: if (_packSize_Defined) prop = _packSize; break;
case kpidNumStreams: if (_numStreams_Defined) prop = _numStreams; break;
case kpidUnpackSize: if (_unpackSize_Defined) prop = _unpackSize; break;
case kpidErrorFlags:
{
UInt32 v = 0;
if (!_isArc) v |= kpv_ErrorFlags_IsNotArc;;
if (_needMoreInput) v |= kpv_ErrorFlags_UnexpectedEnd;
if (_dataAfterEnd) v |= kpv_ErrorFlags_DataAfterEnd;
if (_unsupported) v |= kpv_ErrorFlags_UnsupportedMethod;
if (_dataError) v |= kpv_ErrorFlags_DataError;
prop = v;
}
}
prop.Detach(value);
return S_OK;
}
示例5: GetProperty
STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
if (_subArchiveMode)
{
switch(propID)
{
case kpidName: prop = _subArchiveName; break;
}
}
else
{
switch(propID)
{
case kpidName: prop = _fileInfo.Name; break;
case kpidIsDir: prop = _fileInfo.IsDir(); break;
case kpidSize: prop = _fileInfo.Size; break;
case kpidAttrib: prop = (UInt32)_fileInfo.Attrib; break;
case kpidCTime: prop = _fileInfo.CTime; break;
case kpidATime: prop = _fileInfo.ATime; break;
case kpidMTime: prop = _fileInfo.MTime; break;
}
}
prop.Detach(value);
return S_OK;
}
示例6: GetArchiveProperty
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{
COM_TRY_BEGIN
NCOM::CPropVariant prop;
if (_stream)
{
const CVolumeDescriptor &vol = _archive.VolDescs[_archive.MainVolDescIndex];
switch (propID)
{
case kpidComment:
{
AString s;
ADD_STRING("System", SystemId);
ADD_STRING("Volume", VolumeId);
ADD_STRING("VolumeSet", VolumeSetId);
ADD_STRING("Publisher", PublisherId);
ADD_STRING("Preparer", DataPreparerId);
ADD_STRING("Application", ApplicationId);
ADD_STRING("Copyright", CopyrightFileId);
ADD_STRING("Abstract", AbstractFileId);
ADD_STRING("Bib", BibFileId);
prop = s;
break;
}
case kpidCTime: { FILETIME utc; if (vol.CTime.GetFileTime(utc)) prop = utc; break; }
case kpidMTime: { FILETIME utc; if (vol.MTime.GetFileTime(utc)) prop = utc; break; }
}
}
switch (propID)
{
case kpidPhySize: prop = _archive.PhySize; break;
case kpidErrorFlags:
{
UInt32 v = 0;
if (!_archive.IsArc) v |= kpv_ErrorFlags_IsNotArc;
if (_archive.UnexpectedEnd) v |= kpv_ErrorFlags_UnexpectedEnd;
if (_archive.HeadersError) v |= kpv_ErrorFlags_HeadersError;
prop = v;
break;
}
case kpidError:
{
AString s;
if (_archive.IncorrectBigEndian)
AddErrorMessage(s, "Incorrect big-endian headers");
if (_archive.SelfLinkedDirs)
AddErrorMessage(s, "Self-linked directory");
if (_archive.TooDeepDirs)
AddErrorMessage(s, "Too deep directory levels");
if (!s.IsEmpty())
prop = s;
break;
}
}
prop.Detach(value);
return S_OK;
COM_TRY_END
}
示例7: GetRootProp
STDMETHODIMP CHandler::GetRootProp(PROPID propID, PROPVARIANT *value)
{
// COM_TRY_BEGIN
NCOM::CPropVariant prop;
if (_db.Images.Size() != 0 && _db.NumExludededItems != 0)
{
const CImage &image = _db.Images[_db.IndexOfUserImage];
const CItem &item = _db.Items[image.StartItem];
if (!item.IsDir || item.ImageIndex != _db.IndexOfUserImage)
return E_FAIL;
const Byte *metadata = image.Meta + item.Offset;
switch (propID)
{
case kpidIsDir: prop = true; break;
case kpidAttrib: prop = (UInt32)Get32(metadata + 8); break;
case kpidCTime: GetFileTime(metadata + (_db.IsOldVersion ? 0x18: 0x28), prop); break;
case kpidATime: GetFileTime(metadata + (_db.IsOldVersion ? 0x20: 0x30), prop); break;
case kpidMTime: GetFileTime(metadata + (_db.IsOldVersion ? 0x28: 0x38), prop); break;
}
}
prop.Detach(value);
return S_OK;
// COM_TRY_END
}
示例8: ReadPluginInfo
static bool ReadPluginInfo(CPluginInfo &pluginInfo, bool needCheckDll)
{
if (needCheckDll)
{
NDLL::CLibrary lib;
if (!lib.LoadEx(pluginInfo.FilePath, LOAD_LIBRARY_AS_DATAFILE))
return false;
}
NDLL::CLibrary lib;
if (!lib.Load(pluginInfo.FilePath))
return false;
GetPluginPropertyFunc getPluginProperty = (GetPluginPropertyFunc)lib.GetProc("GetPluginProperty");
if (getPluginProperty == NULL)
return false;
NCOM::CPropVariant prop;
if (getPluginProperty(NPlugin::kName, &prop) != S_OK)
return false;
if (prop.vt != VT_BSTR)
return false;
pluginInfo.Name = prop.bstrVal;
prop.Clear();
if (getPluginProperty(NPlugin::kClassID, &prop) != S_OK)
return false;
if (prop.vt == VT_EMPTY)
pluginInfo.ClassIDDefined = false;
else if (prop.vt != VT_BSTR)
return false;
else
{
pluginInfo.ClassIDDefined = true;
pluginInfo.ClassID = *(const GUID *)prop.bstrVal;
}
prop.Clear();
if (getPluginProperty(NPlugin::kOptionsClassID, &prop) != S_OK)
return false;
if (prop.vt == VT_EMPTY)
pluginInfo.OptionsClassIDDefined = false;
else if (prop.vt != VT_BSTR)
return false;
else
{
pluginInfo.OptionsClassIDDefined = true;
pluginInfo.OptionsClassID = *(const GUID *)prop.bstrVal;
}
prop.Clear();
if (getPluginProperty(NPlugin::kType, &prop) != S_OK)
return false;
if (prop.vt == VT_EMPTY)
pluginInfo.Type = kPluginTypeFF;
else if (prop.vt == VT_UI4)
pluginInfo.Type = (EPluginType)prop.ulVal;
else
return false;
return true;
}
示例9: GetProperty
STDMETHODIMP CRootFolder::GetProperty(UInt32 itemIndex, PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
switch(propID)
{
case kpidIsDir: prop = true; break;
case kpidName: prop = _names[itemIndex]; break;
}
prop.Detach(value);
return S_OK;
}
示例10: GetItemFullSize
STDMETHODIMP CPhysDriveFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress * /* progress */)
{
NCOM::CPropVariant prop;
if (index >= 1)
return E_INVALIDARG;
UInt64 size = 0;
HRESULT result = GetLength(size);
prop = size;
prop.Detach(value);
return result;
}
示例11: GetFolderProperty
STDMETHODIMP CRootFolder::GetFolderProperty(PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
switch (propID)
{
case kpidType: prop = "RootFolder"; break;
case kpidPath: prop = ""; break;
}
prop.Detach(value);
return S_OK;
}
示例12: GetItemFullSize
STDMETHODIMP CFSFolder::GetItemFullSize(UInt32 index, PROPVARIANT *value, IProgress *progress)
{
NCOM::CPropVariant prop;
if (index >= (UInt32)_refs.Size())
return E_INVALIDARG;
UInt64 size = 0;
HRESULT result = GetItemFullSize(index, size, progress);
prop = size;
prop.Detach(value);
return result;
}
示例13: GetArchiveProperty
IMP_IInArchive_Props
IMP_IInArchive_ArcProps_NO_Table
STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
switch(propID)
{
case kpidPhySize: if (_packSizeDefined) prop = _packSize; break;
}
prop.Detach(value);
return S_OK;
}
示例14: GetRootProp
STDMETHODIMP CArchiveUpdateCallback::GetRootProp(PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
switch (propID)
{
case kpidIsDir: prop = true; break;
case kpidAttrib: if (ParentDirItem) prop = ParentDirItem->Attrib; break;
case kpidCTime: if (ParentDirItem) prop = ParentDirItem->CTime; break;
case kpidATime: if (ParentDirItem) prop = ParentDirItem->ATime; break;
case kpidMTime: if (ParentDirItem) prop = ParentDirItem->MTime; break;
}
prop.Detach(value);
return S_OK;
}
示例15: GetProperty
STDMETHODIMP CHandler::GetProperty(UInt32 /* index */, PROPID propID, PROPVARIANT *value)
{
NCOM::CPropVariant prop;
switch (propID)
{
case kpidPath: prop = _subName; break;
case kpidSize:
case kpidPackSize:
prop = _totalSize;
break;
}
prop.Detach(value);
return S_OK;
}