"Boost xml"의 두 판 사이의 차이

jjuiddong
이동: 둘러보기, 찾기
3번째 줄: 3번째 줄:
 
** 이보다 더 좋은 예제는 없을 듯.
 
** 이보다 더 좋은 예제는 없을 듯.
  
 
+
=== XML Read Example ===
 
  #include <iostream>
 
  #include <iostream>
 
  #include <string>
 
  #include <string>

2015년 8월 24일 (월) 10:59 판

XML Read Example

#include <iostream>
#include <string>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
using namespace std;
void main()
{
	string fileName = "hardware_settings_config.xml";

	try
	{
		// boost property tree
		using boost::property_tree::ptree;
		using std::string;
		ptree props;
		boost::property_tree::read_xml(fileName, props);

		bool parallelUpdateRender = props.get<bool>("hardware_settings_config.cpu.threadStrategy.<xmlattr>.parallelUpdateRender", false);
		cout << "parallelUpdateRender = " << parallelUpdateRender << endl;

		string workerMapFile = props.get<string>("hardware_settings_config.cpu.threadStrategy.<xmlattr>.workerMapFile", "");
		cout << "workerMapFile = " << workerMapFile << endl;
	}
	catch (std::exception&e)
	{
		cout << "Error " << e.what() << endl;
	}
}
개인 도구
이름공간

변수
행위
둘러보기
도구모음