本文整理汇总了C++中TrivialArray类的典型用法代码示例。如果您正苦于以下问题:C++ TrivialArray类的具体用法?C++ TrivialArray怎么用?C++ TrivialArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TrivialArray类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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
示例2: 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
示例3: 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
示例4: 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
示例5: 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
示例6: AppendMode
int AppendMode(const TCHAR *name) {
if (modes.full())
return -1;
modes.append() = name;
return modes.size() - 1;
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:7,代码来源:InputConfig.hpp
示例7: distance
int
ManagedFileListWidget::FindItem(const TCHAR *name) const
{
for (auto i = items.begin(), end = items.end(); i != end; ++i)
if (StringIsEqual(i->name, name))
return std::distance(items.begin(), i);
return -1;
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:9,代码来源:FileManager.cpp
示例8: MergeList
inline void
WifiListWidget::UpdateScanResults()
{
WifiVisibleNetwork *buffer = new WifiVisibleNetwork[networks.capacity()];
int n = wpa_supplicant.ScanResults(buffer, networks.capacity());
if (n >= 0)
MergeList(buffer, n);
delete[] buffer;
}
开发者ID:,项目名称:,代码行数:10,代码来源:
示例9: 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
示例10:
WifiListWidget::NetworkInfo *
WifiListWidget::FindVisibleBySSID(const char *ssid)
{
auto f = std::find_if(networks.begin(), networks.end(),
[ssid](const NetworkInfo &info) {
return info.signal_level >= 0 && info.ssid == ssid;
});
if (f == networks.end())
return nullptr;
return f;
}
开发者ID:,项目名称:,代码行数:12,代码来源:
示例11: GetList
void
ManagedFileListWidget::UpdateButtons()
{
#ifdef HAVE_DOWNLOAD_MANAGER
if (Net::DownloadManager::IsAvailable()) {
const unsigned current = GetList().GetCursorIndex();
download_button->SetEnabled(!items.empty() &&
CanDownload(repository, items[current].name));
cancel_button->SetEnabled(!items.empty() && items[current].downloading);
}
#endif
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:13,代码来源:FileManager.cpp
示例12: assert
void
ManagedFileListWidget::Cancel()
{
#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];
Net::DownloadManager::Cancel(item.name);
#endif
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:16,代码来源:FileManager.cpp
示例13: assert
void
NOAAListWidget::OpenDetails(unsigned index)
{
assert(index < stations.size());
dlgNOAADetailsShowModal(stations[index].iterator);
UpdateList();
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:7,代码来源:NOAAList.cpp
示例14: 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,代码来源:
示例15: 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
示例16: 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
示例17: assert
void
NOAAListWidget::OpenDetails(unsigned index)
{
assert(index < stations.size());
dlgNOAADetailsShowModal(UIGlobals::GetMainWindow(),
stations[index].iterator);
UpdateList();
}
开发者ID:Tjeerdm,项目名称:XCSoarDktjm,代码行数:8,代码来源:NOAAList.cpp
示例18:
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
示例19: assert
void
MutateTaskPointRenderer::OnPaintItem(Canvas &canvas, PixelRect rc,
unsigned DrawListIndex)
{
assert(DrawListIndex < point_types.size());
if (point_types[DrawListIndex] == current_type)
rc.left = row_renderer.DrawColumn(canvas, rc, _T("*"));
row_renderer.DrawTextRow(canvas, rc,
OrderedTaskPointName(point_types[DrawListIndex]));
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:12,代码来源:MutateTaskPointDialog.cpp
示例20: 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
注:本文中的TrivialArray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论