本文整理汇总了C++中CInterface::getUserInput方法的典型用法代码示例。如果您正苦于以下问题:C++ CInterface::getUserInput方法的具体用法?C++ CInterface::getUserInput怎么用?C++ CInterface::getUserInput使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CInterface
的用法示例。
在下文中一共展示了CInterface::getUserInput方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(const int argc, const char **argv) {
std::stringstream usage;
std::string cc = "";
// hash map for fetching options data
options_map op_data;
try {
// process command line arguments and 'usage' should contain
// the usage message.
OptionParser op(argc, argv, usage);
int rval = op.processOptions(op_data);
if (rval == 0) {
// fetch user input from the interfacing code
CInterface ci;
// yes means load readline support
cc = ci.getUserInput(op_data["r"] == "yes");
} else if (rval == 2) {
std::cout << usage.str();
return 0;
}
} catch (po::error & e) {
std::cout << "Invalid options passed ...\n";
std::cout << usage.str();
return 1;
}
// add data meant to be appended to the beginning
cc = op_data["a"] + "\n" + cc;
// remove beginning and trailing whitespaces with custom function
cc = Utility::trim(cc);
// write to file only if content is not totally blank
if (!cc.empty()) {
Journal journal;
journal.takeNote(cc);
std::string dateformat = op_data["d"];
if (dateformat.begin() == dateformat.end()) {
dateformat = "%d/%m/%Y-%H:%M:%S";
}
journal.saveNote(dateformat);
}
return 0;
}