本文整理汇总了C++中History::saveHistory方法的典型用法代码示例。如果您正苦于以下问题:C++ History::saveHistory方法的具体用法?C++ History::saveHistory怎么用?C++ History::saveHistory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类History
的用法示例。
在下文中一共展示了History::saveHistory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: guiChangeIP
void guiChangeIP(Frame *frame, int eventId){
Change c;
HANDLE tibia = c.getTibiaProcess();
if(!tibia){
frame->sb->SetStatusText(wxT("Tibia process not found!"),0);
if(eventId == MENU_CHANGE_IP)
sendDialog(wxT("Tibia process not found!"), wxOK | wxICON_ERROR);
CloseHandle(tibia);
return;
}
std::string sip = std::string(frame->ip->GetValue().mb_str());
int sport = frame->host->GetValue();
std::string client = std::string(frame->clients->GetValue().mb_str());
if(sip == ""){
frame->sb->SetStatusText(wxT("IP adress not found!"),0);
if(eventId == MENU_CHANGE_IP)
sendDialog(wxT("IP adress not found!"), wxOK | wxICON_ERROR);
return;
}
size_t found = sip.find(":");
if(found != string::npos){
sport = atoi(sip.substr(found+1, sip.size()).c_str());
sip = sip.substr(0, found);
frame->ip->SetValue(sip);
frame->host->SetValue(sport);
}
if(client != "Auto"){
std::string s ="";
s += client.at(1);
if(s == ".")
client = client.erase(1,1);
}
bool ret = c.changeIP(sip, sport, client);
if(ret){
frame->sb->SetStatusText(wxT("IP Changed!"),0);
if(eventId == MENU_CHANGE_IP)
sendDialog(wxT("IP Changed!"), wxOK);
}else{
frame->sb->SetStatusText(wxT("IP not Changed!"),0);
if(eventId == MENU_CHANGE_IP)
sendDialog(wxT("IP not Changed!"), wxOK | wxICON_ERROR);
return;
}
char buf[4];
itoa(sport, buf, 10);
std::string save;
save += sip + ":" + buf;
h.saveHistory(save);
frame->ip->Clear();
vector<string>z;
z = h.getHistory();
for(int i = 0; i < int(z.size()); i++){
wxString wxs(z[i].c_str(), wxConvUTF8);
frame->ip->Append(wxs);
}
std::string tmp = z[0].substr(0, z[0].size()-5);
wxString last(tmp.c_str(), wxConvUTF8);
frame->ip->SetValue(last);
}