Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93097945
UIElements.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Nov 26, 05:00
Size
911 B
Mime Type
text/x-c
Expires
Thu, Nov 28, 05:00 (2 d)
Engine
blob
Format
Raw Data
Handle
22572667
Attached To
R6621 SBCP High-Level Driver
UIElements.cpp
View Options
/**
* \file UIElements.cpp
*
* \date Oct 23, 2012
* \author Alexandre Tuleu
*/
#include "UIElements.h"
#include <iostream>
#include <sstream>
#include <stdexcept>
void FillHexaByteIfNeeded(const std::string & name,
bool nonInteractif,
sbcp::HexaByte & data){
std::ostringstream os;
if(!data.IsInitialized()){
if(nonInteractif){
os << name << " should be provided.";
throw std::runtime_error(os.str());
}
std::cout << "Please enter a " << name << " : " << std::flush;
std::cin >> data;
}
}
bool AskYesNoQuestion(const std::string & question){
std::string response;
while(true){
std::cout << question << " ? [yes/no]" << std::flush;
std::getline(std::cin,response);
if(response == "yes"){
return true;
}
if(response == "no"){
return false;
}
std::cout << "Please enter 'yes' or 'no'" << std::endl;
}
}
Event Timeline
Log In to Comment