当前位置: 首页>>代码示例>>C++>>正文


C++ AStringVector::Add方法代码示例

本文整理汇总了C++中AStringVector::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ AStringVector::Add方法的具体用法?C++ AStringVector::Add怎么用?C++ AStringVector::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AStringVector的用法示例。


在下文中一共展示了AStringVector::Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SplitString

static void SplitString(const AString &srcString, AStringVector &destStrings)
{
  destStrings.Clear();
  AString string;
  int len = srcString.Length();
  if (len == 0)
    return;
  for (int i = 0; i < len; i++)
  {
    char c = srcString[i];
    if (c == '\n')
    {
      if (!string.IsEmpty())
      {
        destStrings.Add(string);
        string.Empty();
      }
    }
    else
      string += c;
  }
  if (!string.IsEmpty())
    destStrings.Add(string);
}
开发者ID:Esika,项目名称:sevenzipjbinding,代码行数:24,代码来源:FarUtils.cpp

示例2: ShowAttributesWindow

HRESULT CPlugin::ShowAttributesWindow()
{
  PluginPanelItem pluginPanelItem;
  if (!g_StartupInfo.ControlGetActivePanelCurrentItemInfo(pluginPanelItem))
    return S_FALSE;
  if (strcmp(pluginPanelItem.FindData.cFileName, "..") == 0 &&
        NFile::NFind::NAttributes::IsDir(pluginPanelItem.FindData.dwFileAttributes))
    return S_FALSE;
  int itemIndex = pluginPanelItem.UserData;

  CObjectVector<CArchiveItemProperty> properties;
  UInt32 numProps;
  RINOK(_folder->GetNumberOfProperties(&numProps));
  int i;
  for (i = 0; i < (int)numProps; i++)
  {
    CMyComBSTR name;
    PROPID propID;
    VARTYPE vt;
    RINOK(_folder->GetPropertyInfo(i, &name, &propID, &vt));
    CArchiveItemProperty prop;
    prop.Type = vt;
    prop.ID = propID;
    if (prop.ID  == kpidPath)
      prop.ID  = kpidName;
    prop.Name = GetNameOfProp(propID, name);
    properties.Add(prop);
  }

  int size = 2;
  CRecordVector<CInitDialogItem> initDialogItems;
  
  int xSize = 70;
  CInitDialogItem idi =
  { DI_DOUBLEBOX, 3, 1, xSize - 4, size - 2, false, false, 0, false, NMessageID::kProperties, NULL, NULL };
  initDialogItems.Add(idi);
  AStringVector values;

  for (i = 0; i < properties.Size(); i++)
  {
    const CArchiveItemProperty &property = properties[i];

    CInitDialogItem idi =
      { DI_TEXT, 5, 3 + i, 0, 0, false, false, 0, false, 0, NULL, NULL };
    int index = FindPropertyToName(property.ID);
    if (index < 0)
    {
      idi.DataMessageId = -1;
      idi.DataString = property.Name;
    }
    else
      idi.DataMessageId = kPROPIDToName[index].PluginID;
    initDialogItems.Add(idi);
    
    NCOM::CPropVariant prop;
    RINOK(_folder->GetProperty(itemIndex, property.ID, &prop));
    CSysString s = PropToString(prop, property.ID);
    values.Add(s);
    
    {
      CInitDialogItem idi =
      { DI_TEXT, 30, 3 + i, 0, 0, false, false, 0, false, -1, NULL, NULL };
      initDialogItems.Add(idi);
    }
  }

  int numLines = values.Size();
  for (i = 0; i < numLines; i++)
  {
    CInitDialogItem &idi = initDialogItems[1 + i * 2 + 1];
    idi.DataString = values[i];
  }
  
  int numDialogItems = initDialogItems.Size();
  
  CRecordVector<FarDialogItem> dialogItems;
  dialogItems.Reserve(numDialogItems);
  for (i = 0; i < numDialogItems; i++)
    dialogItems.Add(FarDialogItem());
  g_StartupInfo.InitDialogItems(&initDialogItems.Front(),
      &dialogItems.Front(), numDialogItems);
  
  int maxLen = 0;
  for (i = 0; i < numLines; i++)
  {
    FarDialogItem &dialogItem = dialogItems[1 + i * 2];
    int len = (int)strlen(dialogItem.Data);
    if (len > maxLen)
      maxLen = len;
  }
  int maxLen2 = 0;
  const int kSpace = 10;
  for (i = 0; i < numLines; i++)
  {
    FarDialogItem &dialogItem = dialogItems[1 + i * 2 + 1];
    int len = (int)strlen(dialogItem.Data);
    if (len > maxLen2)
      maxLen2 = len;
    dialogItem.X1 = maxLen + kSpace;
  }
//.........这里部分代码省略.........
开发者ID:BIAINC,项目名称:7Zip,代码行数:101,代码来源:Plugin.cpp

示例3: MyPropertySheet

INT_PTR MyPropertySheet(const CObjectVector<CPageInfo> &pagesInfo, HWND hwndParent, const UString &title)
{
#ifndef _UNICODE
    AStringVector titles;
#endif
#ifndef _UNICODE
    CRecordVector<PROPSHEETPAGEA> pagesA;
#endif
    CRecordVector<PROPSHEETPAGEW> pagesW;

    int i;
#ifndef _UNICODE
    for (i = 0; i < pagesInfo.Size(); i++)
        titles.Add(GetSystemString(pagesInfo[i].Title));
#endif

    for (i = 0; i < pagesInfo.Size(); i++)
    {
        const CPageInfo &pageInfo = pagesInfo[i];
#ifndef _UNICODE
        {
            PROPSHEETPAGE page;
            page.dwSize = sizeof(page);
            page.dwFlags = PSP_HASHELP;
            page.hInstance = g_hInstance;
            page.pszTemplate = MAKEINTRESOURCE(pageInfo.ID);
            page.pszIcon = NULL;
            page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure;

            if (titles[i].IsEmpty())
                page.pszTitle = NULL;
            else
            {
                page.dwFlags |= PSP_USETITLE;
                page.pszTitle = titles[i];
            }
            page.lParam = (LPARAM)pageInfo.Page;
            page.pfnCallback = NULL;
            pagesA.Add(page);
        }
#endif
        {
            PROPSHEETPAGEW page;
            page.dwSize = sizeof(page);
            page.dwFlags = PSP_HASHELP;
            page.hInstance = g_hInstance;
            page.pszTemplate = MAKEINTRESOURCEW(pageInfo.ID);
            page.pszIcon = NULL;
            page.pfnDlgProc = NWindows::NControl::MyProperyPageProcedure;

            if (pageInfo.Title.IsEmpty())
                page.pszTitle = NULL;
            else
            {
                page.dwFlags |= PSP_USETITLE;
                page.pszTitle = pageInfo.Title;
            }
            page.lParam = (LPARAM)pageInfo.Page;
            page.pfnCallback = NULL;
            pagesW.Add(page);
        }
    }

#ifndef _UNICODE
    if (!g_IsNT)
    {
        PROPSHEETHEADER sheet;
        sheet.dwSize = sizeof(sheet);
        sheet.dwFlags = PSH_PROPSHEETPAGE;
        sheet.hwndParent = hwndParent;
        sheet.hInstance = g_hInstance;
        AString titleA = GetSystemString(title);
        sheet.pszCaption = titleA;
        sheet.nPages = pagesInfo.Size();
        sheet.nStartPage = 0;
        sheet.ppsp = &pagesA.Front();
        sheet.pfnCallback = NULL;
        return ::PropertySheetA(&sheet);
    }
    else
#endif
    {
        PROPSHEETHEADERW sheet;
        sheet.dwSize = sizeof(sheet);
        sheet.dwFlags = PSH_PROPSHEETPAGE;
        sheet.hwndParent = hwndParent;
        sheet.hInstance = g_hInstance;
        sheet.pszCaption = title;
        sheet.nPages = pagesInfo.Size();
        sheet.nStartPage = 0;
        sheet.ppsp = &pagesW.Front();
        sheet.pfnCallback = NULL;
        return ::PropertySheetW(&sheet);
    }
}
开发者ID:punesemu,项目名称:puNES,代码行数:95,代码来源:PropertyPage.cpp


注:本文中的AStringVector::Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。