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


C++ XMLFile::IsScriptFile方法代码示例

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


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

示例1: options


//.........这里部分代码省略.........
      }
    } else if (keyword == "--script") {
      if (n != string::npos) {
        ScriptName = value;
      } else {
        gripe;
        exit(1);
      }
    } else if (keyword == "--initfile") {
      if (n != string::npos) {
        ResetName = value;
      } else {
        gripe;
        exit(1);
      }

    } else if (keyword == "--property") {
      if (n != string::npos) {
         string propName = value.substr(0,value.find("="));
         string propValueString = value.substr(value.find("=")+1);
         double propValue = atof(propValueString.c_str());
         CommandLineProperties.push_back(propName);
         CommandLinePropertyValues.push_back(propValue);
      } else {
        gripe;
        exit(1);
      }

    } else if (keyword == "--end-time") {
      if (n != string::npos) {
        try {
        end_time = atof( value.c_str() );
        } catch (...) {
          cerr << endl << "  Invalid end time given!" << endl << endl;
          result = false;
        }
      } else {
        gripe;
        exit(1);
      }

    } else if (keyword == "--simulation-rate") {
      if (n != string::npos) {
        try {
          simulation_rate = atof( value.c_str() );
          override_sim_rate = true;
        } catch (...) {
          cerr << endl << "  Invalid simulation rate given!" << endl << endl;
          result = false;
        }
      } else {
        gripe;
        exit(1);
      }

    } else if (keyword == "--catalog") {
        catalog = true;
        if (value.size() > 0) AircraftName=value;
    } else if (keyword.substr(0,2) != "--" && value.empty() ) {
      // See what kind of files we are specifying on the command line

      XMLFile xmlFile;
      
      if (xmlFile.IsScriptFile(keyword)) ScriptName = keyword;
      else if (xmlFile.IsLogDirectiveFile(keyword))  LogDirectiveName.push_back(keyword);
      //else if (xmlFile.IsAircraftFile(keyword)) AircraftName = keyword;
      //else if (xmlFile.IsInitFile(keyword)) ResetName = keyword;
      else {
        cerr << "The argument \"" << keyword << "\" cannot be interpreted as a file name or option." << endl;
        exit(1);
      }

    }
    else //Unknown keyword so print the help file, the bad keyword and abort
    {
          PrintHelp();
          cerr << "The argument \"" << keyword << "\" cannot be interpreted as a file name or option." << endl;
          exit(1);
    }

  }

  // Post-processing for script options. check for incompatible options.

  if (catalog && !ScriptName.empty()) {
    cerr << "Cannot specify catalog with script option" << endl << endl;
    result = false;
  }
  if (AircraftName.size() > 0 && ResetName.size() == 0 && !catalog) {
    cerr << "You must specify an initialization file with the aircraft name." << endl << endl;
    result = false;
  }
  if ((ScriptName.size() > 0 && AircraftName.size() > 0) || (ScriptName.size() > 0 && ResetName.size() > 0)) {
    cerr << "You cannot specify an aircraft or initialization file with a script." << endl;
    result = false;
  }

  return result;

}
开发者ID:AnandBiradar,项目名称:jsbsim,代码行数:101,代码来源:JSBSim.cpp


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