本文整理汇总了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))
{
//.........这里部分代码省略.........