本文整理汇总了C++中DataFieldFileReader::GetItem方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFieldFileReader::GetItem方法的具体用法?C++ DataFieldFileReader::GetItem怎么用?C++ DataFieldFileReader::GetItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFieldFileReader
的用法示例。
在下文中一共展示了DataFieldFileReader::GetItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogFormat
bool
dlgStartupShowModal()
{
LogFormat("Startup dialog");
logo = new LogoView();
wf = LoadDialog(CallBackTable, UIGlobals::GetMainWindow(),
Layout::landscape ? _T("IDR_XML_STARTUP_L") :
_T("IDR_XML_STARTUP"));
assert(wf != NULL);
WndProperty* wp = ((WndProperty *)wf->FindByName(_T("prpProfile")));
assert(wp != NULL);
DataFieldFileReader* dfe = (DataFieldFileReader*)wp->GetDataField();
assert(dfe != NULL);
dfe->ScanDirectoryTop(_T("*.prf"));
if (dfe->GetNumFiles() <= 1) {
SelectProfile(dfe->GetPathFile());
delete wf;
delete logo;
return true;
}
unsigned best_index = 0;
uint64_t best_timestamp = 0;
unsigned length = dfe->size();
for (unsigned i = 0; i < length; ++i) {
const TCHAR *path = dfe->GetItem(i);
uint64_t timestamp = File::GetLastModification(path);
if (timestamp > best_timestamp) {
best_timestamp = timestamp;
best_index = i;
}
}
dfe->Set(best_index);
wp->RefreshDisplay();
if (wf->ShowModal() != mrOK) {
delete wf;
delete logo;
return false;
}
SelectProfile(dfe->GetPathFile());
delete wf;
delete logo;
return true;
}
示例2: dialog
bool
dlgStartupShowModal()
{
LogFormat("Startup dialog");
/* scan all profile files */
DataFieldFileReader *dfe = new DataFieldFileReader();
dfe->ScanDirectoryTop(_T("*.prf"));
/* skip this dialog if there is only one (or none) */
if (dfe->GetNumFiles() <= 1) {
SelectProfile(dfe->GetPathFile());
delete dfe;
return true;
}
/* preselect the most recently used profile */
unsigned best_index = 0;
uint64_t best_timestamp = 0;
unsigned length = dfe->size();
for (unsigned i = 0; i < length; ++i) {
const TCHAR *path = dfe->GetItem(i);
uint64_t timestamp = File::GetLastModification(path);
if (timestamp > best_timestamp) {
best_timestamp = timestamp;
best_index = i;
}
}
dfe->Set(best_index);
/* show the dialog */
const DialogLook &look = UIGlobals::GetDialogLook();
WidgetDialog dialog(look);
TwoWidgets widget(new LogoQuitWidget(look.button, dialog),
new StartupWidget(look, dialog, dfe));
dialog.CreateFull(UIGlobals::GetMainWindow(), _T(""), &widget);
const int result = dialog.ShowModal();
dialog.StealWidget();
return result == mrOK;
}