"Boost::property tree 를 이용한 json 스크립트 파싱"의 두 판 사이의 차이
jjuiddong
(→여러개의 속성을 가진 child 정보를 가져오는 방법) |
|||
1번째 줄: | 1번째 줄: | ||
== 여러개의 속성을 가진 child 정보를 가져오는 방법 == | == 여러개의 속성을 가진 child 정보를 가져오는 방법 == | ||
"property" : [ | "property" : [ | ||
+ | { | ||
+ | "symbolname" : "CLobbyServer#1" | ||
+ | }, | ||
{ | { | ||
"symbolname" : "CLobbyServer#1" | "symbolname" : "CLobbyServer#1" |
2013년 3월 26일 (화) 21:14 판
여러개의 속성을 가진 child 정보를 가져오는 방법
"property" : [ { "symbolname" : "CLobbyServer#1" }, { "symbolname" : "CLobbyServer#1" } ]
다른방식의 json 파싱
boost::property_tree 를 이용한 json 스크립트 파싱 (하나 이상의 자식을 가지는 속성값일 때)
"collapse" : [ "basic::s2c", "login::s2c" ]
이 스크립트의 정보를 가져오는 방법은 다음과 같다. (이 예제의 특징은 key value 만 있고, data value는 없다는 점이다.)
ptree &collapse = g_Props.get_child("collapse"); BOOST_FOREACH(auto &child, collapse) { if ("basic::s2c" == child.second.data()) return true; }