本文整理汇总了C++中TrivialArray类的典型用法代码示例。如果您正苦于以下问题:C++ TrivialArray类的具体用法?C++ TrivialArray怎么用?C++ TrivialArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TrivialArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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);
}
示例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
}
示例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]);
}
}
示例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
}
示例6: AppendMode
int AppendMode(const TCHAR *name) {
if (modes.full())
return -1;
modes.append() = name;
return modes.size() - 1;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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
}
示例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
}
示例13: assert
void
NOAAListWidget::OpenDetails(unsigned index)
{
assert(index < stations.size());
dlgNOAADetailsShowModal(stations[index].iterator);
UpdateList();
}
示例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();
}
示例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());
}