json ÆÄÀÏÀ» °£´ÜÇÏ°Ô ºÙÀϼö ÀÖ´Â Json ¶óÀ̺귯¸®´Â ¾øÀ»±î ã¾Æ º¸¾Ò´Ù. JsonCpp´Â RapidJson¿¡ ºñÇØ ¼Óµµ´Â ´À¸®Áö¸¸ ¼Ò½º ÆÄÀÏÀÌ °£´ÜÇÏ´Ù. À¯´ÏÄÚµå´Â Áö¿øÀÌ ¾ÈµÇ´Â°Í °°´Ù( ÃֽŠ¹öÀüÀº Áö¿øÀÌ µÇ´ÂÁö Àß ¸ð¸§) ´Ù¿î·Îµå: https://github.com/open-source-parsers/jsoncpp JsonCpp´Â ¶óÀ̺귯¸®·Î ºôµå Çؼ »ç¿ëÇÏ´Â ¹æ¹ý°ú AmalgamationÀ¸·Î ¼Ò½º¸¦ Á÷Á¢ Ãß°¡ÇÏ´Â ¹æ¹ýÀÌ ÀÖ´Ù. ¿©±â¼´Â AmalgamationÀ» »ç¿ëÇÏ¿© ¼Ò½º¸¦ ÇÁ·ÎÁ§Æ®¿¡ Á÷Á¢ Ãß°¡ÇÏ´Â ¹æ¹ýÀ» »ç¿ëÇÒ °ÍÀÌ´Ù. JsonCpp Amalgamation¶óÀ̺귯¸®¸¦ ¸¸µéÁö ¾Ê°í ¼Ò½º¸¦ Á÷Á¢ ºÙÀ̱â À§ÇØ °£´ÜÇÏ°Ô ÇÕÄ¥¼ö ÀÖ´Ù.JsonCpp Æú´õ·Î °¡¼ ÆÄÀ̽㠽ºÅ©¸³Æ® amalgamate.py¸¦ ½ÇÇàÇÏ¸é µÈ´Ù. python amalgamate.py
°á°ú) dist Æú´õ¿¡ ´ÙÀ½ÀÇ ÆÄÀÏÀÌ »ý±ä´Ù. jsoncpp.cpp json/json-forwards.h json/json.h Json ÆÄÀÏ Àбâ{
"name": "È« ±æµ¿", "age": 32, "arr": [1, 2, 3, 4], "position": { "xpos": 100, "ypos": 50 } } bool ReadFromFile(const char* filename, char* buffer, int len)
{ FILE* fp = nullptr; fopen_s(&fp ,filename, "rb"); if (fp == nullptr) { return false; } size_t fileSize = fread(buffer, 1, len, fp); fclose(fp); return true; } int JsonTest2() { int len = 1000; char buffer[1000]; if (ReadFromFile("mytest.json", buffer, len) == false) { return -1; } std::string config_doc = buffer; Json::Value root; Json::Reader reader; bool parsingSuccessful = reader.parse( config_doc, root ); if (parsingSuccessful == false) { return -1; } std::cout << "position xpos: " << root["position"]["xpos"].asInt() << std::endl; std::cout << "position ypos: " << root["position"]["ypos"].asInt() << std::endl; if(!root["position"].isMember("zpos")) std::cout << "zpos does not exist." << std::endl; return 0; } jsonCpp´Â ¸â¹ö°¡ ¾ø¾îµµ ¿¡·¯°¡ ¹ß»ýÇÏÁö ¾Ê´Â´Ù. ´ÙÀ½°ú °°ÀÌ ¾ø´Â ¸â¹ö °ªÀ» °¡Á® ¿À¸é 0À» ¹ÝȯÇÑ´Ù. int z = root["position"]["zpos"].asInt(); ¸â¹ö°¡ ÀÖ´ÂÁö üũ ÇÒ¶§´Â IsMember ÇÔ¼ö·Î °Ë»çÇÏ¸é µÈ´Ù. »ùÇà ¼Ò½º°¡ °£´ÜÇϱ⠶§¹®¿¡ º°µµ ¼³¸íÀº ÇÏÁö ¾Ê´Â´Ù. ´Ù¿î·Îµå: jsontest.cpp jsoncppTest.zip ÂüÁ¶) Å×½ºÆ® ÄÚµå °¡Á®¿È https://hmjo.tistory.com/383 json cpp Amalgamation http://doocong.com/development/jsoncpp-usage/ jsoncpp ºôµå https://s-engineer.tistory.com/21 json 0.6 build https://www.lesstif.com/pages/viewpage.action?pageId=14090682 À¯´ÏÄÚµå´Â ¾Æ·¡ Äڵ带 Àû¿ëÇØ º¸¾ÒÁö¸¸ ¾ÈµÇ¾ú´Ù. ÃֽŹöÀüÀº Çغ¸Áö ¾Ê¾ÒÀ½. jsoncpp unicode encoding https://www.itread01.com/content/1549879944.html http://www.mamicode.com/info-detail-598123.html http://prog3.com/sbdm/blog/x_iya/article/details/16833663 http://blog.5danyuan.com/?p=594 https://blog.csdn.net/YAOJINGKAO/article/details/52222552 https://blog.csdn.net/paopaoqqcbg/article/details/72673993 utf-8 cpp http://utfcpp.sourceforge.net/ |