本文整理汇总了C++中ncom::CPropVariant::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ CPropVariant::Clear方法的具体用法?C++ CPropVariant::Clear怎么用?C++ CPropVariant::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ncom::CPropVariant
的用法示例。
在下文中一共展示了CPropVariant::Clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: Load
HRESULT CProxyArc::Load(const CArc &arc, IProgress *progress)
{
// DWORD tickCount = GetTickCount(); for (int ttt = 0; ttt < 1; ttt++) {
Files.Free();
Dirs.Clear();
Dirs.AddNew();
IInArchive *archive = arc.Archive;
UInt32 numItems;
RINOK(archive->GetNumberOfItems(&numItems));
if (progress)
RINOK(progress->SetTotal(numItems));
Files.Alloc(numItems);
UString path;
UString name;
NCOM::CPropVariant prop;
for (UInt32 i = 0; i < numItems; i++)
{
if (progress && (i & 0xFFFF) == 0)
{
UInt64 currentItemIndex = i;
RINOK(progress->SetCompleted(¤tItemIndex));
}
const wchar_t *s = NULL;
unsigned len = 0;
bool isPtrName = false;
#ifdef MY_CPU_LE
if (arc.GetRawProps)
{
const void *p;
UInt32 size;
UInt32 propType;
if (arc.GetRawProps->GetRawProp(i, kpidPath, &p, &size, &propType) == S_OK
&& propType == NPropDataType::kUtf16z
&& size > 2)
{
// is (size <= 2), it's empty name, and we call default arc.GetItemPath();
len = size / 2 - 1;
s = (const wchar_t *)p;
isPtrName = true;
}
}
if (!s)
#endif
{
prop.Clear();
RINOK(arc.Archive->GetProperty(i, kpidPath, &prop));
if (prop.vt == VT_BSTR)
{
s = prop.bstrVal;
len = ::SysStringLen(prop.bstrVal);
}
else if (prop.vt != VT_EMPTY)
return E_FAIL;
if (len == 0)
{
RINOK(arc.GetDefaultItemPath(i, path));
len = path.Len();
s = path;
}
/*
RINOK(arc.GetItemPath(i, path));
len = path.Len();
s = path;
*/
}
unsigned curItem = 0;
/*
if (arc.Ask_Deleted)
{
bool isDeleted = false;
RINOK(Archive_IsItem_Deleted(archive, i, isDeleted));
if (isDeleted)
curItem = AddDirSubItem(curItem, (UInt32)(Int32)-1, false, L"[DELETED]");
}
*/
unsigned namePos = 0;
for (unsigned j = 0; j < len; j++)
{
wchar_t c = s[j];
if (c == WCHAR_PATH_SEPARATOR || c == L'/')
{
name.SetFrom(s + namePos, j - namePos);
curItem = AddDir(curItem, -1, name);
namePos = j + 1;
}
}
//.........这里部分代码省略.........