本文整理汇总了C++中printVersion函数的典型用法代码示例。如果您正苦于以下问题:C++ printVersion函数的具体用法?C++ printVersion怎么用?C++ printVersion使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了printVersion函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: usage
/*======================================================================*/
void usage(char *programName)
{
#if (BUILD+0) != 0
printVersion(BUILD);
#else
printVersion(0);
#endif
printf("\n\nUsage:\n\n");
printf(" %s [<switches>] <adventure>\n\n", programName);
printf("where the possible optional switches are:\n");
#ifdef HAVE_GLK
glk_set_style(style_Preformatted);
#endif
printf(" -v verbose mode\n");
printf(" -l log transcript to a file\n");
printf(" -c log player commands to a file\n");
printf(" -n no Status Line\n");
printf(" -d enter debug mode\n");
printf(" -t[<n>] trace game execution, higher <n> gives more trace\n");
printf(" -i ignore version and checksum errors\n");
printf(" -r make regression test easier (don't timestamp, page break, randomize...)\n");
#ifdef HAVE_GLK
glk_set_style(style_Normal);
#endif
}
示例2: main
int main(int argc, char* argv[]){
float vNumber=0.3;
CommandLineArgs myArgs{};
if(!processCommandLine(argc, argv, myArgs)){
std::cout<<"ERROR processing command line"<<"\n";
return 1;
}
if (myArgs.wantHelp){
printHelp();
return 0;
}
if (myArgs.wantVers){
printVersion(vNumber);
return 0;
}
//std::cout<<"Command line inputted \n iValue = "<<(myArgs.iValue=="")<<"\n";
// The readStream functions handle the input of strings. It calls the transformChar function to ensure that all alphabet characters are capitalised and any other characters are ignored.
std::string bigString{""};
if (myArgs.iValue == ""){
bigString= read(std::cin);
}
else{
std::ifstream in_file {myArgs.iValue};
if (in_file.good()){
bigString=read(in_file);
}
else {
std::cout<<"Input file not OK to read \n";
return 1;
}
}
//std::cout<<"Cipher choice = "<<myArgs.cipherChoice<<"\n";
std::string result;
auto myCipher = CipherFactory(myArgs.cipherChoice, myArgs.kValue);
if (myArgs.encOrDec) result = myCipher->encrypt(bigString);
else if (myArgs.encOrDec == false) result = myCipher->decrypt(bigString);
else std::cout<<"ERROR: Not sure whether to encrypt or decrypt \n";
// And now to out put the results
if (myArgs.oValue==""){
std::cout<<"Result is here: "<<result<<"\n";
outPut(std::cout, result);
}
else {
std::ofstream out_file{myArgs.oValue};
if (out_file.good()){
outPut (out_file, result);
}
else {
return 1;
}
}
}
示例3: set
int Tool::execute( cfg::cmd::CommandLine &cmd ) {
if (cmd.isSet("set")) {
set();
}
if (cmd.isSet("debug")) {
debug();
}
if (cmd.isSet("help")) {
printf("%s allowed options\n%s\n", name().c_str(), cmd.desc().c_str());
} else if (cmd.isSet("version")) {
printVersion();
} else if (cmd.isSet("build")) {
printBuild();
} else if (cmd.isSet("pretend")) {
pretend();
} else if (cmd.isSet("defaults")) {
defaults();
} else {
setupSignals();
// Initialize log system
util::log::init();
int result = run( cmd );
// Finalize log system
util::log::fin();
return result;
}
return 0;
}
示例4: printHelp
int PatcherApplication::run()
{
if (args.containsKey('h', "help")) {
printHelp();
return Ok;
}
if (args.containsKey('v', "version")) {
printVersion();
return Ok;
}
if ( !isArgumentsValid(args) ) {
printErrorMessage("", InvalidArguments);
return InvalidArguments;
}
// --- main workflow
std::string pathToQt = args.list().at(1);
Error error = patchQtInDir(pathToQt);
if (error != Ok) {
printErrorMessage(pathToQt, error);
return error;
}
return Ok;
}
示例5: printHelpInfo
void printHelpInfo(){
printVersion();
Usage();
Attention();
}
示例6: separationInit
static int separationInit(int debugBOINC)
{
int rc;
MWInitType initType = MW_PLAIN;
#if DISABLE_DENORMALS
mwDisableDenormalsSSE();
#endif
mwFixFPUPrecision();
if (debugBOINC)
initType |= MW_DEBUG;
if (SEPARATION_OPENCL)
initType |= MW_OPENCL;
rc = mwBoincInit(initType);
if (rc)
return rc;
if (BOINC_APPLICATION && mwIsFirstRun())
{
/* Print the version, but only once for the workunit */
printVersion(TRUE, FALSE);
}
#if (SEPARATION_OPENCL) && defined(_WIN32)
/* We need to increase timer resolution to prevent big slowdown on windows when CPU is loaded. */
mwSetTimerMinResolution();
#endif /* defined(_WIN32) */
return 0;
}
示例7: main
/**
* THE entry point for the application
*
* @param argc Number of arguments in array argv
* @param argv Arguments array
*/
int main(int argc, char** argv)
{
/* Create the Qt core application object */
QApplication qapp(argc, argv);
#if defined(__APPLE__) || defined(Q_OS_MAC)
/* Load plugins from within the bundle ONLY */
QDir dir(QApplication::applicationDirPath());
dir.cdUp();
dir.cd("plugins");
QApplication::setLibraryPaths(QStringList(dir.absolutePath()));
#endif
/* Let te world know... */
printVersion();
/* Parse command-line arguments */
if (parseArgs(argc, argv) == false)
return 0;
/* Load translation for current locale */
loadTranslation(QLocale::system().name(), qapp);
/* Create and initialize the Fixture Editor application object */
App app;
if (FXEDArgs::fixture.isEmpty() == false)
app.loadFixtureDefinition(FXEDArgs::fixture);
/* Show and execute the application */
app.show();
return qapp.exec();
}
示例8: usage
static void
usage(const char *message=NULL)
{
if (message) fprintf(stderr,"%s: %s\n",argv0,message);
fprintf(stderr,"usage: %s --path <path> [EXTRA_OPTIONS]\n",argv0);
fprintf(stderr," -D|--database <name> : data base to use (default %s)\n",dbName);
fprintf(stderr," -p|--path <path> : full path to the table\n");
fprintf(stderr," -t|--time <time> : sets query time (default: now)\n");
fprintf(stderr," -x|--expire <time> : sets query expiration time (default: forever)\n");
fprintf(stderr," -F|--flavor : set database flavor (default ofl)\n");
fprintf(stderr," -f|--file <file> : set file name for I/O (default: stdin/stdout)\n");
fprintf(stderr," -g|-r|--get|--read : get (read) data from database (default)\n");
fprintf(stderr," -s|-w|--set|--write : set (write) data to database\n");
fprintf(stderr," -c|--comment <txt> : set db comment (default user id)\n");
fprintf(stderr," -T|--tree : print config tree\n");
fprintf(stderr," -H|--history : print time line for node\n");
fprintf(stderr," -C|--config : print available config versions\n");
fprintf(stderr," -d|--dataonly : don't write #node/table line, just the data\n");
fprintf(stderr," -v|--verbose : set verbose mode on\n");
fprintf(stderr," -q|--quiet : set quiet mode on\n");
//fprintf(stderr," -w|--noWrite : don't write #node/table line to the output\n");
fprintf(stderr," -h|--help : this short help\n");
fprintf(stderr," supported time formats (cf. man date):\n");
for(int i=0; dbTimeFormat[i]!=NULL ; i++ ) {
const int MLEN=128;
char tmpstr[MLEN];
time_t t = time(0);
strftime(tmpstr,MLEN,dbTimeFormat[i],gmtime(&t));
fprintf(stderr," %-20s e.g.: %s\n",dbTimeFormat[i],tmpstr);
}
fprintf(stderr,"%s\n",printVersion());
if(message) exit(-1);
return;
}
示例9: main
//------------------------------------------------------------------------------
int main(int argc, char **argv) {
prgm_opt::variables_map option_map;
prgm_opt::options_description options("Options");
try {
prgm_opt::arg="[Value]";
options.add_options()
(CMDOPTIONS::HELP_OPTION[0],CMDOPTIONS::HELP_OPTION[2])
(CMDOPTIONS::PERCOLATORFILE_OPTION[0],prgm_opt::value<string>()->required(),CMDOPTIONS::PERCOLATORFILE_OPTION[2])
(CMDOPTIONS::MZIDFILE_OPTION[0],prgm_opt::value<string>()->required(),CMDOPTIONS::MZIDFILE_OPTION[2])
(CMDOPTIONS::INPUTDIR_OPTION[0],prgm_opt::value<string>()->required(),CMDOPTIONS::INPUTDIR_OPTION[2])
(CMDOPTIONS::MZIDOUTPUT_OPTION[0],prgm_opt::value<string>()->required(),CMDOPTIONS::MZIDOUTPUT_OPTION[2])
(CMDOPTIONS::OUTPUTDIR_OPTION[0],prgm_opt::value<string>()->required(),CMDOPTIONS::OUTPUTDIR_OPTION[2])
(CMDOPTIONS::DECOY_OPTION[0],CMDOPTIONS::DECOY_OPTION[2])
(CMDOPTIONS::VALIDATION_OPTION[0],CMDOPTIONS::VALIDATION_OPTION[2])
(CMDOPTIONS::WARNING_OPTION[0],CMDOPTIONS::WARNING_OPTION[2]);
prgm_opt::store(prgm_opt::parse_command_line(argc,argv,options),option_map);
if (option_map.count(CMDOPTIONS::HELP_OPTION[1])) {
printVersion();
cout << options;
CleanUp(EXIT_SUCCESS);
}
if (option_map.count(CMDOPTIONS::DECOY_OPTION[1]))
percolator.setDecoy();
if (option_map.count(CMDOPTIONS::VALIDATION_OPTION[1])) {
percolator.unsetValidation();
mzid.unsetValidation();
}
if (option_map.count(CMDOPTIONS::WARNING_OPTION[1]))
percolator.unsetWarningFlag();
if (option_map.count(CMDOPTIONS::MZIDOUTPUT_OPTION[1]))
mzid.setOutputFileEnding(option_map[CMDOPTIONS::MZIDOUTPUT_OPTION[1]].as<string>());
if (option_map.count(CMDOPTIONS::INPUTDIR_OPTION[1]))
if (!percolator.setInputDirectory(option_map[CMDOPTIONS::INPUTDIR_OPTION[1]].as<string>()))
THROW_ERROR(PRINT_TEXT::MZIDINPUTDIR_NOT_FOUND);
if (option_map.count(CMDOPTIONS::OUTPUTDIR_OPTION[1]))
if (!mzid.setOutputDirectory(option_map[CMDOPTIONS::OUTPUTDIR_OPTION[1]].as<string>()))
THROW_ERROR(PRINT_TEXT::MZIDOUTPUTDIR_NOT_CREATED);
if (option_map.count(CMDOPTIONS::PERCOLATORFILE_OPTION[1]))
if (!percolator.setFilename(option_map[CMDOPTIONS::PERCOLATORFILE_OPTION[1]].as<string>()))
THROW_ERROR_VALUE(PRINT_TEXT::NO_PERCOLATOR_FILE,option_map[CMDOPTIONS::PERCOLATORFILE_OPTION[1]].as<string>());
if (option_map.count(CMDOPTIONS::MZIDFILE_OPTION[1])) {
percolator.multiplemzidfiles=false;
if (!percolator.addFilenames(option_map[CMDOPTIONS::MZIDFILE_OPTION[1]].as<string>(),false))
THROW_ERROR("");
}
if (percolator.noFilename())
THROW_ERROR(PRINT_TEXT::PERCOLATOR_FILE_NOT_ENTERED);
xercesc::XMLPlatformUtils::Initialize();
if (!percolator.getPoutValues())
THROW_ERROR(PRINT_TEXT::CANNOT_LOAD_PERCOLATOR_FILE);
if (!mzid.insertMZIDValues(percolator.pout_values,percolator.mzidfilenames,percolator.multiplemzidfiles))
THROW_ERROR(PRINT_TEXT::CANNOT_INSERT);
CleanUp(EXIT_SUCCESS);
}
catch(exception &e) {
cerr << e.what() << endl;
CleanUp(EXIT_FAILURE);
}
}
示例10: readFromArgs
static s32 readFromArgs(s32 argc, const char* argv[], ocrConfig_t * ocrConfig) {
// Override any env variable with command line option
s32 cur = 1;
s32 userArgs = argc;
char * ocrOptPrefix = "-ocr:";
s32 ocrOptPrefixLg = strlen(ocrOptPrefix);
while(cur < argc) {
const char * arg = argv[cur];
if (strncmp(ocrOptPrefix, arg, ocrOptPrefixLg) == 0) {
// This is an OCR option
const char * ocrArg = arg+ocrOptPrefixLg;
if (strcmp("cfg", ocrArg) == 0) {
checkNextArgExists(cur, argc, "cfg");
setIniFile(ocrConfig, argv[cur+1]);
argv[cur] = NULL;
argv[cur+1] = NULL;
cur++; // skip param
userArgs-=2;
} else if (strcmp("version", ocrArg) == 0) {
printVersion();
exit(0);
break;
} else if (strcmp("help", ocrArg) == 0) {
printHelp();
exit(0);
break;
}
}
cur++;
}
return userArgs;
}
示例11: initProgram
void initProgram(int argc, char ** argv, char ** envp)
{
cfg.argc = argc;
cfg.argv = argv;
cfg.envp = envp;
cfg.help = 0;
cfg.debug = 0;
cfg.daemon = 0;
cfg.version = 0;
cfg.syslog = 0;
cfg.port = 0;
cfg.passkey = NULL;
initOptions();
printDebug();
printHelp();
printVersion();
signal(SIGINT, mySignal);
daemonize();
initLogging();
initServer();
}
示例12: readArgument
void readArgument(QApplication &app)
{
auto args = QCoreApplication::arguments();
auto name = QFileInfo{args.at(0)}.fileName();
for (int i = 1; i < args.size(); ++i) {
auto arg = args.at(i);
if (arg.compare("-d") == 0 || arg.compare("--debug") == 0) {
qInstallMessageHandler(debugMessageHandler);
} else if (arg.compare("-v") == 0 || arg.compare("--version") == 0) {
printVersion();
exit(0);
} else if (arg.compare("-h") == 0 || arg.compare("--help") == 0) {
printHelp(name);
exit(0);
} else {
printUnknownArgs(arg);
printHelp(name);
exit(1);
}
}
}
示例13: printHelp
/* prints help option */
void printHelp()
{
printVersion();
printf("----------------------\n");
printf("Command: dog\n");
printf("Usage: dog [-n] [-m filename] [-M filename] [filename]\n");
printf("switch: --help for this option\n");
}
示例14: main
int main(int argc, char *argv[])
{
/* Declarations */
int c, option_index = 0;
struct option long_options[] =
{
{"instrument-number", required_argument, 0, 'i'},
{"sample-number", required_argument, 0, 's'},
{"frequency", required_argument, 0, 'f'},
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
char *filename;
unsigned int playAllInstruments = TRUE;
unsigned int instrumentNumber = 0;
unsigned int playAllSamples = TRUE;
unsigned int sampleNumber = 0;
int frequency = 22050;
/* Parse command-line options */
while((c = getopt_long(argc, argv, "i:s:f:hv", long_options, &option_index)) != -1)
{
switch(c)
{
case 'i':
playAllInstruments = FALSE;
instrumentNumber = atoi(optarg);
break;
case 's':
playAllSamples = FALSE;
sampleNumber = atoi(optarg);
break;
case 'f':
frequency = atoi(optarg);
break;
case 'h':
printUsage(argv[0]);
return 0;
case '?':
printUsage(argv[0]);
return 1;
case 'v':
printVersion(argv[0]);
return 0;
}
}
/* Validate non options */
if(optind >= argc)
filename = NULL;
else
filename = argv[optind];
return SDL_8SVX_play8SVXSamples(filename, playAllInstruments, instrumentNumber, playAllSamples, sampleNumber, frequency);
}
示例15: usage
static void usage()
{
printVersion();
printf("Usage: xml2smf [args] [infile] [outfile]\n");
printf(" args:\n"
" -v print version\n"
" -d debug mode\n"
);
}