• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ parseOptions函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中parseOptions函数的典型用法代码示例。如果您正苦于以下问题:C++ parseOptions函数的具体用法?C++ parseOptions怎么用?C++ parseOptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parseOptions函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, char **argv) {
    int firstarg;

    config.hostip = sdsnew("127.0.0.1");
    config.hostport = 6379;
    config.hostsocket = NULL;
    config.repeat = 1;
    config.interval = 0;
    config.dbnum = 0;
    config.interactive = 0;
    config.shutdown = 0;
    config.monitor_mode = 0;
    config.pubsub_mode = 0;
    config.latency_mode = 0;
    config.stdinarg = 0;
    config.auth = NULL;
    config.raw_output = !isatty(fileno(stdout)) && (getenv("FAKETTY") == NULL);
    config.mb_delim = sdsnew("\n");
    cliInitHelp();

#ifdef _WIN32
    _fmode = _O_BINARY;
    _setmode(_fileno(stdin), _O_BINARY);
    _setmode(_fileno(stdout), _O_BINARY);
    _setmode(_fileno(stderr), _O_BINARY);

    if (!w32initWinSock()) {
      printf("Winsock init error %d", WSAGetLastError());
      exit(1);
    };

    atexit((void(*)(void)) WSACleanup);
#endif
    firstarg = parseOptions(argc,argv);
    argc -= firstarg;
    argv += firstarg;

    /* Start in latency mode if appropriate */
    if (config.latency_mode) {
        cliConnect(0);
        latencyMode();
    }

    /* Start interactive mode when no command is provided */
    if (argc == 0) {
        /* Note that in repl mode we don't abort on connection error.
         * A new attempt will be performed for every command send. */
        cliConnect(0);
        repl();
    }

    /* Otherwise, we have some arguments to execute */
    if (cliConnect(0) != REDIS_OK) exit(1);
    return noninteractive(argc,convertToSds(argc,argv));
}
开发者ID:ambakshi,项目名称:redis,代码行数:55,代码来源:redis-cli.c


示例2: initialize

bool AndroidInputServer::initialize(int argc, char* argv[]) {
	// parse arguments, daemonize, create device handlers, ready sockets

	if ( !parseOptions(argc, argv) ) {
		logger->error("Error parsing parametres");
		return false;
	}

	if ( !parseOptionsFile() ) {
		logger->error("Error in config file");
		return false;
	}

	if ( !getDefaultPaths() ) {
		logger->error("Error setting options");
		return false;
	}

	if (debug) {
		logger->printMessage("08.12.2011 16:25:02 Options parsed");
	}

	if (!semaphoresInit()) {
		logger->error("13.12.2011 21:17:54 Semaphore initialization failed");
		return false;
	}

	if ( isDaemon ) {
		if (!daemonize()) {
			logger->error("06.12.2011 01:34:59 daemonize() error");
			return false;
		}
	}

	if (isDaemon && debug) {
		logger->printMessage("06.12.2011 01:40:39 Daemonized");
	}

	if ( !readySocket(&keyboardListeningSocket, &keyboardServerAddress, keyboardListeningPort) ) {
		logger->error("08.12.2011 16:20:59 readySocket() error");
		return false;
	}

	if ( !readySocket(&mouseListeningSocket, &mouseServerAddress, mouseListeningPort) ) {
		logger->error("12.11.2012 10:00:01 readySocket() error");
		return false;
	}

	if (debug) {
		logger->printMessage("08.12.2011 16:27:10 listeningSocket bound");
	}

	return true;
}
开发者ID:AlvinCheng,项目名称:Android-Virtual-Input-for-Linux,代码行数:54,代码来源:AndroidInputServer.cpp


示例3: main

/**
 * @brief Main entry point.
 */
int main(int argc, char** argv)
{
    boost::program_options::variables_map variables;

    if (parseOptions(argc, argv, variables))
    {
        run(variables);
    }

    return 0;
}
开发者ID:HiddenDark,项目名称:freeablo,代码行数:14,代码来源:main.cpp


示例4: parseOptions

C3dsTool::EParseOptionReturn C3dsTool::parseOptions(int a_nKey, int& a_nIndex, int m_nArgc, char* a_pArgv[])
{
	for (SOption* pOption = s_Option; pOption->Name != nullptr || pOption->Key != 0 || pOption->Doc != nullptr; pOption++)
	{
		if (pOption->Key == a_nKey)
		{
			return parseOptions(pOption->Name, a_nIndex, m_nArgc, a_pArgv);
		}
	}
	return kParseOptionReturnIllegalOption;
}
开发者ID:ajd4096,项目名称:3dstool,代码行数:11,代码来源:3dstool.cpp


示例5: parseOptions

void Application::slotParseMessage(const QString &msg, QObject*)
{
    if (msg.startsWith(QLatin1String("MSG_PARSEOPTIONS:"))) {
        const int lengthOfMsgPrefix = 17;
        QStringList options = msg.mid(lengthOfMsgPrefix).split(QLatin1Char('|'));
        parseOptions(options);
        setupLogging();
    } else if (msg.startsWith(QLatin1String("MSG_SHOWSETTINGS"))) {
        showSettingsDialog();
    }
}
开发者ID:Buckeye,项目名称:client,代码行数:11,代码来源:application.cpp


示例6: parseOptions

struct hash *optionParseIntoHash(int *pArgc, char *argv[], boolean justFirst)
/* Read options in command line (only up to first real argument) into
 * options hash.   Options come in three forms:
 *      -option         words starting with dash
 *      option=val      words with = in the middle
 *      -option=val     combining the two.
 * The resulting hash will be keyed by the option name with the val
 * string for value.  For '-option' types the value is 'on'. */
{
return parseOptions(pArgc, argv, justFirst, NULL);
}
开发者ID:Puneet-Shivanand,项目名称:zinba,代码行数:11,代码来源:options.c


示例7: main

int main(int argc, char **argv) {
    char filename[kMaxStringLength];
    char targetName[kMaxStringLength];
    uint64_t targetPos;
    parseOptions(argc, argv,  filename, targetName, &targetPos);
    mafFileApi_t *mfa = maf_newMfa(filename, "r");

    searchInput(mfa, targetName, targetPos);
    maf_destroyMfa(mfa);

    return EXIT_SUCCESS;
}
开发者ID:adamnovak,项目名称:mafTools,代码行数:12,代码来源:mafPositionFinder.c


示例8: main

int main(int argc, char **argv) {
    extern const int kMaxStringLength;
    char filename[kMaxStringLength];
    parseOptions(argc, argv, filename);
    
    mafFileApi_t *mfa = maf_newMfa(filename, "r");
    processBody(mfa);

    maf_destroyMfa(mfa);

    return EXIT_SUCCESS;
}
开发者ID:sorrywm,项目名称:mafTools,代码行数:12,代码来源:mafBlockDuplicateFilter.c


示例9: main

extern int main (int __unused__ argc, char **argv)
{
    cookedArgs *args;
#ifdef VMS
    extern int getredirection (int *ac, char ***av);

    /* do wildcard expansion and I/O redirection */
    getredirection (&argc, &argv);
#endif

#ifdef AMIGA
    /* This program doesn't work when started from the Workbench */
    if (argc == 0)
	exit (1);
#endif

#ifdef __EMX__
    _wildcard (&argc, &argv);	/* expand wildcards in argument list */
#endif

#if defined (macintosh) && BUILD_MPW_TOOL == 0
    argc = ccommand (&argv);
#endif

    setCurrentDirectory ();
    setExecutableName (*argv++);
    checkRegex ();

    args = cArgNewFromArgv (argv);
    previewFirstOption (args);
    testEtagsInvocation ();
    initializeParsing ();
    initOptions ();
    readOptionConfiguration ();
    verbose ("Reading initial options from command line\n");
    parseOptions (args);
    checkOptions ();
    makeTags (args);

    /*  Clean up.
     */
    eFree (CurrentDirectory);
    cArgDelete (args);
    freeKeywordTable ();
    freeSourceFileResources ();
    freeTagFileResources ();
    freeOptionResources ();
    freeParserResources ();
    freeRegexResources ();

    exit (0);
    return 0;
}
开发者ID:att,项目名称:uwin,代码行数:53,代码来源:main.c


示例10: main

int
main(int argc, char **argv)
{
    int rc;
    int i;
    char *l;

    l = setlocale(LC_ALL, "");
    if(!l)
        ErrorF("Warning: couldn't set locale.\n");

    inputState = allocIso2022();
    if(!inputState)
        FatalError("Couldn't create input state\n");
        
    outputState = allocIso2022();
    if(!outputState)
        FatalError("Couldn't create output state\n");
    
    if(l) {
        locale_name = setlocale(LC_CTYPE, NULL);
    } else {
        locale_name = getenv("LC_ALL");
        if(locale_name == NULL) {
            locale_name = getenv("LC_CTYPE");
            if(locale_name == NULL) {
                locale_name = getenv("LANG");
            }
        }
    }

    if(locale_name == NULL) {
        ErrorF("Couldn't get locale name -- using C\n");
        locale_name = "C";
    }

    rc = initIso2022(locale_name, NULL, outputState);
    if(rc < 0)
        FatalError("Couldn't init output state\n");

    i = parseOptions(argc, argv);
    if(i < 0)
        FatalError("Couldn't parse options\n");

    rc = mergeIso2022(inputState, outputState);
    if(rc < 0)
        FatalError("Couldn't init input state\n");

    if(converter)
        return convert(0, 1);
    else
        return condom(argc - i, argv + i);
}
开发者ID:aosm,项目名称:X11,代码行数:53,代码来源:luit.c


示例11: main

int main(int argc, char** argv) {
	parseOptions(argc, argv);

	int n;

	assert(argc == 2);
	n = atoi(argv[1]);

	engine.solve(new NNQueens(n));

	return 0;
}
开发者ID:geoffchu,项目名称:chuffed,代码行数:12,代码来源:nn_queens.c


示例12: parseConnectConfirmTpdu

static bool
parseConnectConfirmTpdu(CotpConnection* self, uint8_t* buffer, uint8_t len)
{
    if (len < 6)
        return false;

    self->srcRef = getUint16(buffer);
    self->dstRef = getUint16(buffer + 2);
    self->protocolClass = getUint8(buffer + 4);

    return parseOptions(self, buffer + 5, len - 6);
}
开发者ID:nono19710321,项目名称:libiec61850,代码行数:12,代码来源:cotp.c


示例13: main

int main(int argc, char **argv)
{
    OptionsStruct opts; // struct for options
    int optStatus = 0; //

    // Get the parameters:
    optStatus = parseOptions(argc, argv, &opts);

    // if errors reading options then exit with non 0 status
    if (optStatus != 0)
    {
        return 1;
    }

    //open the Raspberry Pi's onboard serial port, baud rate is 115200
    //make sure that the display module has the same baud rate
    genieSetup("/dev/ttyAMA0", 115200);

    // If a value is provided send that to the display and exit
    if (strlen(opts.value) > 0)
    {
        pushToDisplay(opts, opts.value);
        // If no value provided on command line the use stdin
        // Need to fix this for non string objects
    } else {
        int continueLoop = 1;
        while (continueLoop)
        {
            char *line = NULL;
            size_t size;
            size_t chars;
            chars = getline(&line, &size, stdin);
            if (chars == -1) {
                continueLoop = 0; // get out of the loop
            } else {
                // remove the newline character
                if (line[chars - 1] == '\n')
                {
                    line[chars - 1] = '\0';
                    --chars;
                }
                // push the line to the display
                pushToDisplay(opts, line);
            }
        }
    }
    if (opts.cleanClose == 1)
    {
        genieClose();
    }
    return 0;
}
开发者ID:notrom,项目名称:visiGenieWriter-Pi,代码行数:52,代码来源:visiGenieWrite.c


示例14: main

int main(int argc, char **argv)
{
	std::set_terminate(sp_android_terminate);
	std::string packageName = "org.stappler.stappler";
	stappler::data::Value val = stappler::data::readFile("app.json");
	if (val.isDictionary()) {
		stappler::data::Value &resultObj = val.getValue("result");
		if (resultObj.isArray()) {
			stappler::data::Value &obj = resultObj.getValue(0);
			if (obj.isDictionary()) {
				std::string name = obj.getString("alias");
				if (name.empty()) {
					name = obj.getString("name");
				}
				if (!name.empty()) {
					packageName = name;
				}
			}
		}
	}

	stappler::data::Value args = parseOptions(argc, (const char **)argv);
	if (args.getInteger("width") == 0) {
		args.setInteger(1024, "width");
	}

	if (args.getInteger("height") == 0) {
		args.setInteger(768, "height");
	}

	if (args.getString("package").empty()) {
		args.setString(packageName, "package");
	}

	if (args.getString("locale").empty()) {
		args.setString("en-us", "locale");
	}

	if (args.getDouble("density") == 0.0f) {
		args.setDouble(1.0f, "density");
	}

	stappler::platform::desktop::_screenSize = cocos2d::Size(args.getInteger("width"), args.getInteger("height"));
	stappler::platform::desktop::_isTablet = args.getBool("isTablet");
	stappler::platform::desktop::_package = args.getString("package");
	stappler::platform::desktop::_density = args.getDouble("density");
	stappler::platform::desktop::_isFixed = args.getBool("fixed");
	stappler::platform::desktop::_userLanguage = args.getString("locale");

    // create the application instance
    return Application::getInstance()->run();
}
开发者ID:SBKarr,项目名称:stappler,代码行数:52,代码来源:SPMain.cpp


示例15: main

int main(int argc, char **argv) {
    extern const int kMaxStringLength;
    char seq[kMaxSeqName];
    char filename[kMaxStringLength];
    uint32_t start, stop;
    parseOptions(argc, argv, filename, seq, &start, &stop);
    mafFileApi_t *mfa = maf_newMfa(filename, "r");

    processBody(mfa, seq, start, stop);
    maf_destroyMfa(mfa);
    
    return EXIT_SUCCESS;
}
开发者ID:sorrywm,项目名称:mafTools,代码行数:13,代码来源:mafBlockExtractor.c


示例16: main

int main(int argc, char** argv) {
	parseOptions(argc, argv);

	assert(argc == 4);

	int n = atoi(argv[1]);
	int m = atoi(argv[2]);
	int c = atoi(argv[3]);

	engine.solve(new GridColouring(n, m, c));

	return 0;
}
开发者ID:geoffchu,项目名称:chuffed,代码行数:13,代码来源:grid_colouring.c


示例17: parseOptions

void KLameOptionsDialogue::stripBadOptions(QString& options)
{
    short optionNumber = 0;
    QString option = parseOptions(options, optionNumber);
    QString goodOptions = "";
    while (option != "")
    {
        QString keyword = option.section(" ",0,0);// Pull out option keyword
        for ( QStringList::Iterator it = validKeywords.begin();
                it != validKeywords.end(); ++it)
        {
            if (keyword == *it)
            {
                goodOptions += option + " ";
                break;
            }
        }
        optionNumber++;
        option = parseOptions(options, optionNumber);
    }
    options = goodOptions;                  // Send back stripped option string
}
开发者ID:ksarkies,项目名称:kLAME,代码行数:22,代码来源:klameoptionsdialog.cpp


示例18: getString

void RequestParser::parseRequest(const Item& aItem, Request& aRequest)
{
  if (!getString(aItem, "method", false, aRequest.theMethod))
    aRequest.theMethod = "GET";
  else
    aRequest.theMethod = fn::upper_case(aRequest.theMethod);

  getString(aItem, "href", true, aRequest.theHref);

  Item lAuthentication;
  if ((aRequest.theAuthentication.theSendAuthentication = getObject(aItem, "authentication", false, lAuthentication)))
    parseAuthentication(lAuthentication, aRequest.theAuthentication);

  Item lOptions;
  if (getObject(aItem, "options", false, lOptions))
    parseOptions(lOptions, aRequest.theOptions);

  // follow-redirect: take care of the default (if the user didn't provide one)
  if (aRequest.theMethod == "GET" || aRequest.theMethod == "HEAD" || aRequest.theMethod == "OPTIONS")
  {
    if (!aRequest.theOptions.theUserDefinedFollowRedirect)
      aRequest.theOptions.theFollowRedirect = true;
  }
  else
  {
    if (aRequest.theOptions.theFollowRedirect)
    {
      std::ostringstream lMsg;
      lMsg << "cannot follow redirect, request method: " << aRequest.theMethod;
      theThrower->raiseException("FOLLOW", lMsg.str());
    }
  }

  Item lHeaders;
  bool lHaveHeaders = getObject(aItem, "headers", false, lHeaders);
  if (lHaveHeaders)
    parseHeaders(lHeaders, aRequest.theHeaders);

  Item lBody;
  Item lMultipart;
  aRequest.theHaveBody = getObject(aItem, "body", false, lBody);
  aRequest.theHaveMultiPart = getObject(aItem, "multipart", false, lMultipart);
  if (aRequest.theHaveBody && aRequest.theHaveMultiPart)
    theThrower->raiseException("REQUEST","The specified request is not valid. HTTP request cannot contain both body and multipart");

  if (aRequest.theHaveBody)
    parseBody(lBody, aRequest.theBody);

  if (aRequest.theHaveMultiPart)
    parseMultipart(lMultipart, aRequest.theMultiPart);
}
开发者ID:zorba-processor,项目名称:zorba,代码行数:51,代码来源:request_parser.cpp


示例19: main

int main(int argc, char *argv[]) {
  int i, numVars, numSamples, tidx, sigCount;
  double *Z;
  float *P;
  float pt;
  int *binCount;
  FILE *out;
  char type;
  double meanBinCount, stdBinCount;
  int c;
  ARGUMENTS args = parseOptions(argc, argv);
  FILE *fid;

  ReadFile(args.dataFile, &Z, &numVars, &numSamples);

  /* make a float-sized copy */
  P = (float*) calloc(numVars*numSamples, sizeof(float));
  for (i = 0; i < numVars*numSamples; i++) {
    P[i] = (float) zToP(Z[i], POSITIVE);
  }
  
  pt = fdr(P, numVars*numSamples, args.fdr, args.corrType);
  if (pt == -1) {
    printf("Cannot find a threshold for FDR of %f\n", args.fdr);
  } else {
    /* Do the slow search for this probability value to find index; this should be fast enough! */
    tidx = -1;
    sigCount = 0;
    for (i = 0; i < numVars * numSamples; i++) {
      if (P[i] == pt) {
	tidx = i;
	sigCount++;
      } else if (P[i] < pt) {
	sigCount++;
      }
    }
    printf("FDR level %f corresponds to the threshold value of %f; %d values are significant (out of %d)\n", args.fdr, Z[tidx], sigCount, numVars*numSamples);
  }
  if (args.outFile != (char*) NULL) {
    fid = fopen(args.outFile, "w");
    fprintf(fid, "FDR\t%f\n", args.fdr);
    fprintf(fid, "z_threshold\t%f\n", Z[tidx]);
    fprintf(fid, "num_sig_entries\t%d\n", sigCount);
    fprintf(fid, "num_entries\t%d\n", numVars*numSamples);
    fclose(fid);
    free(args.outFile);
  }
  free(P);
  free(Z);  
  free(args.dataFile);
}
开发者ID:remtcs,项目名称:Network-Inference-Workspace,代码行数:51,代码来源:fdrThreshold.c


示例20: writeNode

    virtual WriteResult writeNode(const osg::Node& node,std::ostream& fout,const Options* options=NULL) const
    {
        ObjOptionsStruct localOptions = parseOptions(options);
        fout.precision(localOptions.precision);

        // writing to a stream does not support materials

        OBJWriterNodeVisitor nv(fout);

        // we must cast away constness
        (const_cast<osg::Node*>(&node))->accept(nv);

        return WriteResult(WriteResult::FILE_SAVED);
    }
开发者ID:LaurensVoerman,项目名称:OpenSceneGraph,代码行数:14,代码来源:ReaderWriterOBJ.cpp



注:本文中的parseOptions函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ parsePacket函数代码示例发布时间:2022-05-30
下一篇:
C++ parseObject函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap