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

C++ ParseArgs函数代码示例

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

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



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

示例1: main

int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    struct rx_connection *conn;
    char *srvrName;
    long srvrPort;
    void *cellHandle;
    afs_CMCellName_t cellName;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
	fprintf(stderr, "afsclient_Init, status %d\n", st);
	exit(1);
    }

    rc = afsclient_NullCellOpen(&cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_NullCellsOpen, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CMStatOpenPort(cellHandle, srvrName, srvrPort, &conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CMStatOpenPort, status %d\n", st);
	exit(1);
    }

    rc = util_CMLocalCell(conn, cellName, &st);
    if (!rc) {
	fprintf(stderr, "util_CMLocalCell, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CMStatClose(conn, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CMStatClose, status %d\n", st);
	exit(1);
    }

    rc = afsclient_CellClose(cellHandle, &st);
    if (!rc) {
	fprintf(stderr, "afsclient_CellClose, status %d\n", st);
	exit(1);
    }

    printf("\n");
    printf("Client %s (port %ld) is in cell %s\n", srvrName, srvrPort,
	   cellName);
    printf("\n");

    exit(0);
}
开发者ID:bagdxk,项目名称:openafs,代码行数:56,代码来源:cm_local_cell.c


示例2: ParseArgs

MStatus CheckMeshCmd::doIt(const MArgList& args) {
  MStatus status = ParseArgs(args);
  if (status != MS::kSuccess) {
    std::cerr << "Invalid argument.\n";
    return status;
  }

  auto mode_function = mode_function_map_[mode_.asChar()];
  return (this->*mode_function)();
}
开发者ID:kenny-nelson,项目名称:GomiBako,代码行数:10,代码来源:kisoCheckMeshCmd.cpp


示例3:

static char *xi18n_getIMValues(XIMS ims, XIMArg *args)
{
    Xi18n i18n_core = ims->protocol;
    char *ret;

    if ((ret = ParseArgs(i18n_core, I18N_GET, args)) != NULL)
        return ret;
    /*endif*/
    return NULL;
}
开发者ID:eguopt,项目名称:fcitx,代码行数:10,代码来源:i18nMethod.c


示例4: main

int
main(
    int argc,
    char* argv[]
    )
{
    DWORD dwError = 0;
    handle_t bindingHandle = 0;
    HANDLE hEventLog = 0;
    PSTR pszBindingString = NULL;

    DWORD eventTableCategoryId = (DWORD) -1;

    PSTR pszFilename = NULL;
    
    evt_init_logging_to_file(LOG_LEVEL_VERBOSE, "");

    dwError = ParseArgs(argc, argv, &pszFilename, &eventTableCategoryId);
    BAIL_ON_EVT_ERROR(dwError);

    if (IsNullOrEmptyString(pszFilename)) {
       EVT_LOG_ERROR("No path to the file containing events was specified.");
       ShowUsage();
       BAIL_ON_EVT_ERROR((dwError = EINVAL));
    }

    TRY
    {
	dwError = LWIOpenEventLog(&bindingHandle, &hEventLog, &pszBindingString, "127.0.0.1", "127.0.0.1");
	BAIL_ON_EVT_ERROR(dwError);

        dwError = ParseAndAddEvents(bindingHandle, hEventLog, pszFilename, eventTableCategoryId, AddEventRecord);
        BAIL_ON_EVT_ERROR(dwError);

    }
    CATCH_ALL
    {
        exc_get_status (THIS_CATCH, &dwError);
        EVT_LOG_ERROR("Unexpected error . Error code [%d]\n", dwError);
        BAIL_ON_EVT_ERROR(dwError);
    }
    ENDTRY;


  error:

    if (bindingHandle && hEventLog && pszBindingString)
	LWICloseEventLog(bindingHandle, hEventLog, pszBindingString);
        
    if(dwError != 0) {
	EVT_LOG_ERROR("Failed to import events. Error code [%d]\n", dwError);
    }

    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:55,代码来源:main.c


示例5: Event

EventRecord::EventRecord(long idEvent, long msec, long idCmd, 
			 ArgMMap mmArgs, Template * pTemplate, vector<InputDevPtr> vpDev) :
  Event(idEvent, msec, idCmd, mmArgs, pTemplate) {
  g_pErr->DFI("EventRecord::EventRecord", idEvent, 3);
  //m_pDev = pDev;
  m_vpDev = vpDev;

  ParseArgs(mmArgs);

  g_pErr->DFO("EventRecord::EventRecord", idEvent, 3);
}
开发者ID:dalejbarr,项目名称:exp-eyelink,代码行数:11,代码来源:EventRecord.cpp


示例6: ParseArgs

void qCtx::ParseArgsQmap(qStr *in, qArgAry *out, const char *qmap)
{
    bool quot = false;
    bool more = true;
//	bool trim = true;
//	char quoted = '\x0';
//	int qcnt = 0;
    char c;
//	int acnt = 0;

    if (!qmap) {
        ParseArgs(in, out);
        return;
    }

    char qmode = *qmap == 'A' ? '1' : *qmap == '1' ? '1' : '0';

    if (*qmap != 'A' )
        ++qmap;

    do {
        qStrBuf cur;
        while ( isspace((c = in->GetC())) );

        if (c == T_SQ) {
            quot = true;
            c = in->GetC();
        } else {
            quot = false;
        }

        if (qmode == '1' || quot) {
            more = ParseArgQuoted(in, cur, c);
        } else {
            more = ParseArg(in, cur, c);
        }

        out->Add(cur);
        out->SetQuot(out->Count()-1,quot);

        if (*qmap) {
            if (*qmap == '1') {
                qmode = '1';
                ++qmap;
            } else if (*qmap == '0') {
                qmode = '0';
                ++qmap;
            }
        } else {
            qmode = '0';

        }
    } while (more && c != EOF);
}
开发者ID:earonesty,项目名称:smx,代码行数:54,代码来源:qctx.cpp


示例7: main

int
main(int argc, const char *argv[])
{
  ParseArgs(argc, argv);

  if (cmdsOnly) {
    /* We make this a special case to avoid messing up other code. */
    CreateBootCmds();
    FinishBootCmds();
    SendToDevice(&boot_cmds_packet->data[SIZE_OF_HEADER],SIZE_OF_BOOT_CMDS);
    exit(EXIT_SUCCESS);
  }

  if (netBoot && !toFiles) {
    /* Do not bother with this if we just want to write the packets to
       files. Means you do not have to be root to run --tofiles. */
    net_init();
  }
  else if (serBoot) {
    if (!SetupSerial()) {
      exit(0);
    }
  }

  CreateBootLoader();
  CreateBootCmds();
  FinishBootCmds();

  printf("Starting boot...\n");
  if (doing_flash) {
    printf("We're doing a flash write, this may take up to a few minutes...\n");
  }

  if (toFiles) {
    udword seq = 0;
    struct packet_buf *p;

    while((p = create_packet(seq++))) {
      SendToDevice(p->data, p->size);
    }

    exit(EXIT_SUCCESS);
  }

  if (netBoot) {
    NetBoot();
  }
  else if (serBoot) {
    SerBoot();
  }

  printf("Done.\n");
  return EXIT_SUCCESS;
} /* main  */
开发者ID:wbx-github,项目名称:openadk,代码行数:54,代码来源:common.c


示例8: main

int
main(int argc, char *argv[])
{
    int rc;
    afs_status_t st = 0;
    rxdebugHandle_p handle;
    char *srvrName;
    long srvrPort;
    afs_uint32 supported;

    ParseArgs(argc, argv, &srvrName, &srvrPort);

    rc = afsclient_Init(&st);
    if (!rc) {
        fprintf(stderr, "afsclient_Init, status %d\n", st);
        exit(1);
    }

    rc = afsclient_RXDebugOpenPort(srvrName, srvrPort, &handle, &st);
    if (!rc) {
        fprintf(stderr, "afsclient_RXDebugOpenPort, status %d\n", st);
        exit(1);
    }

    rc = util_RXDebugSupportedStats(handle, &supported, &st);
    if (!rc) {
        fprintf(stderr, "util_RXDebugSupportedStats, status %d\n", st);
        exit(1);
    }

    rc = afsclient_RXDebugClose(handle, &st);
    if (!rc) {
        fprintf(stderr, "afsclient_RXDebugClose, status %d\n", st);
        exit(1);
    }

    printf("\n");
    printf("security stats: %s supported\n",
           (supported & RX_SERVER_DEBUG_SEC_STATS) ? "" : " not");
    printf("all connections:%s supported\n",
           (supported & RX_SERVER_DEBUG_ALL_CONN) ? "" : " not");
    printf("rx stats:       %s supported\n",
           (supported & RX_SERVER_DEBUG_RX_STATS) ? "" : " not");
    printf("waiter count:   %s supported\n",
           (supported & RX_SERVER_DEBUG_WAITER_CNT) ? "" : " not");
    printf("idle threads:   %s supported\n",
           (supported & RX_SERVER_DEBUG_IDLE_THREADS) ? "" : " not");
    printf("all peers:      %s supported\n",
           (supported & RX_SERVER_DEBUG_ALL_PEER) ? "" : " not");
    printf("\n");

    exit(0);
}
开发者ID:kcbehler,项目名称:openafs-osd,代码行数:53,代码来源:rxdebug_supported_stats.c


示例9: main

int main (int ac, char **av, char **envp)
{
  list s;
  char **filename;

  int i_num_isl_files_processed = 0;
  int i_renaming_files = 0;

  if ((ProgramName = iluparser_GetProgramName(av[0])) == NULL)
#if (defined(WIN32) && defined(_WINIO))
    ProgramName = "wcppstub";
#else
    ProgramName = "c++-stubber";
#endif /* (defined(WIN32) && defined(_WINIO)) */

  if (ac < 2)
    {
      PrintUsage();
      return(1);
    }

  if (!ParseArgs (&ac, &av))
    return(1);

  if (NamesFile != NULL)
    {
      if (!ReadSynonyms (NamesFile))
	{
	  fprintf (stderr, "Couldn't read names file %s.\n", NamesFile);
	  return (1);
	};
    };      

  if (StubsFile || HeaderFile || ClientCommonFile)
  	i_renaming_files = 1;

  for (filename = av;  *filename != NULL;  filename += 1)
    {
	  if (i_renaming_files && (i_num_isl_files_processed > 0)) {
      fprintf (stderr, "Can't use -sname -hname or -cname with more than 1 isl file.\n");
      return(1);
	  }
      if ((s = ParseFile (*filename)) == NULL)
	{
	  fprintf (stderr, "Couldn't find or parse %s.\n", *filename);
	  return (1);
	}
      list_enumerate (s, (iluparser_EnumProc) GenerateStubs, NULL);
	  i_num_isl_files_processed++;
    }
  return(0);
}
开发者ID:spchamp,项目名称:ilu,代码行数:52,代码来源:cplusplus.c


示例10: alloptions

void StochasticGD<ParameterType, SampleType, LabelType, SparseGradientType,
                  DenseGradientType>::InitFromCmd(int argc,
                                                  const char *argv[]) {
  boost::program_options::options_description alloptions(
      "Available options for SGD optimizer");
  alloptions.add(this->basedesc_);
  alloptions.add(this->sgdesc_);

  auto vm = ParseArgs(argc, argv, alloptions, true);
  this->learn_.learningrate_ = vm[kLearningRateOption].as<double>();
  this->learn_.learningratedecay_ = vm[kLearningRateDecayOption].as<double>();
  this->learn_.averge_ = vm[kAverageGradientOption].as<bool>();
}
开发者ID:lacozhang,项目名称:numopt,代码行数:13,代码来源:sgd.cpp


示例11: main

int main(int argc, char *argv[])
{
	tArgsError err;
	if((err=ParseArgs(argc,argv))!=kArgsErrorNone) {
		Usage(err);
		return 1;
	}
	if(gPaddedText==kTrue)
		T2E2Padded(gSrcFile,gDstFileRoot);
	else
		T2E2Ragged(gSrcFile,gDstFileRoot);
	return 0;
}
开发者ID:Snial,项目名称:FIGnition,代码行数:13,代码来源:T2E2.c


示例12: main

int main(int argc, char** argv) {
  Params p = ParseArgs(argc, argv);

  if (argc > 1) {
    std::ifstream fin;
    fin.open(argv[1]);
    parse(fin);
  } else {
    parse(std::cin);
  }

  return 0;
}
开发者ID:Astron,项目名称:yaml-cpp,代码行数:13,代码来源:parse.cpp


示例13: main

int main(int argc, char **argv) {
  // Verify that the version of the library that we linked against is
  // compatible with the version of the headers we compiled against.
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  ParseArgs(argc, argv);

  // read configuration file && apply it
  ft::Config::applyConfigFile();


//  // make sure this process is singleton on the entire system
//  if (!singleton(ft::Config::singleton_lock_file().c_str())) {
//    fprintf(stderr, "%s is already state right now!\n", argv[0]);
//    ::abort();
//  }

  // make this process to be a daemon process
  if (ft::Config::isDaemon()) {
    if (0 != daemon(0, 0)) {
      fprintf(stderr, "failed to call daemon(): %s\n", strerror(errno));
      ::abort();
    }
  }

  // init the action of logging
  ft::Config::initlog();

  MainWork::instance()->init();
//  {
//    ft::mysql::ConnectionGuard guard(ft::mysql::ConnectionPool::instance());
//    std::shared_ptr<ft::mysql::Connection>& conn = guard.connection();
//    const char* sql = "SELECT name, age, score FROM student ORDER BY score";
//    std::string error;
//    sql::ResultSet* rs = conn->executeQuery(sql, error);
//    if (nullptr == rs) {
//      LogError << "Failed to execute sql: \"" << sql << "\", error: " << error;
//    }
//    LogInfo << "name\tage\tscore";
//    while (rs->next()) {
//      LogInfo << rs->getString("name") << "\t" << rs->getInt("age") << "\t" << rs->getInt("score");
//    }
//  }

  MainWork::instance()->start();

  // Optional:  Delete all global objects allocated by libprotobuf.
  google::protobuf::ShutdownProtobufLibrary();

  return 0;
}
开发者ID:ituncle,项目名称:MyServer,代码行数:51,代码来源:Main.cpp


示例14: IndirectObjectImpl

ShadingImpl::ShadingImpl(DocWriterImpl& doc,
                         Char const* pattern,
                         ColorSpaceHandle cs,
                         FunctionHandle const* fns,
                         UInt num_functions)
    : IndirectObjectImpl(doc)
    , m_cs(cs)
{
    // Indexed is not allowed for dictionaries with Function field. Shading
    // types supported now require Function field so indexed color space is
    // forbidden.
    if (is_pattern_color_space(cs) || (CS_INDEXED == color_space_type(cs)))
        throw exception_invalid_value(msg_shading_invalid_space()) << JAGLOC;

    m_function_handles.resize(num_functions);
    std::copy(fns, fns + num_functions, m_function_handles.begin());

    try
    {
        ParsedResult const& p =
            parse_options(pattern, ParseArgs(&g_shading_keywords, &g_shading_values));

        // common options matrix
        parse_array(p, SH_BBOX, m_bbox, true, 4);
        parse_array(p, SH_BACKGROUND, m_background);

        // shading type specific
        m_shading_type = p.explicit_value();
        switch(m_shading_type)
        {
        case SHV_AXIAL:
        case SHV_RADIAL:
            parse_array(p, SH_COORDS, m_coords, false, m_shading_type==SHV_AXIAL ? 4 : 6);
            parse_array(p, SH_DOMAIN, m_domain, true, 2);
            if (parse_array(p, SH_EXTEND, m_extend, true, 2)) m_keys.set(BIT_EXTEND);
            break;

        case SHV_FUNCTION:
            parse_array(p, SH_MATRIX_FUN, m_matrix_fun, true, 6);
            parse_array(p, SH_DOMAIN, m_domain, true, 4);
            break;

        default:
            throw exception_invalid_value(msg_unknown_shading_type()) << JAGLOC;
        }
    }
    catch(exception const& exc)
    {
        throw exception_invalid_value(msg_invalid_shading_spec(), &exc) << JAGLOC;
    }
}
开发者ID:Rogaven,项目名称:jagpdf,代码行数:51,代码来源:patternimpl.cpp


示例15: main

int main (int argc, char * argv[])
{
  Measure height = Measure (&METER);
  Measure time = Measure (&SECOND);

  ParseArgs (argc, argv, &time);

  height = G * 0.5 * time.power (2);  // d = 1/2 a t^2
  cout << "At " << G.GetQuantity();
  cout << " meters per second per second," << endl << "an object will fall ";
  cout << height.GetQuantity() << " meters in ";
  cout << time.GetQuantity() << " seconds." << endl;
  exit (0);
}
开发者ID:davearonson,项目名称:meascpp,代码行数:14,代码来源:falldist.cpp


示例16: main

void main( int argc, char **argv )
{
    long        savings;
    foff        buffsize;
    algorithm   alg;

    if( !MsgInit() )
        exit( EXIT_FAILURE );
    alg = ParseArgs( argc, argv );

    EndOld = FileSize( argv[1], &OldCorrection );
    EndNew = FileSize( argv[2], &NewCorrection );

    buffsize = ( EndOld > EndNew ) ? ( EndOld ) : ( EndNew );
    buffsize += sizeof( PATCH_LEVEL );
    OldFile = ReadIn( argv[1], buffsize, EndOld );
    NewFile = ReadIn( argv[2], buffsize, EndNew );

    ScanSyncString( SyncString );

    switch( alg ) {
    case ALG_NOTHING:
        FindRegions();
        break;
#ifdef USE_DBGINFO
    case ALG_ONLY_NEW:
    case ALG_BOTH:
        SymbolicDiff( alg, argv[1], argv[2] );
        break;
#endif
    }

    if( NumHoles == 0 && DiffSize == 0 && EndOld == EndNew ) {
        printf( "Patch file not created - files are identical\n" );
        MsgFini();
        exit( EXIT_SUCCESS );
    }
    MakeHoleArray();
    SortHoleArray();
    ProcessHoleArray( 0 );
    savings = HolesToDiffs();
    WritePatchFile( argv[3], newName );
    FreeHoleArray();
    VerifyCorrect( argv[2] );

    print_stats( savings );

    MsgFini();
    exit( EXIT_SUCCESS );
}
开发者ID:Graham-stott,项目名称:open-watcom-v2,代码行数:50,代码来源:bdiff.c


示例17: main

int main(int argc, char* argv[])
{
    ClassFileAnalyzer analyzer;

    ParseArgs(argc, argv, analyzer);

    for (int i = 0; i < argc; ++i)
    {
        analyzer.analyzeClassFile(argv[i]);
        analyzer.WriteOutput();
    }

    exit(0);
}
开发者ID:truedata-jim,项目名称:jdep,代码行数:14,代码来源:jdep.cpp


示例18: main

int
main(int argc, char** argv)
{
  // default arguments
  autopilot_parms.SetIdeal();

  if (!ParseArgs(argc, argv))
    return 0;

  unsigned i = rand() % (NUM_WIND - 1) + 1;
  plan_tests(1);

  test_bestcruisetrack(1, i);
  return exit_status();
}
开发者ID:XCame,项目名称:XCSoar,代码行数:15,代码来源:test_bestcruisetrack.cpp


示例19: Execute

    /** Executes a command
     * 
     * @param args
     * 
     * @return bool true on success; false on failure
     */
    bool Execute()
    {
        if (!ParseArgs()) {
            return false;
        }

        if (verbose_) {
            printf("%s: Starting: numRxBytes=%u, numTxBytes=%u\n",
                   args_[0], clientInfo_.numRxBytes, clientInfo_.numTxBytes);
        }

        cmdMgr_.Run(this);

        return true;
    } // Execute()
开发者ID:ctbrowser,项目名称:libpalmsocket,代码行数:21,代码来源:TestCmdShutSSL.cpp


示例20: KMain

rc_t CC KMain(int argc, char *argv[]) {


    if ( ! ParseArgs ( argc, argv ) ) {
        RightUsage();
        return 1;
    }

    if ( signal ( SIGINT, XTaskerSigIntHandler ) == SIG_ERR ) {
        printf ( "Can not instal signal handlers\n" );
        return RC ( rcExe, rcFile, rcReading, rcParam, rcInvalid );
    }

    return run ( NumThr, RunTime, FilePath, PathIsList );
}
开发者ID:Jingyu9,项目名称:sra-tools,代码行数:15,代码来源:remote-fuser-test.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ParseCommandLine函数代码示例发布时间:2022-05-30
下一篇:
C++ Parse函数代码示例发布时间: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