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


C++ DataFieldFileReader::Lookup方法代码示例

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


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

示例1: OnSaveClicked

static void OnSaveClicked(WndButton* pWnd){

  int file_index;
  TCHAR task_name[MAX_PATH];
  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;
  dfe = (DataFieldFileReader*)wp->GetDataField();

  file_index = dfe->GetAsInteger();

  // TODO enhancement: suggest a good new name not already in the list
  _tcscpy(task_name,TEXT("NEW"));
  dlgTextEntryShowModal(task_name, 10); // max length

  if (_tcslen(task_name)>0) {

	_tcscat(task_name, TEXT(LKS_TSK));

	dfe->Lookup(task_name);
	file_index = dfe->GetAsInteger();

	if (file_index==0) {
		// good, this file is unique..
		dfe->addFile(task_name, task_name);
		dfe->Lookup(task_name);
		wp->RefreshDisplay();
	}

  } else {
	// TODO code: report error, task not saved since no name was given
	return;
  }

  if (file_index>0) {
	// file already exists! ask if want to overwrite
        TCHAR sTmp[500];
	_sntprintf(sTmp, array_size(sTmp), TEXT("%s: '%s'"),
	// LKTOKEN  [email protected]_ = "Task file already exists"
		MsgToken(696),
		dfe->GetAsString());

		if(MessageBoxX(
			sTmp,
			// LKTOKEN  [email protected]_ = "Overwrite?"
			MsgToken(510),
			mbYesNo) != IdYes) {

			return;
		}
  }

  TCHAR file_name[MAX_PATH];
  LocalPath(file_name,TEXT(LKD_TASKS), task_name);

  SaveTask(file_name);
  UpdateCaption();
}
开发者ID:lshachar,项目名称:LK8000,代码行数:60,代码来源:dlgTaskOverview.cpp

示例2: LoadDialog

void
dlgLoggerReplayShowModal(void)
{
  wf = LoadDialog(CallBackTable,
                      XCSoarInterface::main_window, _T("IDR_XML_LOGGERREPLAY"));
  if (!wf)
    return;

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(_T("prpRate"));
  if (wp) {
    DataFieldFloat &df = *(DataFieldFloat *)wp->GetDataField();
    df.SetAsFloat(replay->GetTimeScale());
    wp->RefreshDisplay();
  }

  wp = (WndProperty*)wf->FindByName(_T("prpFile"));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();
    dfe->ScanDirectoryTop(_T("*.nmea"));
    dfe->ScanDirectoryTop(_T("*.igc"));
    dfe->Lookup(replay->GetFilename());
    wp->RefreshDisplay();
  }

  wf->ShowModal();

  delete wf;
}
开发者ID:Mrdini,项目名称:XCSoar,代码行数:31,代码来源:dlgLoggerReplay.cpp

示例3: Add

WndProperty *
RowFormWidget::AddFileReader(const TCHAR *label, const TCHAR *help,
                             const TCHAR *registry_key, const TCHAR *filters,
                             bool nullable)
{
  WndProperty *edit = Add(label, help);
  DataFieldFileReader *df = new DataFieldFileReader(NULL);
  edit->SetDataField(df);

  if (nullable)
    df->AddNull();

  size_t length;
  while ((length = _tcslen(filters)) > 0) {
    df->ScanDirectoryTop(filters);
    filters += length + 1;
  }

  TCHAR path[MAX_PATH];
  if (Profile::GetPath(registry_key, path))
    df->Lookup(path);

  edit->RefreshDisplay();

  return edit;
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:26,代码来源:RowFormWidget.cpp

示例4: setVariables

static void setVariables(void) {
WndProperty *wp;
TCHAR temptext[MAX_PATH];
TCHAR tmp[MAX_PATH];

  for (unsigned int i=0 ; i < NO_WP_FILES; i++)
  {
    _tcscpy(temptext,szWaypointFile[i]);
    _sntprintf(tmp,MAX_PATH,_T("prpFile%1u"),i+1);
    wp = (WndProperty*)wf->FindByName(tmp);

    if (wp) {
      DataFieldFileReader* dfe = static_cast<DataFieldFileReader*>(wp->GetDataField());
      if(dfe) {
          dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_WINPILOT));
          dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_XCSOAR));
          dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_CUP));
          dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_WP_COMPE));
          dfe->ScanDirectoryTop(_T(LKD_WAYPOINTS), _T("*" LKS_OPENAIP));
          dfe->Lookup(temptext);



        _sntprintf(tmp,MAX_PATH,_T("%s %1u "), MsgToken(2341),i+1);  // [email protected]_ "Waypoint File"
        wp->SetCaption(tmp);
      }
      wp->RefreshDisplay();
    }
  }
}
开发者ID:LK8000,项目名称:LK8000,代码行数:30,代码来源:dlgWaypointFiles.cpp

示例5: dlgLoggerReplayShowModal

void dlgLoggerReplayShowModal(void){

  wf = dlgLoadFromXML(CallBackTable, IDR_XML_LOGGERREPLAY);

  WndProperty* wp;

  if (wf) {

    wp = (WndProperty*)wf->FindByName(TEXT("prpRate"));
    if (wp) {
      wp->GetDataField()->SetAsFloat(ReplayLogger::TimeScale);
      wp->RefreshDisplay();
    }

    wp = (WndProperty*)wf->FindByName(TEXT("prpIGCFile"));
    if (wp) {
      DataFieldFileReader* dfe = static_cast<DataFieldFileReader*>(wp->GetDataField());
      if(dfe) {
        dfe->ScanDirectoryTop(_T(LKD_LOGS), _T("*" LKS_IGC));
        dfe->Lookup(ReplayLogger::GetFilename());
      }
      wp->RefreshDisplay();
    }

    wf->ShowModal();
    delete wf;
  }
  wf = NULL;
}
开发者ID:LK8000,项目名称:LK8000,代码行数:29,代码来源:dlgLoggerReplay.cpp

示例6: LoadDialog

void
ShowReplayDialog()
{
  wf = LoadDialog(CallBackTable, UIGlobals::GetMainWindow(),
                  _T("IDR_XML_LOGGERREPLAY"));
  if (!wf)
    return;

  WndProperty* wp;

  wp = (WndProperty*)wf->FindByName(_T("prpFile"));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();
    dfe->ScanDirectoryTop(_T("*.nmea"));
    dfe->ScanDirectoryTop(_T("*.igc"));
    dfe->Lookup(replay->GetFilename());
    wp->RefreshDisplay();
  }

  LoadFormProperty(*wf, _T("prpRate"), replay->GetTimeScale());

  wf->ShowModal();

  delete wf;
}
开发者ID:StefanL74,项目名称:XCSoar,代码行数:26,代码来源:ReplayDialog.cpp

示例7: dlgLoggerReplayShowModal

void dlgLoggerReplayShowModal(void){

  TCHAR tsuf[10];
  TCHAR filename[MAX_PATH];
  LocalPathS(filename, TEXT("dlgLoggerReplay.xml"));
  wf = dlgLoadFromXML(CallBackTable, 
                      filename, 
		      TEXT("IDR_XML_LOGGERREPLAY"));

  WndProperty* wp;

  if (wf) {

    wp = (WndProperty*)wf->FindByName(TEXT("prpRate"));
    if (wp) {
      wp->GetDataField()->SetAsFloat(ReplayLogger::TimeScale);
      wp->RefreshDisplay();
    }

    wp = (WndProperty*)wf->FindByName(TEXT("prpIGCFile"));
    if (wp) {
      DataFieldFileReader* dfe;
      dfe = (DataFieldFileReader*)wp->GetDataField();
      // dfe->ScanDirectoryTop(_T(""),TEXT("*.igc")); 
      _stprintf(tsuf,_T("*%s"),_T(LKS_IGC));
      dfe->ScanDirectoryTop(_T(LKD_LOGS),tsuf);
      dfe->Lookup(ReplayLogger::GetFilename());
      wp->RefreshDisplay();
    }

    wf->ShowModal();
    delete wf;
  }
  wf = NULL;
}
开发者ID:alberiolima,项目名称:LK8000,代码行数:35,代码来源:dlgLoggerReplay.cpp

示例8: LogStartUp

bool
dlgStartupShowModal()
{
  LogStartUp(_T("Startup dialog"));

  logo = new LogoView();

  wf = LoadDialog(CallBackTable, XCSoarInterface::main_window,
                  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);

  ((WndButton *)wf->FindByName(_T("cmdClose")))
    ->SetOnClickNotify(OnCloseClicked);

  ((WndButton *)wf->FindByName(_T("cmdQuit")))->SetOnClickNotify(OnQuit);

  dfe->ScanDirectoryTop(_T("*.prf"));
  dfe->Lookup(startProfileFile);
  wp->RefreshDisplay();

  if (dfe->GetNumFiles() <= 2) {
    delete wf;
    delete logo;
    return true;
  }

  if (wf->ShowModal() != mrOK) {
    delete wf;
    delete logo;
    return false;
  }

  const TCHAR *path = dfe->GetPathFile();
  if (!string_is_empty(path)) {
    _tcscpy(startProfileFile, path);

    /* When a profile from a secondary data path is used, this path
       becomes the primary data path */
    TCHAR temp[MAX_PATH];
    SetPrimaryDataPath(DirName(path, temp));
  }

  delete wf;
  delete logo;
  return true;
}
开发者ID:joachimwieland,项目名称:xcsoar-jwieland,代码行数:53,代码来源:dlgStartup.cpp

示例9: UpdateFilePointer

static void UpdateFilePointer(void) {
  WndProperty *wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();
    if (_tcslen(LastTaskFileName)>0) {
      dfe->Lookup(LastTaskFileName);
    } else {
      dfe->Set(0);
    }
    wp->RefreshDisplay();
  }
}
开发者ID:lshachar,项目名称:LK8000,代码行数:13,代码来源:dlgTaskOverview.cpp

示例10: LogStartUp

bool
dlgStartupShowModal()
{
  LogStartUp(_T("Startup dialog"));

  logo = new LogoView();

  wf = LoadDialog(CallBackTable, XCSoarInterface::main_window,
                  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);

  ((WndButton *)wf->FindByName(_T("cmdClose")))
    ->SetOnClickNotify(OnCloseClicked);

  ((WndButton *)wf->FindByName(_T("cmdQuit")))->SetOnClickNotify(OnQuit);

  dfe->SetNotNullable();
  dfe->ScanDirectoryTop(_T("*.prf"));
  dfe->Lookup(Profile::GetPath());
  wp->RefreshDisplay();

  if (dfe->GetNumFiles() <= 1) {
    SelectProfile(dfe->GetPathFile());

    delete wf;
    delete logo;
    return true;
  }

  if (wf->ShowModal() != mrOK) {
    delete wf;
    delete logo;
    return false;
  }

  SelectProfile(dfe->GetPathFile());

  delete wf;
  delete logo;
  return true;
}
开发者ID:macsux,项目名称:XCSoar,代码行数:48,代码来源:dlgStartup.cpp

示例11: OnSaveClicked

static void OnSaveClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){
  (void)ListInfo; (void)Sender;

  int file_index; 
  TCHAR task_name[MAX_PATH];
  TCHAR file_name[MAX_PATH];
  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;
  dfe = (DataFieldFileReader*)wp->GetDataField();

  file_index = dfe->GetAsInteger();

  // TODO enhancement: suggest a good new name not already in the list
  _tcscpy(task_name,TEXT("NEW"));
  dlgTextEntryShowModal(task_name, 10); // max length

  if (_tcslen(task_name)>0) {

	_tcscat(task_name, TEXT(LKS_TSK));
	LocalPath(file_name,TEXT(LKD_TASKS));
	_tcscat(file_name,TEXT("\\"));
	_tcscat(file_name,task_name); // 091101

	dfe->Lookup(file_name);
	file_index = dfe->GetAsInteger();

	if (file_index==0) {
		// good, this file is unique..
		dfe->addFile(task_name, file_name);
		dfe->Lookup(file_name);
		wp->RefreshDisplay();
	}

  } else {
	// TODO code: report error, task not saved since no name was given
	return;
  }

  if (file_index>0) {
	// file already exists! ask if want to overwrite
	_stprintf(file_name, TEXT("%s: '%s'"), 
	// LKTOKEN  [email protected]_ = "Task file already exists" 
		gettext(TEXT("[email protected]_")),
		dfe->GetAsString());

		if(MessageBoxX(hWndMapWindow,
			file_name,
			// LKTOKEN  [email protected]_ = "Overwrite?" 
			gettext(TEXT("[email protected]_")),
			MB_YESNO|MB_ICONQUESTION) != IDYES) {

			return;
		}
  }

  SaveTask(dfe->GetPathFile());
  UpdateCaption();
}
开发者ID:eonezhang,项目名称:LK8000,代码行数:61,代码来源:dlgTaskOverview.cpp

示例12: dlgStartupShowModal

void dlgStartupShowModal(void){
  WndProperty* wp;
  StartupStore(TEXT("Startup dialog\n"));

  if (!InfoBoxLayout::landscape) {
    wf = dlgLoadFromXML(CallBackTable,
                        TEXT("dlgStartup_L.xml"),
                        XCSoarInterface::main_window,
                        TEXT("IDR_XML_STARTUP_L"));
  } else {
    wf = dlgLoadFromXML(CallBackTable,
                        TEXT("dlgStartup.xml"),
                        XCSoarInterface::main_window,
                        TEXT("IDR_XML_STARTUP"));
  }
  if (!wf) return;

  wSplash = (WndOwnerDrawFrame*)wf->FindByName(TEXT("frmSplash"));

  ((WndButton *)wf->FindByName(TEXT("cmdClose")))
    ->SetOnClickNotify(OnCloseClicked);

  TCHAR temp[MAX_PATH];

  _stprintf(temp,TEXT("XCSoar: Version %s"), XCSoar_Version);
  wf->SetCaption(temp);

  wp = ((WndProperty *)wf->FindByName(TEXT("prpDisclaimer")));
  if (wp)
    wp->SetText(TEXT("Pilot assumes complete\r\nresponsibility to operate\r\nthe aircraft safely.\r\nMaintain effective lookout.\r\n"));

  wp = ((WndProperty *)wf->FindByName(TEXT("prpProfile")));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();
    if (is_altair())
      dfe->ScanDirectoryTop(TEXT("config/*.prf"));
    else
      dfe->ScanDirectoryTop(TEXT("*.prf"));
    dfe->Lookup(startProfileFile);
    wp->RefreshDisplay();
    if (dfe->GetNumFiles()<=2) {
      delete wf;
      wf = NULL;
      return;
    }
  }

  wf->ShowModal();

  wp = (WndProperty*)wf->FindByName(TEXT("prpProfile"));
  if (wp) {
    DataFieldFileReader* dfe;
    dfe = (DataFieldFileReader*)wp->GetDataField();
    if (_tcslen(dfe->GetPathFile())>0) {
      _tcscpy(startProfileFile,dfe->GetPathFile());
    }
  }

  delete wf;

  wf = NULL;

}
开发者ID:scottp,项目名称:xcsoar,代码行数:64,代码来源:dlgStartup.cpp

示例13: OnSaveNewClicked

static void OnSaveNewClicked(WindowControl * Sender) {
  (void)Sender;

  int file_index; 
  TCHAR file_name[MAX_PATH];
  TCHAR profile_name[MAX_PATH];
  TCHAR tmptext[MAX_PATH];
  WndProperty* wp;
  DataFieldFileReader *dfe;

  wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
  if (!wp) return;
  dfe = (DataFieldFileReader*) wp->GetDataField();

  _tcscpy(profile_name,_T(""));
  dlgTextEntryShowModal(profile_name, 13); // max length including termination 0

  if (_tcslen(profile_name)<=0) return;


  _tcscat(profile_name, TEXT(LKS_PRF));
  LocalPath(file_name,TEXT(LKD_CONF));
  _tcscat(file_name,TEXT("\\"));
  _tcscat(file_name,profile_name);

  dfe->Lookup(file_name);
  file_index = dfe->GetAsInteger();

  if (file_index==0) {
	_stprintf(tmptext, TEXT("%s: %s"), 
	// LKTOKEN  [email protected]_ = "New profile" 
		gettext(TEXT("[email protected]_")), 
		profile_name);

	if(MessageBoxX(hWndMapWindow, tmptext, 
	// LKTOKEN  [email protected]_ = "Save ?" 
		gettext(TEXT("[email protected]_")), 
		MB_YESNO|MB_ICONQUESTION) == IDYES) {

		WriteProfile(file_name);
		dfe->addFile(profile_name, file_name);

		MessageBoxX(hWndMapWindow, 
	// LKTOKEN  [email protected]_ = "Profile saved!" 
		gettext(TEXT("[email protected]_")), 
		_T(""), MB_OK|MB_ICONEXCLAMATION);

  		dfe->Set(0);
		return;
	}
  }

  if (file_index>0) {
	_stprintf(tmptext, TEXT("%s: %s"), 
	// LKTOKEN  [email protected]_ = "Profile already exists" 
		gettext(TEXT("[email protected]_")), 	
		profile_name);

	if (CheckClubVersion() ) {
		MessageBoxX(hWndMapWindow, tmptext,
	// LKTOKEN  [email protected]_ = "Cannot overwrite!" 
		gettext(TEXT("[email protected]_")),
		MB_OK|MB_ICONEXCLAMATION);
	} else {
		if(MessageBoxX(hWndMapWindow, tmptext, 
	// LKTOKEN  [email protected]_ = "Overwrite?" 
		gettext(TEXT("[email protected]_")), 
		MB_YESNO|MB_ICONQUESTION) == IDYES) {

			WriteProfile(file_name);
			MessageBoxX(hWndMapWindow, 
	// LKTOKEN  [email protected]_ = "Profile saved!" 
			gettext(TEXT("[email protected]_")),
			_T(""), MB_OK|MB_ICONEXCLAMATION);
			return;
		}
	}
  	dfe->Set(0);
  }


}
开发者ID:JanezKolar,项目名称:LK8000,代码行数:82,代码来源:dlgProfiles.cpp


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