void save_options(struct app_runtime_t *app, Options *options, char *config_file_path) { if ((!config_file_path) || (!strcmp(config_file_path, ""))) { return; } int rc = -1; int buf_size = 8*1024*1024; char *buffer = (char*) malloc(buf_size); memset(buffer, 0, buf_size); CSimpleIniA ini; ini.SetUnicode(); int is_write = formatOptions(options, buffer, buf_size); if (is_write != OPTIONS_WRITE) { goto SAVE_QUIT; } rc = ini.LoadData(buffer, strlen(buffer)); if (rc < 0) { s_logger.log_e(&s_logger, "APP: Load Options Error."); } rc = ini.SaveFile(config_file_path); if (rc < 0) { s_logger.log_e(&s_logger, "APP: Save Options Error."); } SAVE_QUIT: if (buffer != NULL) { free(buffer); buffer = NULL; } }
void CuneiformExporter::doExport(std::ostream& os) { if(!page()) { std::cerr << "empty page given"; std::cerr.flush(); return; } if(formatOptions().isTestOutput()) page()->setImageName(""); try { cf::CEDOutputArchive ar(os); CEDPage * p = page().get(); ar << boost::serialization::make_nvp("cedpage", p); } catch(std::exception& e) { std::cerr << e.what() << std::endl; std::cerr.flush(); } }
void HelpFormatter::format(std::ostream& ostr) const { ostr << "usage: " << _command; if (!_usage.empty()) { ostr << ' '; formatText(ostr, _usage, (int) _command.length() + 1); } ostr << '\n'; if (!_header.empty()) { formatText(ostr, _header, 0); ostr << "\n\n"; } formatOptions(ostr); if (!_footer.empty()) { ostr << '\n'; formatText(ostr, _footer, 0); ostr << '\n'; } }