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


C++ DOMDocument::LoadFile方法代码示例

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


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

示例1: main

int main(int argc, char** argv)
{
  
  /*
   * Process command line arguments
   */
  const std::string compclass="[CompClass]";
  const std::string compclasslower="[compclass]";

  std::string description = "usage: flowvr [options] "+ compclasslower;

  flowvr::utils::CmdLine cmdline(description.c_str());

  std::string  prefixFile = compclasslower;

  // Parse commande line
  // Exit if error or --help option
  bool error = false;
  if ( !cmdline.parse(argc, argv, &error ) )
  {
    std::cout << cmdline.help() << std::endl;
    if(error)
      return 1;
    return 0;
  }


  /*
   * Retrieving application name
   */
  std::string compname;

  if  ( cmdline.args.size() !=  1 || cmdline.args[0].empty() )
  {
      std::cerr << "One and only one Component Class Name needed as input argument" << std::endl;
      return 1;
  }
  // component name  (also the component class name)
  compname = cmdline.args[0];
  
  

  // We actually always use the lower case version of the component name. 
  // So we are case insensitive regarding the component name 
  // The dynamic component loader (@class GenClass) also register the component name using its lower case name.
  std::string compnamelower = compname;
  std::transform(compnamelower.begin(), compnamelower.end(),compnamelower.begin(),::tolower);

  // Restore option values to default value if not overwritten
  if (prefixFile == compclasslower)
      prefixFile=compnamelower;



  
  /*
   * Loading .run.xml and .cmd.xml files
   */
  // Loading the .run.xml produced by py-app
  std::string runFile = compnamelower+".run.xml";
  DOMDocument* fRun = new  DOMDocument(runFile);

  // Process the run.xml
  if(!fRun->LoadFile())
  {
    std::cerr << prefixFile.c_str() << ".run.xml cannot be loaded." << std::endl;
    return 1;
  }

  std::string cmdFile = compnamelower+".cmd.xml";
  DOMDocument* fCmd = new DOMDocument(cmdFile);

  // Process cmd.xml file
  if(!fCmd->LoadFile())
  {
    std::cerr << prefixFile.c_str() << ".cmd.xml cannot be loaded." << std::endl;
    return 1;
  }



  /*
   * Launching the application
   */
  BasicController appController;
  if (!appController.init(prefixFile))
  {
    std::cerr << "Cannot launch the application" << std::endl
      << "\tMake sure a flowvr daemon is running" << std::endl 
      << "\tLaunching aborted" << std::endl;
    delete fCmd;
    delete fRun;
    return 1;
  }

  std::string parent = appController.getParent();

  std::cout << "controller namespace: " << parent.c_str() << std::endl;
  if (setenv("FLOWVR_PARENT", parent.c_str(), 1))
  {
//.........这里部分代码省略.........
开发者ID:BlueBrain,项目名称:FlowVR,代码行数:101,代码来源:flowvr.cpp


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