当前位置: 首页>>代码示例>>C++>>正文


C++ ProgramOptions类代码示例

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


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

示例1: addFileToList

void Parser::addFileToList ( const std::string &addfile, ProgramOptions &options, Map &fileList ) {
    fs::path pathToFile = fs::system_complete ( addfile );
    std::string filename = pathToFile.filename().string();
    uintmax_t fileSize = fs::file_size ( pathToFile );
    std::string filePath = pathToFile.string();
    File *file = new File ( fs::file_size ( pathToFile ), filePath, filename );

    if ( fileList.count ( filename ) ) {	//check if filename is a valid key
        innerMap &filemap = fileList[ filename ];
        if ( filemap.count ( fileSize ) ) {	//check if file_size is a valid key
            filemap[ fileSize ].push_back ( file );
        } else {	//create new vector for the Files and insert it with the file_size as the key
            boost::ptr_vector<File> *newFileList = new boost::ptr_vector<File>;
            newFileList->push_back ( file );
            filemap.insert ( innerMap::value_type ( fileSize, *newFileList ) );
        }
    } else {
        boost::ptr_vector<File> *newFileList = new boost::ptr_vector<File>;
        newFileList->push_back ( file );
        innerMap *newInnerMap = new innerMap;
        newInnerMap->insert ( innerMap::value_type ( fileSize, *newFileList ) );
        fileList.insert ( Map::value_type ( filename, *newInnerMap ) );
    }

    if ( options.getVerbose() || options.getPrintToConsoleOnly() )
        std::cout << "Added file " << filename << " (Size: " << fileSize /1024/1024 << "mb) from Directory: " << filePath << std::endl;
}
开发者ID:canella,项目名称:doubletap,代码行数:27,代码来源:parser.cpp

示例2: CaledoniaDriver

void CaledoniaDriver(ProgramOptions& options, int& argc, char* argv[])
{
   //  Get basic MPI information
   MPI_Struct world;
   world = MPI_Struct::world();
#  ifdef USE_MPI
   MPI_Comm_rank(world.comm,&world.iproc);
   MPI_Comm_size(world.comm,&world.nproc);
#  endif
 
   bool verbose = options.get_value<bool>("verbose") && (world.iproc==0);
   if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Construction objects" << std::endl;

   // Construct a hamiltonian object 
   HAMILTON hamilton;
   hamilton.add_options(options);

   // Construct the sampling object
   SIMULATION simulation;
   simulation.add_options(options);

   typedef WALKER<typename HAMILTON::Config,typename HAMILTON::Observables> Walker;
   std::vector<Walker> walkerpool(1);

   // The measurement object
   // EMX_Measure measure_obj;
   MEASURE measure_obj;

   // Get parameters
   if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Parsing parameters" << std::endl;
   options.parse_command_line(argc,argv);
   if( options.get_value<bool>("help") ) return;

   // seed the random number geneator
   if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Creating random number generator" << std::endl;
   simulation.urng.seed( ParallelSeed(SeedFromClock()) );
   bool rng_output = false;
   bool rng_failed = RNGTestMoments(simulation.urng,rng_output,std::cout);
   if( false && rng_failed )
      std::cout << __FILE__ << ":" << __LINE__ << "Problem detected with random number generator (returns 1?)" << std::endl;

   // Initialize objects based on ProgramOptions
   if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Call Init routines" << std::endl;
   hamilton.init(verbose);
   hamilton.initial(walkerpool[0].sigma);
   simulation.init(hamilton,walkerpool,verbose);
   measure_obj.init(simulation);

   // Construct a representation of the model
   // This includes the "microscopic" configuration sigma_i
   // and the macroscopic quantities like magnetization and energy
   if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Beginning simulation" << std::endl;
   simulation.DoCalculate(hamilton,walkerpool,measure_obj);

   if(verbose) std::cout << __FILE__ << ":" << __LINE__ << " Saving options" << std::endl;
   options.write();
}
开发者ID:browngrg,项目名称:caledonia,代码行数:57,代码来源:caledonia.cpp

示例3: create

bool CLProgram::create(const std::string& path, const ProgramOptions& compilerOptions, const std::vector<CLDevice>& devices /*= std::vector<CLDevice>()*/)
{
	std::ifstream file(path);
	if(file.fail())
	{
		std::cout << "Could not open file " << path << std::endl;
		return false;
	}
	std::vector<std::string> lines;
	while(!file.fail())
	{
		std::string line;
		std::getline(file, line);
		lines.push_back(line + "\n");
	}
	std::vector<const char*> linesChar;
	for(size_t idx = 0; idx < lines.size(); ++idx)
	{
		linesChar.push_back(lines[idx].c_str());
	}
	
	_program = ::clCreateProgramWithSource(OpenCL::get_context(), linesChar.size(), &linesChar[0], NULL, &_lastError);
	if(_lastError != CL_SUCCESS)
	{
		std::cout << "::clCreateProgramWithSource error." << std::endl;
	}
	if(_program == NULL)
		return false;

	_context = OpenCL::get_context();

	std::vector<cl_device_id> deviceIDs;
	std::for_each(devices.begin(), devices.end(), [&deviceIDs](const CLDevice& device) {
		deviceIDs.push_back(device.device);
	});

	if(deviceIDs.empty())
		_lastError = ::clBuildProgram(_program, 0, NULL, compilerOptions.c_str(), NULL, NULL);
	else
		_lastError = ::clBuildProgram(_program, deviceIDs.size(), &deviceIDs[0], compilerOptions.c_str(), NULL, NULL);

	if(_lastError != CL_SUCCESS)
	{
		std::cout << "::clBuildProgram error." << std::endl;
	}

	return _lastError == CL_SUCCESS;
}
开发者ID:billw2012,项目名称:BGalaxy1,代码行数:48,代码来源:OpenCLWrappers.cpp

示例4: initSize

PopulationParams::PopulationParams(nat id, nat numberOfGenerations, popSize_t initSize, const ProgramOptions &progOpt)
    : initSize(initSize)
    , correction(1)
      // , correction(progOpt.get<nat>("ploidy") - 1 )
    , isNeutral(false)
{
    vector<string> stringEvents;
    if(progOpt.hasOption("popEvent"))
        stringEvents = progOpt.get<vector<string> >("popEvent");

    // parse rates
    recombinationRate = parseRate(progOpt.get<vector<string> >("recRate"),id);
    // geneConversionRate = parseRate(progOpt.get<vector<string> >("mutRate"), id);
    mutationRate = parseRate(progOpt.get<vector<string> >("mutRate"), id);

    if(NOT stringEvents.empty())
    {
        parseEvents(stringEvents,id);
        nat lastPopSize = initSize;

        // for(auto event : events)
        for(auto eventI = events.begin(); eventI  !=  events.end(); ++eventI)
        {
            (*eventI)->init(lastPopSize);

            if(eventI+1 != events.end())
            {
                nat whenIsNext = (*(eventI+1))->getWhen();
                lastPopSize = (*eventI)->getByTime(whenIsNext-1);
            }
        }
    }
}
开发者ID:aberer,项目名称:AnA-FiTS,代码行数:33,代码来源:PopulationParams.cpp

示例5: fFun

Simulation::Simulation(InfoFile &info, ProgramOptions &theProgOpt, ThreadPool &_tp)
  : progOpt(theProgOpt) 
  , numGen(progOpt.getNumberOfGenerations())
  , tp(_tp)
{

  // create chromosomes 
  Randomness &rng = tp[0].getRNG();
  vector<seqLen_t> lengths = progOpt.get<vector<seqLen_t> >("length");  
  nat idC = 0; 

  nat numPop = 1; 		// TODO pops 
  
  for(auto& length : lengths)
    {
      FitnessFunction fFun(progOpt.get<vector<string>>("selCoef"));
      Chromosome* chromo = new Chromosome(length, theProgOpt.hasOption("neutral"), fFun, idC++, numPop);
      chromo->init(rng);
      chromosomes.push_back(chromo); 
    }

  // create parameters of populations 
  vector<nat> popSizes = progOpt.get<vector<nat> >("popSize"); 
  assert(popSizes.size() == 1 );
  popParams.push_back( PopulationParams(0, numGen, popSizes[0], progOpt));  

  fractionalSimulation = new FractionalSimulation(tp,info,  progOpt, numGen, chromosomes, popParams); 
}
开发者ID:aberer,项目名称:AnA-FiTS,代码行数:28,代码来源:Simulation.cpp

示例6: mutNodes

Graph::Graph(nat initSize, const ProgramOptions &progOpt)
    : mutNodes(1000)
    , recNodes(1000)
    , nodMan(1000,
             progOpt.hasOption("refForCoal") ?
             progOpt.get<nat>("refForCoal") - 1
             : 0 ,
             NOT progOpt.hasOption("refForCoal"))
    , buffer(100)
#ifndef NDEBUG
    , survivorsContainStartingNode(true)
#endif
{
    previousState.resize(initSize);
    fill(previousState.begin(), previousState.end(), nullptr);
}
开发者ID:aberer,项目名称:AnA-FiTS,代码行数:16,代码来源:Graph.cpp

示例7: parseOptions

bool parseOptions(int ac, char** av, ProgramOptions& options) {
    po::positional_options_description positional_options;
    po::options_description desc;

    positional_options.add("compress", 1);

    desc.add_options()
            ("help,h", "this help message")
            ("output,o", po::value<std::string>(),
                    "for compression: output file (default is 'output.arch'), for extraction: output directory (current directory by default).")
            ("extract,x", po::value<std::string>(), "extract archive")
            ("compress", po::value<std::string>(), "compress file or folder");

    std::stringstream ss;
    ss << desc;
    options.setHelpString(ss.str());

    po::variables_map vm;

    try {
        po::store(
                po::command_line_parser(ac, av).options(desc).positional(
                        positional_options).run(), vm);
        po::notify(vm);

        return setOptions(vm, options);
    } catch (std::exception & ex) {
        std::cerr << ex.what() << std::endl;
        return false;
    }

}
开发者ID:milohoffman,项目名称:simple_tar,代码行数:32,代码来源:options.cpp

示例8: TEST

TEST(ProgramOptions, Reset)
{
  ProgramOptions po;
  ProgramOptions::Option& help = po.add("help");
  ProgramOptions::Option& file = po.add("file").requiresValue("FILE");
  EXPECT_FALSE(help.enabled());
  EXPECT_FALSE(file.enabled());
  EXPECT_EQ("", file.value());

  const char* argv[] = { "program.exe", "--help", "--file=readme.txt" };
  po.parse(3, argv);
  EXPECT_TRUE(help.enabled());
  EXPECT_TRUE(file.enabled());
  EXPECT_EQ("readme.txt", file.value());

  po.reset();
  EXPECT_FALSE(help.enabled());
  EXPECT_FALSE(file.enabled());
  EXPECT_EQ("", file.value());
}
开发者ID:CalinLeafshade,项目名称:aseprite,代码行数:20,代码来源:program_options_tests.cpp

示例9: addPort

bool ApplicationHttpServer::parsePhase2 (ProgramOptions& options) {
  if (options.has("server.require-keep-alive")) {
    _requireKeepAlive= true;
  }

  for (vector<string>::const_iterator i = _httpPorts.begin();  i != _httpPorts.end();  ++i) {
    addPort(*i);
  }

  return true;
}
开发者ID:mokerjoke,项目名称:ArangoDB,代码行数:11,代码来源:ApplicationHttpServer.cpp

示例10: parseFile

void Parser::parseFile ( ProgramOptions &options, boost::ptr_vector<File> &fileList ) {
    std::string output = options.getFileName();
    std::ifstream stream ( output, std::ios::in );

    std::string line, path, name;
    std::uintmax_t file_size;
    if ( stream.is_open() ) {
        while ( stream.good() ) {
            std::getline ( stream, line );
            std::stringstream lineStream ( line );
            lineStream >> file_size >> path >> name;
            File *newFile = new File ( file_size, path, name );
            fileList.push_back ( newFile );
        }
    } else
开发者ID:canella,项目名称:doubletap,代码行数:15,代码来源:parser.cpp

示例11: ParseCommandLine

/// \retval false App should not be started
/// \retval true App can be started
bool App::ParseCommandLine()
{
   ProgramOptions options;

   options.RegisterOutputHandler(&ProgramOptions::OutputConsole);
   options.RegisterHelpOption();

   bool bStartApp = true;

   options.RegisterOption(_T("r"), _T("register-wia"), _T("registers WIA handler for RemotePhotoTool"),
      0, [&](const std::vector<CString>&)
   {
      RegisterWIAHandler(true); bStartApp = false; return true;
   });

   options.RegisterOption(_T("u"), _T("unregister-wia"), _T("unregisters WIA handler for RemotePhotoTool"),
      0, [&](const std::vector<CString>&)
   {
      RegisterWIAHandler(false); bStartApp = false; return true;
   });

   options.RegisterOption(_T("o"), _T("open-wia"), _T("opens camera using WIA handler; <arg1>: Port, <arg2>: Guid"),
      2, [&](const std::vector<CString>& vecArgs)
   {
      vecArgs;
      ATLASSERT(vecArgs.size() == 2);
      // just let the app start here
      return true;
   });

   options.Parse(GetCommandLine());

   if (!bStartApp || options.IsSelectedHelpOption())
      return false;

   return true;
}
开发者ID:vividos,项目名称:RemotePhotoTool,代码行数:39,代码来源:App.cpp

示例12: parseRecursive

bool Parser::parseRecursive ( const std::string directory, ProgramOptions &options, Map &fileList ) {

    fs::path path ( fs::initial_path() );
    path = fs::system_complete ( fs::path ( directory ) ); //returns reference to the file

    if ( !fs::exists ( path ) ) {
        std::cerr << "Could not find: " << path << std::endl;
        return false;
    }

    for ( fs::recursive_directory_iterator end, dir ( options.getStartDirectory() ); dir != end; ++dir ) {
        try {
            if ( fs::is_regular_file ( dir->path().string() ) )
                addFileToList ( dir->path().string(), options, fileList );
            else
                continue;
        } catch ( std::exception const& ex ) {
            std::cerr << dir->path() << " " << ex.what() << std::endl;
        }
    }
    return true;
}
开发者ID:canella,项目名称:doubletap,代码行数:22,代码来源:parser.cpp

示例13: addPort

bool ApplicationHttpsServer::parsePhase2 (ProgramOptions& options) {

  // check keep alive
  if (options.has("server.secure-require-keep-alive")) {
    _requireKeepAlive= true;
  }


  // add ports
  for (vector<string>::const_iterator i = _httpsPorts.begin();  i != _httpsPorts.end();  ++i) {
    addPort(*i);
  }


  // create the ssl context (if possible)
  bool ok = createSslContext();

  if (! ok) {
    return false;
  }

  // and return
  return true;
}
开发者ID:mokerjoke,项目名称:ArangoDB,代码行数:24,代码来源:ApplicationHttpsServer.cpp

示例14: glGenFramebuffers

	//--------------------------------------------------------------------------
	GBuffer::GBuffer(				unsigned int _width, 
									unsigned int _height)
	{
		// Initialize G-Buffer textures
		positionTex.Allocate(GL_RGBA32F,_width,_height);
		normalTex.Allocate(GL_RGBA16F,_width,_height);
		diffuseTex.Allocate(GL_RGBA16F,_width,_height);
		depthTex.Allocate(GL_DEPTH32F_STENCIL8,_width,_height);
		positionTex.SetWrapping(GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE);
		normalTex.SetWrapping(GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE);
		diffuseTex.SetWrapping(GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE);
		depthTex.SetWrapping(GL_CLAMP_TO_EDGE,GL_CLAMP_TO_EDGE);

		// Initialize framebuffer
		int outPosition			= 0;
		int outDiffuseSpecular	= 1;
		int outNormalRoughness	= 2;
		glGenFramebuffers(1, &framebuffer);
		glBindFramebuffer(GL_FRAMEBUFFER,framebuffer);

		// Attach output textures
		glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0 + outPosition, positionTex.target, positionTex.id, 0);
		glf::CheckFramebuffer(framebuffer);

		glBindTexture(diffuseTex.target,diffuseTex.id);
		glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0 + outDiffuseSpecular, diffuseTex.target, diffuseTex.id, 0);
		glf::CheckFramebuffer(framebuffer);
		
		glBindTexture(normalTex.target,normalTex.id);
		glFramebufferTexture2D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0 + outNormalRoughness, normalTex.target, normalTex.id, 0);
		glf::CheckFramebuffer(framebuffer);

		glBindTexture(depthTex.target,depthTex.id);
		glFramebufferTexture2D(GL_FRAMEBUFFER,GL_DEPTH_STENCIL_ATTACHMENT, depthTex.target, depthTex.id, 0);
		glf::CheckFramebuffer(framebuffer);

		GLenum drawBuffers[3] = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2};
		glDrawBuffers(3,drawBuffers);
		assert(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
		glBindFramebuffer(GL_FRAMEBUFFER, 0);


		// Program regular mesh
		ProgramOptions regularOptions = ProgramOptions::CreateVSOptions();
		regularOptions.AddDefine<int>("GBUFFER",				1);
		regularOptions.AddDefine<int>("OUT_POSITION",			outPosition);
		regularOptions.AddDefine<int>("OUT_DIFFUSE_SPECULAR",	outDiffuseSpecular);
		regularOptions.AddDefine<int>("OUT_NORMAL_ROUGHNESS",	outNormalRoughness);
		regularRenderer.program.Compile(regularOptions.Append(LoadFile(directory::ShaderDirectory + "meshregular.vs")),
										regularOptions.Append(LoadFile(directory::ShaderDirectory + "meshregular.fs")));

		regularRenderer.transformVar	= regularRenderer.program["Transform"].location;
		regularRenderer.modelVar		= regularRenderer.program["Model"].location;
		regularRenderer.diffuseTexUnit	= regularRenderer.program["DiffuseTex"].unit;
		regularRenderer.normalTexUnit	= regularRenderer.program["NormalTex"].unit;
		regularRenderer.roughnessVar	= regularRenderer.program["Roughness"].location;
		regularRenderer.specularityVar	= regularRenderer.program["Specularity"].location;

		glProgramUniform1i(regularRenderer.program.id, regularRenderer.program["DiffuseTex"].location, regularRenderer.diffuseTexUnit);
		glProgramUniform1i(regularRenderer.program.id, regularRenderer.program["NormalTex"].location,  regularRenderer.normalTexUnit);


		// Program terrain mesh
		ProgramOptions terrainOptions = ProgramOptions::CreateVSOptions();
		terrainOptions.AddDefine<int>("GBUFFER",				1);
		terrainOptions.AddDefine<int>("OUT_POSITION",			outPosition);
		terrainOptions.AddDefine<int>("OUT_DIFFUSE_SPECULAR",	outDiffuseSpecular);
		terrainOptions.AddDefine<int>("OUT_NORMAL_ROUGHNESS",	outNormalRoughness);
		terrainRenderer.program.Compile(terrainOptions.Append(LoadFile(directory::ShaderDirectory + "meshterrain.vs")),
										terrainOptions.Append(LoadFile(directory::ShaderDirectory + "meshterrain.cs")),
										terrainOptions.Append(LoadFile(directory::ShaderDirectory + "meshterrain.es")),
										terrainOptions.Append(LoadFile(directory::ShaderDirectory + "meshterrain.fs")));

		terrainRenderer.transformVar	= terrainRenderer.program["Transform"].location;
		terrainRenderer.diffuseTexUnit	= terrainRenderer.program["DiffuseTex"].unit;
		terrainRenderer.normalTexUnit	= terrainRenderer.program["NormalTex"].unit;
		terrainRenderer.heightTexUnit	= terrainRenderer.program["HeightTex"].unit;
		terrainRenderer.roughnessVar	= terrainRenderer.program["Roughness"].location;
		terrainRenderer.specularityVar	= terrainRenderer.program["Specularity"].location;

		terrainRenderer.tileSizeVar		= terrainRenderer.program["TileSize"].location;
		terrainRenderer.tileCountVar	= terrainRenderer.program["TileCount"].location;
		terrainRenderer.tileOffsetVar	= terrainRenderer.program["TileOffset"].location;
		terrainRenderer.projFactorVar	= terrainRenderer.program["ProjFactor"].location;
		terrainRenderer.tessFactorVar	= terrainRenderer.program["TessFactor"].location;
		terrainRenderer.heightFactorVar	= terrainRenderer.program["HeightFactor"].location;
		terrainRenderer.tileFactorVar	= terrainRenderer.program["TileFactor"].location;

		glProgramUniform1i(terrainRenderer.program.id, terrainRenderer.program["DiffuseTex"].location, terrainRenderer.diffuseTexUnit);
		glProgramUniform1i(terrainRenderer.program.id, terrainRenderer.program["NormalTex"].location,  terrainRenderer.normalTexUnit);
		glProgramUniform1i(terrainRenderer.program.id, terrainRenderer.program["HeightTex"].location,  terrainRenderer.heightTexUnit);

		glf::CheckError("GBuffer::GBuffer");
	}
开发者ID:ArturSoczek,项目名称:OpenGLInsightsCode,代码行数:95,代码来源:gbuffer.cpp

示例15: main

int main(int argc, const char* argv[])
{
    ProgramOptions  opts;
    if( opts.parse(argc, argv) ) {
        return 1;
    }

    {
        Debug_DisablePhase("Load Repository");
        Debug_DisablePhase("Load Root");
        Debug_DisablePhase("Load Dependencies");
        Debug_DisablePhase("Enumerate Build");
        Debug_DisablePhase("Run Build");

        if( const char* e = getenv("MINICARGO_DEBUG") )
        {
            while( *e )
            {
                const char* colon = ::std::strchr(e, ':');
                size_t len = colon ? colon - e : ::std::strlen(e);

                Debug_EnablePhase(::std::string(e, len).c_str());

                if( colon )
                    e = colon + 1;
                else
                    e = e + len;
            }
        }
    }

    try
    {
        Debug_SetPhase("Load Repository");
        // Load package database
        Repository repo;
        // TODO: load repository from a local cache
        if( opts.vendor_dir )
        {
            repo.load_vendored(opts.vendor_dir);
        }

        auto bs_override_dir = opts.override_directory ? ::helpers::path(opts.override_directory) : ::helpers::path();

        // 1. Load the Cargo.toml file from the passed directory
        Debug_SetPhase("Load Root");
        auto dir = ::helpers::path(opts.directory ? opts.directory : ".");
        auto m = PackageManifest::load_from_toml( dir / "Cargo.toml" );

        // 2. Load all dependencies
        Debug_SetPhase("Load Dependencies");
        m.load_dependencies(repo, !bs_override_dir.is_valid());

        // 3. Build dependency tree and build program.
        BuildOptions    build_opts;
        build_opts.build_script_overrides = ::std::move(bs_override_dir);
        build_opts.output_dir = opts.output_directory ? ::helpers::path(opts.output_directory) : ::helpers::path("output");
        build_opts.lib_search_dirs.reserve(opts.lib_search_dirs.size());
        build_opts.emit_mmir = opts.emit_mmir;
        build_opts.target_name = opts.target;
        for(const auto* d : opts.lib_search_dirs)
            build_opts.lib_search_dirs.push_back( ::helpers::path(d) );
        Debug_SetPhase("Enumerate Build");
        auto build_list = BuildList(m, build_opts);
        Debug_SetPhase("Run Build");
        if( !build_list.build(::std::move(build_opts), opts.build_jobs) )
        {
            ::std::cerr << "BUILD FAILED" << ::std::endl;
            if(opts.pause_before_quit) {
                ::std::cout << "Press enter to exit..." << ::std::endl;
                ::std::cin.get();
            }
            return 1;
        }
    }
    catch(const ::std::exception& e)
    {
        ::std::cerr << "EXCEPTION: " << e.what() << ::std::endl;
        if(opts.pause_before_quit) {
            ::std::cout << "Press enter to exit..." << ::std::endl;
            ::std::cin.get();
        }
        return 1;
    }

    if(opts.pause_before_quit) {
        ::std::cout << "Press enter to exit..." << ::std::endl;
        ::std::cin.get();
    }
    return 0;
}
开发者ID:thepowersgang,项目名称:mrustc,代码行数:91,代码来源:main.cpp


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