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


C++ TrivialArray::size方法代码示例

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


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

示例1: SetPointType

bool
dlgTaskPointType(OrderedTask** task, const unsigned index)
{
  ordered_task = *task;
  active_index = index;

  point = &ordered_task->GetPoint(active_index);

  point_types.clear();
  ordered_task->GetFactory().GetValidTypes(index)
    .CopyTo(std::back_inserter(point_types));

  if (point_types.empty()) {
    assert(1);
    return false;
  }

  if (point_types.size() == 1)
    return SetPointType(point_types[0]);

  unsigned initial_index = 0;
  const auto b = point_types.begin(), e = point_types.end();
  auto i = std::find(b, e, get_point_type());
  if (i != e)
    initial_index = std::distance(b, i);

  FunctionListItemRenderer item_renderer(OnPointPaintListItem);

  int result = ListPicker(_("Task Point Type"),
                          point_types.size(), initial_index,
                          Layout::Scale(18),
                          item_renderer, false,
                          nullptr, TPTypeItemHelp);
  return result >= 0 && SetPointType(point_types[result]);
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:35,代码来源:MutateTaskPointDialog.cpp

示例2: if

static void
SetFormDefaultFocus()
{
  unsigned numColumns = grid_view->GetNumColumns();
  unsigned pageSize = numColumns * grid_view->GetNumRows();
  unsigned lastPage = buttons.size() / pageSize;
  unsigned currentPage = grid_view->GetCurrentPage();
  unsigned currentPageSize = currentPage == lastPage
    ? buttons.size() % pageSize
    : pageSize;
  unsigned centerCol = currentPageSize < numColumns
    ? currentPageSize / 2
    : numColumns / 2;
  unsigned centerRow = currentPageSize / numColumns / 2;
  unsigned centerPos = currentPage
    * pageSize + centerCol + centerRow * numColumns;

  if (centerPos < buttons.size()) {
    if (wf->is_visible()) {
      buttons[centerPos]->set_focus();
      grid_view->RefreshLayout();
    } else if (buttons[centerPos]->is_enabled())
      wf->SetDefaultFocus(buttons[centerPos]);
  }
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:25,代码来源:dlgQuickMenu.cpp

示例3: SetPointType

bool
dlgTaskPointType(OrderedTask &task, const unsigned index)
{
  point_types.clear();
  task.GetFactory().GetValidTypes(index)
    .CopyTo(std::back_inserter(point_types));

  if (point_types.empty()) {
    assert(1);
    return false;
  }

  if (point_types.size() == 1)
    return SetPointType(task, index, point_types[0]);

  const auto &point = task.GetPoint(index);
  const auto current_type = task.GetFactory().GetType(point);

  unsigned initial_index = 0;
  const auto b = point_types.begin(), e = point_types.end();
  auto i = std::find(b, e, current_type);
  if (i != e)
    initial_index = std::distance(b, i);

  MutateTaskPointRenderer item_renderer(current_type);

  int result = ListPicker(_("Task Point Type"),
                          point_types.size(), initial_index,
                          item_renderer.CalculateLayout(UIGlobals::GetDialogLook()),
                          item_renderer, false,
                          nullptr, TPTypeItemHelp);
  return result >= 0 && SetPointType(task, index, point_types[result]);
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:33,代码来源:MutateTaskPointDialog.cpp

示例4: if

inline void
WifiListWidget::Connect()
{
  if (!EnsureConnected()) {
    ShowMessageBox(_T("Network failure"), _("Connect"), MB_OK);
    return;
  }

  const unsigned i = GetList().GetCursorIndex();
  if (i >= networks.size())
    return;

  const auto &info = networks[i];
  if (info.id < 0) {
    const auto ssid = info.ssid;

    StaticString<256> caption;
    caption.Format(_("Passphrase of network '%s'"), ssid.c_str());

    StaticString<32> passphrase;
    passphrase.clear();
    if (info.security == OPEN_SECURITY)
      passphrase.clear();
    else if (!TextEntryDialog(passphrase, caption, false))
      return;

    if (!WifiConnect(info.security, wpa_supplicant, info.ssid, passphrase))
      ShowMessageBox(_T("Network failure"), _("Connect"), MB_OK);
  } else {
    if (!wpa_supplicant.RemoveNetwork(info.id) || !wpa_supplicant.SaveConfig())
      ShowMessageBox(_T("Error"), _("Remove"), MB_OK);
  }

  UpdateList();
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例5: AppendMode

  int AppendMode(const TCHAR *name) {
    if (modes.full())
      return -1;

    modes.append() = name;
    return modes.size() - 1;
  }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:7,代码来源:InputConfig.hpp

示例6: IsDownloading

void
ManagedFileListWidget::RefreshList()
{
  items.clear();

  bool download_active = false;
  for (auto i = repository.begin(), end = repository.end(); i != end; ++i) {
    const auto &remote_file = *i;
    DownloadStatus download_status;
    const bool is_downloading = IsDownloading(remote_file, download_status);

    const auto path = LocalPath(remote_file);
    if (!path.IsNull() &&
        (is_downloading || File::Exists(path))) {
      download_active |= is_downloading;

      const Path base = path.GetBase();
      if (base.IsNull())
        continue;

      items.append().Set(base.c_str(),
                         is_downloading ? &download_status : nullptr,
                         HasFailed(remote_file));
    }
  }

  ListControl &list = GetList();
  list.SetLength(items.size());
  list.Invalidate();

#ifdef HAVE_DOWNLOAD_MANAGER
  if (download_active && !Timer::IsActive())
    Timer::Schedule(1000);
#endif
}
开发者ID:MaxPower-No1,项目名称:XCSoar,代码行数:35,代码来源:FileManager.cpp

示例7: Expire

  void Expire(fixed clock) {
    new_traffic.Expire(clock, fixed(60));

    for (unsigned i = list.size(); i-- > 0;)
      if (!list[i].Refresh(clock))
        list.quick_remove(i);
  }
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:7,代码来源:List.hpp

示例8: base

void
ManagedFileListWidget::Download()
{
#ifdef HAVE_DOWNLOAD_MANAGER
  assert(Net::DownloadManager::IsAvailable());

  if (items.empty())
    return;

  const unsigned current = GetList().GetCursorIndex();
  assert(current < items.size());

  const FileItem &item = items[current];
  const AvailableFile *remote_file_p = FindRemoteFile(repository, item.name);
  if (remote_file_p == NULL)
    return;

  const AvailableFile &remote_file = *remote_file_p;
  ACPToWideConverter base(remote_file.GetName());
  if (!base.IsValid())
    return;

  Net::DownloadManager::Enqueue(remote_file.uri.c_str(), base);
#endif
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:25,代码来源:FileManager.cpp

示例9: assert

void
NOAAListWidget::OpenDetails(unsigned index)
{
  assert(index < stations.size());
  dlgNOAADetailsShowModal(stations[index].iterator);
  UpdateList();
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:7,代码来源:NOAAList.cpp

示例10: IsDownloading

void
ManagedFileListWidget::RefreshList()
{
  items.clear();

  bool download_active = false;
  for (auto i = repository.begin(), end = repository.end(); i != end; ++i) {
    const auto &remote_file = *i;
    DownloadStatus download_status;
    const bool is_downloading = IsDownloading(remote_file, download_status);

    TCHAR path[MAX_PATH];
    if (LocalPath(path, remote_file) &&
        (is_downloading || File::Exists(path))) {
      download_active |= is_downloading;
      items.append().Set(BaseName(path),
                         is_downloading ? &download_status : NULL,
                         HasFailed(remote_file));
    }
  }

  ListControl &list = GetList();
  list.SetLength(items.size());
  list.Invalidate();

#ifdef HAVE_DOWNLOAD_MANAGER
  if (download_active && !Timer::IsActive())
    Timer::Schedule(1000);
#endif
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:30,代码来源:FileManager.cpp

示例11: assert

void
NOAAListWidget::OpenDetails(unsigned index)
{
  assert(index < stations.size());
  dlgNOAADetailsShowModal(UIGlobals::GetMainWindow(),
                          stations[index].iterator);
  UpdateList();
}
开发者ID:Tjeerdm,项目名称:XCSoarDktjm,代码行数:8,代码来源:NOAAList.cpp

示例12: assert

void
NOAAListWidget::OnPaintItem(Canvas &canvas, const PixelRect rc, unsigned index)
{
  assert(index < stations.size());

  NOAAListRenderer::Draw(canvas, rc, *stations[index].iterator,
                         UIGlobals::GetDialogLook());
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:8,代码来源:NOAAList.cpp

示例13: LookupMode

  gcc_pure
  int LookupMode(const TCHAR *name) const {
    for (unsigned i = 0, size = modes.size(); i < size; ++i)
      if (modes[i] == name)
        return i;

    return -1;
  }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:8,代码来源:InputConfig.hpp

示例14:

static void
SetFormCaption()
{
  StaticString<32> buffer;
  unsigned pageSize = grid_view->GetNumColumns() * grid_view->GetNumRows();
  unsigned lastPage = buttons.size() / pageSize;
  buffer.Format(_T("Quick Menu  %d/%d"),
                grid_view->GetCurrentPage() + 1, lastPage + 1);
  wf->SetCaption(buffer);
}
开发者ID:davidswelt,项目名称:XCSoar,代码行数:10,代码来源:dlgQuickMenu.cpp

示例15: AppendEvent

  unsigned AppendEvent(pt2Event handler, const TCHAR *misc,
                       unsigned next) {
    if (events.full())
      return 0;

    Event &event = events.append();
    event.event = handler;
    event.misc = misc;
    event.next = next;

    return events.size() - 1;
  }
开发者ID:DRIZO,项目名称:xcsoar,代码行数:12,代码来源:InputConfig.hpp


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