本文整理汇总了C++中CObjectVector类的典型用法代码示例。如果您正苦于以下问题:C++ CObjectVector类的具体用法?C++ CObjectVector怎么用?C++ CObjectVector使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CObjectVector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadPluginInfoList
void ReadPluginInfoList(CObjectVector<CPluginInfo> &plugins)
{
plugins.Clear();
UString baseFolderPrefix;
GetProgramFolderPath(baseFolderPrefix);
{
CPluginInfo pluginInfo;
pluginInfo.FilePath = baseFolderPrefix + L"7-zip.dll";
if (::ReadPluginInfo(pluginInfo, false))
plugins.Add(pluginInfo);
}
UString folderPath = baseFolderPrefix + L"Plugins" WSTRING_PATH_SEPARATOR;
NFind::CEnumeratorW enumerator(folderPath + L"*");
NFind::CFileInfoW fileInfo;
while (enumerator.Next(fileInfo))
{
if (fileInfo.IsDir())
continue;
CPluginInfo pluginInfo;
pluginInfo.FilePath = folderPath + fileInfo.Name;
if (::ReadPluginInfo(pluginInfo, true))
plugins.Add(pluginInfo);
}
}
示例2: SetMainMethod
HRESULT CHandler::SetMainMethod(
CCompressionMethodMode &methodMode
#ifndef _7ZIP_ST
, UInt32 numThreads
#endif
)
{
methodMode.Bonds = _bonds;
CObjectVector<COneMethodInfo> methods = _methods;
{
FOR_VECTOR (i, methods)
{
AString &methodName = methods[i].MethodName;
if (methodName.IsEmpty())
methodName = kDefaultMethodName;
}
if (methods.IsEmpty())
{
COneMethodInfo &m = methods.AddNew();
m.MethodName = (GetLevel() == 0 ? k_Copy_Name : kDefaultMethodName);
methodMode.DefaultMethod_was_Inserted = true;
}
}
示例3: LangSetDlgItemsText
bool CLangPage::OnInit()
{
LangSetDlgItemsText(HWND(*this), kIDLangPairs, sizeof(kIDLangPairs) / sizeof(kIDLangPairs[0]));
_langCombo.Attach(GetItem(IDC_LANG_COMBO_LANG));
UString s = NWindows::MyLoadStringW(IDS_LANG_ENGLISH) +
NativeLangString(NWindows::MyLoadStringW(IDS_LANG_NATIVE));
int index = (int)_langCombo.AddString(s);
_langCombo.SetItemData(index, _paths.Size());
_paths.Add(L"-");
_langCombo.SetCurSel(0);
CObjectVector<CLangEx> langs;
LoadLangs(langs);
for (int i = 0; i < langs.Size(); i++)
{
const CLangEx &lang = langs[i];
UString name, nationalName;
if (!lang.Lang.GetMessage(0, name))
name = lang.ShortName;
if (lang.Lang.GetMessage(1, nationalName) && !nationalName.IsEmpty())
name += NativeLangString(nationalName);
index = (int)_langCombo.AddString(name);
_langCombo.SetItemData(index, _paths.Size());
_paths.Add(lang.ShortName);
if (g_LangID.CompareNoCase(lang.ShortName) == 0)
_langCombo.SetCurSel(index);
}
return CPropertyPage::OnInit();
}
示例4: ReadInternalAssociations
void ReadInternalAssociations(CObjectVector<CExtInfo> &items)
{
items.Clear();
NSynchronization::CCriticalSectionLock lock(g_CriticalSection);
CKey associationsKey;
if (associationsKey.Open(HKEY_CURRENT_USER, kAssociationsPath, KEY_READ) != ERROR_SUCCESS)
return;
CSysStringVector extNames;
associationsKey.EnumKeys(extNames);
for(int i = 0; i < extNames.Size(); i++)
{
const CSysString extName = extNames[i];
CExtInfo extInfo;
// extInfo.Enabled = false;
extInfo.Ext = GetUnicodeString(extName);
CKey key;
if (key.Open(associationsKey, extName, KEY_READ) != ERROR_SUCCESS)
return;
UString pluginsString;
key.QueryValue(kExtPlugins, pluginsString);
SplitString(pluginsString, extInfo.Plugins);
/*
if (key.QueryValue(kExtEnabled, extInfo.Enabled) != ERROR_SUCCESS)
extInfo.Enabled = false;
*/
items.Add(extInfo);
}
}
示例5: GetTextPairs
static bool GetTextPairs(const UString &srcString, CObjectVector<CTextPair> &pairs)
{
pairs.Clear();
unsigned pos = 0;
if (srcString.Len() > 0)
{
if (srcString[0] == kBOM)
pos++;
}
while (pos < srcString.Len())
{
unsigned finishPos;
UString id = GetIDString((const wchar_t *)srcString + pos, finishPos);
pos += finishPos;
if (id.IsEmpty())
continue;
UString value = GetValueString((const wchar_t *)srcString + pos, finishPos);
pos += finishPos;
if (!id.IsEmpty())
{
CTextPair pair;
pair.ID = id;
pair.Value = value;
pairs.Add(pair);
}
}
return true;
}
示例6: Read
void CExtDatabase::Read()
{
CObjectVector<CExtInfo> extItems;
ReadInternalAssociations(extItems);
ReadFileFolderPluginInfoList(Plugins);
for (int i = 0; i < extItems.Size(); i++)
{
const CExtInfo &extInfo = extItems[i];
CExtInfoBig extInfoBig;
extInfoBig.Ext = extInfo.Ext;
extInfoBig.Associated = false;
for (int p = 0; p < extInfo.Plugins.Size(); p++)
{
int pluginIndex = FindPlugin(extInfo.Plugins[p]);
if (pluginIndex >= 0)
extInfoBig.PluginsPairs.Add(CPluginEnabledPair(pluginIndex, true));
}
ExtBigItems.Add(extInfoBig);
}
for (int pluginIndex = 0; pluginIndex < Plugins.Size(); pluginIndex++)
{
const CPluginInfo &pluginInfo = Plugins[pluginIndex];
CPluginLibrary pluginLibrary;
CMyComPtr<IFolderManager> folderManager;
if (pluginInfo.FilePath.IsEmpty())
folderManager = new CArchiveFolderManager;
else if (pluginLibrary.LoadAndCreateManager(pluginInfo.FilePath,
pluginInfo.ClassID, &folderManager) != S_OK)
continue;
CMyComBSTR extBSTR;
if (folderManager->GetExtensions(&extBSTR) != S_OK)
return;
const UString ext2 = (const wchar_t *)extBSTR;
UStringVector exts;
SplitString(ext2, exts);
for (int i = 0; i < exts.Size(); i++)
{
const UString &ext = exts[i];
int index = FindExtInfoBig(ext);
if (index < 0)
{
CExtInfoBig extInfo;
extInfo.PluginsPairs.Add(CPluginEnabledPair(pluginIndex, false));
extInfo.Associated = false;
extInfo.Ext = ext;
ExtBigItems.Add(extInfo);
}
else
{
CExtInfoBig &extInfo = ExtBigItems[index];
int pluginIndexIndex = extInfo.FindPlugin(pluginIndex);
if (pluginIndexIndex < 0)
extInfo.PluginsPairs.Add(CPluginEnabledPair(pluginIndex, false));
}
}
}
}
示例7: GetTextConfig
bool GetTextConfig(const AString &s, CObjectVector<CTextConfigPair> &pairs)
{
pairs.Clear();
unsigned pos = 0;
/////////////////////
// read strings
for (;;)
{
if (!SkipSpaces(s, pos))
break;
CTextConfigPair pair;
unsigned finishPos;
AString temp = GetIDString(((const char *)s) + pos, finishPos);
if (!ConvertUTF8ToUnicode(temp, pair.ID))
return false;
if (finishPos == 0)
return false;
pos += finishPos;
if (!SkipSpaces(s, pos))
return false;
if (s[pos] != '=')
return false;
pos++;
if (!SkipSpaces(s, pos))
return false;
if (s[pos] != '\"')
return false;
pos++;
AString message;
for (;;)
{
if (pos >= s.Len())
return false;
char c = s[pos++];
if (c == '\"')
break;
if (c == '\\')
{
c = s[pos++];
switch (c)
{
case 'n': message += '\n'; break;
case 't': message += '\t'; break;
case '\\': message += '\\'; break;
case '\"': message += '\"'; break;
default: message += '\\'; message += c; break;
}
}
else
message += c;
}
if (!ConvertUTF8ToUnicode(message, pair.String))
return false;
pairs.Add(pair);
}
return true;
}
示例8: OptionsDialog
void OptionsDialog(HWND hwndOwner, HINSTANCE /* hInstance */)
{
CSystemPage systemPage;
CMenuPage menuPage;
CFoldersPage foldersPage;
CEditPage editPage;
CSettingsPage settingsPage;
CLangPage langPage;
CObjectVector<NControl::CPageInfo> pages;
BIG_DIALOG_SIZE(200, 200);
const UINT pageIDs[] = {
SIZED_DIALOG(IDD_SYSTEM),
SIZED_DIALOG(IDD_MENU),
SIZED_DIALOG(IDD_FOLDERS),
SIZED_DIALOG(IDD_EDIT),
SIZED_DIALOG(IDD_SETTINGS),
SIZED_DIALOG(IDD_LANG) };
NControl::CPropertyPage *pagePointers[] = { &systemPage, &menuPage, &foldersPage, &editPage, &settingsPage, &langPage };
for (unsigned i = 0; i < ARRAY_SIZE(pageIDs); i++)
{
NControl::CPageInfo &page = pages.AddNew();
page.ID = pageIDs[i];
LangString_OnlyFromLangFile(page.ID, page.Title);
page.Page = pagePointers[i];
}
INT_PTR res = NControl::MyPropertySheet(pages, hwndOwner, LangString(IDS_OPTIONS));
if (res != -1 && res != 0)
{
if (langPage.LangWasChanged)
{
// g_App._window.SetText(LangString(IDS_APP_TITLE, 0x03000000));
MyLoadMenu();
g_App.ReloadToolbars();
g_App.MoveSubWindows(); // we need it to change list window aafter _toolBar.AutoSize();
g_App.ReloadLang();
}
/*
if (systemPage.WasChanged)
{
// probably it doesn't work, since image list is locked?
g_App.SysIconsWereChanged();
}
*/
g_App.SetListSettings();
g_App.RefreshAllPanels();
// ::PostMessage(hwndOwner, kLangWasChangedMessage, 0 , 0);
}
}
示例9: UpdateProduce
void UpdateProduce(
const CObjectVector<CDirItem> &dirItems,
const CObjectVector<CArchiveItem> &archiveItems,
const CObjectVector<CUpdatePair> &updatePairs,
const NUpdateArchive::CActionSet &actionSet,
CObjectVector<CUpdatePair2> &operationChain)
{
for(int i = 0; i < updatePairs.Size(); i++)
{
// CUpdateArchiveRange aRange;
const CUpdatePair &pair = updatePairs[i];
CUpdatePair2 pair2;
pair2.IsAnti = false;
pair2.ArchiveItemIndex = pair.ArchiveItemIndex;
pair2.DirItemIndex = pair.DirItemIndex;
pair2.ExistInArchive = (pair.State != NPairState::kOnlyOnDisk);
pair2.ExistOnDisk = (pair.State != NPairState::kOnlyInArchive);
switch(actionSet.StateActions[pair.State])
{
case NPairAction::kIgnore:
/*
if (pair.State != NPairState::kOnlyOnDisk)
IgnoreArchiveItem(m_ArchiveItems[pair.ArchiveItemIndex]);
// cout << "deleting";
*/
break;
case NPairAction::kCopy:
{
if (pair.State == NPairState::kOnlyOnDisk)
throw kUpdateActionSetCollision;
pair2.NewData = pair2.NewProperties = false;
operationChain.Add(pair2);
break;
}
case NPairAction::kCompress:
{
if (pair.State == NPairState::kOnlyInArchive ||
pair.State == NPairState::kNotMasked)
throw kUpdateActionSetCollision;
pair2.NewData = pair2.NewProperties = true;
operationChain.Add(pair2);
break;
}
case NPairAction::kCompressAsAnti:
{
pair2.IsAnti = true;
pair2.NewData = pair2.NewProperties = true;
operationChain.Add(pair2);
break;
}
}
}
}
示例10: SetCompressionMethod
HRESULT CHandler::SetCompressionMethod(
CCompressionMethodMode &methodMode,
CCompressionMethodMode &headerMethod)
{
HRESULT res = SetCompressionMethod(methodMode, _methods
#ifdef COMPRESS_MT
, _numThreads
#endif
);
RINOK(res);
methodMode.Binds = _binds;
if (_compressHeaders)
{
// headerMethod.Methods.Add(methodMode.Methods.Back());
CObjectVector<COneMethodInfo> headerMethodInfoVector;
COneMethodInfo oneMethodInfo;
oneMethodInfo.MethodName = kLZMAMethodName;
{
CProp prop;
prop.Id = NCoderPropID::kMatchFinder;
prop.Value = kLzmaMatchFinderForHeaders;
oneMethodInfo.Props.Add(prop);
}
{
CProp prop;
prop.Id = NCoderPropID::kAlgorithm;
prop.Value = kAlgorithmForHeaders;
oneMethodInfo.Props.Add(prop);
}
{
CProp prop;
prop.Id = NCoderPropID::kNumFastBytes;
prop.Value = (UInt32)kNumFastBytesForHeaders;
oneMethodInfo.Props.Add(prop);
}
{
CProp prop;
prop.Id = NCoderPropID::kDictionarySize;
prop.Value = (UInt32)kDictionaryForHeaders;
oneMethodInfo.Props.Add(prop);
}
headerMethodInfoVector.Add(oneMethodInfo);
HRESULT res = SetCompressionMethod(headerMethod, headerMethodInfoVector
#ifdef COMPRESS_MT
,1
#endif
);
RINOK(res);
}
return S_OK;
}
示例11: ReadUnpackInfo
void CInArchive::ReadUnpackInfo(
const CObjectVector<CByteBuffer> *dataVector,
CObjectVector<CFolder> &folders)
{
WaitAttribute(NID::kFolder);
CNum numFolders = ReadNum();
{
CStreamSwitch streamSwitch;
streamSwitch.Set(this, dataVector);
folders.Clear();
folders.Reserve(numFolders);
for (CNum i = 0; i < numFolders; i++)
{
folders.Add(CFolder());
GetNextFolderItem(folders.Back());
}
}
WaitAttribute(NID::kCodersUnpackSize);
CNum i;
for (i = 0; i < numFolders; i++)
{
CFolder &folder = folders[i];
CNum numOutStreams = folder.GetNumOutStreams();
folder.UnpackSizes.Reserve(numOutStreams);
for (CNum j = 0; j < numOutStreams; j++)
folder.UnpackSizes.Add(ReadNumber());
}
for (;;)
{
UInt64 type = ReadID();
if (type == NID::kEnd)
return;
if (type == NID::kCRC)
{
CBoolVector crcsDefined;
CRecordVector<UInt32> crcs;
ReadHashDigests(numFolders, crcsDefined, crcs);
for (i = 0; i < numFolders; i++)
{
CFolder &folder = folders[i];
folder.UnpackCRCDefined = crcsDefined[i];
folder.UnpackCRC = crcs[i];
}
continue;
}
SkipData();
}
}
示例12: SetProperties
HRESULT SetProperties(IUnknown *unknown, const CObjectVector<CProperty> &properties)
{
if (properties.IsEmpty())
return S_OK;
CMyComPtr<ISetProperties> setProperties;
unknown->QueryInterface(IID_ISetProperties, (void **)&setProperties);
if (!setProperties)
return S_OK;
UStringVector realNames;
CPropVariant *values = new CPropVariant[properties.Size()];
try
{
int i;
for(i = 0; i < properties.Size(); i++)
{
const CProperty &property = properties[i];
NCOM::CPropVariant propVariant;
UString name = property.Name;
if (property.Value.IsEmpty())
{
if (!name.IsEmpty())
{
wchar_t c = name.Back();
if (c == L'-')
propVariant = false;
else if (c == L'+')
propVariant = true;
if (propVariant.vt != VT_EMPTY)
name.DeleteBack();
}
}
else
ParseNumberString(property.Value, propVariant);
realNames.Add(name);
values[i] = propVariant;
}
CRecordVector<const wchar_t *> names;
for(i = 0; i < realNames.Size(); i++)
names.Add((const wchar_t *)realNames[i]);
RINOK(setProperties->SetProperties(&names.Front(), values, names.Size()));
}
catch(...)
{
delete []values;
throw;
}
delete []values;
return S_OK;
}
示例13: MyGetLogicalDriveStrings
bool MyGetLogicalDriveStrings(CObjectVector<FString> &driveStrings)
{
driveStrings.Clear();
#ifndef _UNICODE
if (!g_IsNT)
{
driveStrings.Clear();
UINT32 size = GetLogicalDriveStrings(0, NULL);
if (size == 0)
return false;
CObjArray<char> buf(size);
UINT32 newSize = GetLogicalDriveStrings(size, buf);
if (newSize == 0 || newSize > size)
return false;
AString s;
UINT32 prev = 0;
for (UINT32 i = 0; i < newSize; i++)
{
if (buf[i] == 0)
{
s = buf + prev;
prev = i + 1;
driveStrings.Add(fas2fs(s));
}
}
return prev == newSize;
}
else
#endif
{
UINT32 size = GetLogicalDriveStringsW(0, NULL);
if (size == 0)
return false;
CObjArray<wchar_t> buf(size);
UINT32 newSize = GetLogicalDriveStringsW(size, buf);
if (newSize == 0 || newSize > size)
return false;
UString s;
UINT32 prev = 0;
for (UINT32 i = 0; i < newSize; i++)
{
if (buf[i] == 0)
{
s = buf + prev;
prev = i + 1;
driveStrings.Add(us2fs(s));
}
}
return prev == newSize;
}
}
示例14: ControlGetActivePanelSelectedOrCurrentItems
bool CStartupInfo::ControlGetActivePanelSelectedOrCurrentItems(
CObjectVector<PluginPanelItem> &pluginPanelItems)
{
pluginPanelItems.Clear();
PanelInfo panelInfo;
if(!ControlGetActivePanelInfo(panelInfo))
return false;
if(panelInfo.ItemsNumber <= 0)
throw "There are no items";
if (panelInfo.SelectedItemsNumber == 0)
pluginPanelItems.Add(panelInfo.PanelItems[panelInfo.CurrentItem]);
else
for (int i = 0; i < panelInfo.SelectedItemsNumber; i++)
pluginPanelItems.Add(panelInfo.SelectedItems[i]);
return true;
}
示例15: AddProp
static void AddProp(CObjectVector<CProperty> &properties, const UString &name, const UString &value)
{
CProperty prop;
prop.Name = name;
prop.Value = value;
properties.Add(prop);
}