本文整理汇总了C++中DataFieldFileReader::GetAsString方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFieldFileReader::GetAsString方法的具体用法?C++ DataFieldFileReader::GetAsString怎么用?C++ DataFieldFileReader::GetAsString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFieldFileReader
的用法示例。
在下文中一共展示了DataFieldFileReader::GetAsString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: OnDeleteClicked
static void OnDeleteClicked(WndButton* pWnd){
TCHAR file_name[MAX_PATH];
WndProperty* wp;
DataFieldFileReader *dfe;
wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
if (!wp) return;
wp->OnLButtonDown((POINT){0,0});
dfe = (DataFieldFileReader*) wp->GetDataField();
int file_index = dfe->GetAsInteger();
if (file_index>0) {
_stprintf(file_name, TEXT("%s '%s' ?"), MsgToken(1789), dfe->GetAsString()); // Delete task file?
if(MessageBoxX(file_name, _T(" "), mbYesNo) == IdNo) {
return;
}
} else {
MessageBoxX(MsgToken(1790),_T(" "), mbOk); // No task file to delete
return;
}
if (file_index>0) {
lk::filesystem::deleteFile(dfe->GetPathFile());
// Cannot update dfe list, so we force exit.
ItemIndex = -1;
wf->SetModalResult(mrOK);
return;
}
}
示例3: OnDeleteClicked
static void OnDeleteClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){
(void)ListInfo; (void)Sender;
TCHAR file_name[MAX_PATH];
WndProperty* wp;
DataFieldFileReader *dfe;
wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
if (!wp) return;
HWND hwnd = wp->GetHandle();
SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
dfe = (DataFieldFileReader*) wp->GetDataField();
int file_index = dfe->GetAsInteger();
if (file_index>0) {
_stprintf(file_name, TEXT("%s '%s' ?"), MsgToken(1789), dfe->GetAsString()); // Delete task file?
if(MessageBoxX(hWndMapWindow, file_name, _T(" "), MB_YESNO|MB_ICONQUESTION) == IDNO) {
return;
}
} else {
MessageBoxX(hWndMapWindow, MsgToken(1790),_T(" "), MB_OK|MB_ICONEXCLAMATION); // No task file to delete
return;
}
if (file_index>0) {
DeleteFile(dfe->GetPathFile());
// Cannot update dfe list, so we force exit.
ItemIndex = -1;
wf->SetModalResult(mrOK);
return;
}
}
示例4: OnLoadClicked
static void OnLoadClicked(WndButton* pWnd){ // 091216
TCHAR file_name[MAX_PATH];
WndProperty* wp;
DataFieldFileReader *dfe;
wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
if (!wp) return;
wp->OnLButtonDown((POINT){0,0});
dfe = (DataFieldFileReader*) wp->GetDataField();
int file_index = dfe->GetAsInteger();
if (file_index>0) {
if (ValidTaskPoint(ActiveWayPoint) && ValidTaskPoint(1)) {
_stprintf(file_name, TEXT("%s '%s' ?"), gettext(TEXT("[email protected]_")), dfe->GetAsString()); // Clear old task and load
if(MessageBoxX(file_name, _T(" "), mbYesNo) == IdNo) {
return;
}
}
} else {
// LKTOKEN [email protected]_ = "No Task to load"
MessageBoxX(gettext(TEXT("[email protected]_")),_T(" "), mbOk);
return;
}
if (file_index>0) {
LPCTSTR szFileName = dfe->GetPathFile();
LPCTSTR wextension = _tcsrchr(szFileName, _T('.'));
if(wextension) {
bool bOK = false;
if(_tcsicmp(wextension,_T(LKS_TSK))==0) {
CTaskFileHelper helper;
bOK = helper.Load(szFileName);
}
#ifdef OLDTASK_COMPAT
else if (_tcsicmp(wextension,_T(LKS_OLD_TSK))==0) {
LoadNewTask(szFileName);
bOK = true;
}
#endif
else if (_tcsicmp(wextension,_T(LKS_WP_CUP))==0) {
bOK = LoadCupTask(szFileName);
} else if (_tcsicmp(wextension,_T(LKS_WP_GPX))==0) {
bOK = LoadGpxTask(szFileName);
}
if(!bOK) {
MessageBoxX(gettext(TEXT("[email protected]_")),_T(" "), mbOk);
return;
}
OverviewRefreshTask();
UpdateFilePointer();
UpdateCaption();
}
}
}
示例5: OnLoadClicked
static void OnLoadClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){ // 091216
(void)ListInfo; (void)Sender;
TCHAR file_name[MAX_PATH];
WndProperty* wp;
DataFieldFileReader *dfe;
wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
if (!wp) return;
HWND hwnd = wp->GetHandle();
SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
dfe = (DataFieldFileReader*) wp->GetDataField();
int file_index = dfe->GetAsInteger();
if (file_index>0) {
if (ValidTaskPoint(ActiveWayPoint) && ValidTaskPoint(1)) {
_stprintf(file_name, TEXT("%s '%s' ?"), gettext(TEXT("[email protected]_")), dfe->GetAsString()); // Clear old task and load
if(MessageBoxX(hWndMapWindow, file_name, _T(" "), MB_YESNO|MB_ICONQUESTION) == IDNO) {
return;
}
}
} else {
// LKTOKEN [email protected]_ = "No Task to load"
MessageBoxX(hWndMapWindow, gettext(TEXT("[email protected]_")),_T(" "), MB_OK|MB_ICONEXCLAMATION);
return;
}
if (file_index>0) {
LPCTSTR szFileName = dfe->GetPathFile();
LPCTSTR wextension = _tcsrchr(szFileName, _T('.'));
if(wextension) {
bool bOK = false;
if(_tcsicmp(wextension,_T(LKS_TSK))==0) {
CTaskFileHelper helper;
bOK = helper.Load(szFileName);
} else if (_tcsicmp(wextension,_T(LKS_OLD_TSK))==0) {
LoadNewTask(szFileName);
bOK = true;
} else if (_tcsicmp(wextension,_T(LKS_WP_CUP))==0) {
bOK = LoadCupTask(szFileName);
} else if (_tcsicmp(wextension,_T(LKS_WP_GPX))==0) {
bOK = LoadGpxTask(szFileName);
}
if(!bOK) {
MessageBoxX(hWndMapWindow, gettext(TEXT("[email protected]_")),_T(" "), MB_OK|MB_ICONEXCLAMATION);
return;
}
OverviewRefreshTask();
UpdateFilePointer();
UpdateCaption();
}
}
}
示例6: assert
bool
FilePicker(const TCHAR *caption, const TCHAR *patterns, TCHAR *buffer)
{
assert(patterns != NULL);
DataFieldFileReader df;
df.ScanMultiplePatterns(patterns);
const ComboList combo_list = df.CreateComboList(nullptr);
if (combo_list.size() == 0)
return false;
int i = ComboPicker(caption, combo_list, nullptr);
if (i < 0)
return false;
const ComboList::Item &item = combo_list[i];
df.SetFromCombo(item.DataFieldIndex, item.StringValue);
_tcscpy(buffer, df.GetAsString());
return true;
}
示例7: OnSaveExistingClicked
static void OnSaveExistingClicked(WindowControl * Sender) {
(void)Sender;
int file_index;
TCHAR file_name[MAX_PATH];
WndProperty* wp;
DataFieldFileReader *dfe;
if ( CheckClubVersion() ) {
ClubForbiddenMsg();
return;
}
wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
if (!wp) return;
HWND hwnd = wp->GetHandle();
SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
dfe = (DataFieldFileReader*) wp->GetDataField();
file_index = dfe->GetAsInteger();
if (file_index>0) {
_tcscpy(file_name,dfe->GetAsString());
if(MessageBoxX(hWndMapWindow, file_name,
// LKTOKEN [email protected]_ = "Overwrite profile?"
gettext(TEXT("[email protected]_")),
MB_YESNO|MB_ICONQUESTION) == IDYES) {
WriteProfile(dfe->GetPathFile());
// LKTOKEN [email protected]_ = "Profile saved!"
MessageBoxX(hWndMapWindow, gettext(TEXT("[email protected]_")),_T(""), MB_OK|MB_ICONEXCLAMATION);
return;
}
dfe->Set(0);
}
}
示例8: OnLoadClicked
static void OnLoadClicked(WindowControl * Sender, WndListFrame::ListInfo_t *ListInfo){ // 091216
(void)ListInfo; (void)Sender;
TCHAR file_name[MAX_PATH];
WndProperty* wp;
DataFieldFileReader *dfe;
wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
if (!wp) return;
HWND hwnd = wp->GetHandle();
SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
dfe = (DataFieldFileReader*) wp->GetDataField();
int file_index = dfe->GetAsInteger();
if (file_index>0) {
if (ValidTaskPoint(ActiveWayPoint) && ValidTaskPoint(1)) {
// _stprintf(file_name, TEXT("Clear old task and load '%s' ?"), dfe->GetAsString()); REMOVE FIXV2 101229
_stprintf(file_name, TEXT("%s '%s' ?"), gettext(TEXT("[email protected]_")), dfe->GetAsString()); // Clear old task and load
if(MessageBoxX(hWndMapWindow, file_name, _T(" "), MB_YESNO|MB_ICONQUESTION) == IDNO) {
return;
}
}
} else {
// LKTOKEN [email protected]_ = "No Task to load"
MessageBoxX(hWndMapWindow, gettext(TEXT("[email protected]_")),_T(" "), MB_OK|MB_ICONEXCLAMATION);
return;
}
if (file_index>0) {
LoadNewTask(dfe->GetPathFile());
OverviewRefreshTask();
UpdateFilePointer();
UpdateCaption();
}
}
示例9: OnLoadClicked
static void OnLoadClicked(WindowControl * Sender){
TCHAR file_name[MAX_PATH];
WndProperty* wp;
DataFieldFileReader *dfe;
wp = (WndProperty*)wf->FindByName(TEXT("prpFile"));
if (!wp) return;
HWND hwnd = wp->GetHandle();
SendMessage(hwnd,WM_LBUTTONDOWN,0,0);
dfe = (DataFieldFileReader*) wp->GetDataField();
int file_index = dfe->GetAsInteger();
if (file_index>0) {
_tcscpy(file_name,dfe->GetAsString());
if(MessageBoxX(hWndMapWindow, file_name,
// LKTOKEN [email protected]_ = "Load this profile?"
gettext(TEXT("[email protected]_")),
MB_YESNO|MB_ICONQUESTION) == IDYES) {
SettingsEnter();
ReadProfile(dfe->GetPathFile());
WAYPOINTFILECHANGED=true;
SettingsLeave();
MessageBoxX(hWndMapWindow,
// LKTOKEN [email protected]_ = "Profile loaded!"
gettext(TEXT("[email protected]_")),
_T(""), MB_OK|MB_ICONEXCLAMATION);
return;
}
dfe->Set(0);
}
}
示例10: 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();
}