| | |
| | | Document doc; |
| | | doc.Parse(value); |
| | | if (!doc.HasParseError()) { |
| | | DEBUG("解析灯光配置..."); |
| | | if (doc.HasMember("exam")) { |
| | | const Value& s = doc["exam"]; |
| | | s.GetInt(); |
| | |
| | | int n = 0; |
| | | struct dummy_light_exam *content = new struct dummy_light_exam[s.Size()]; |
| | | |
| | | DEBUG("题目数量 %d", s.Size()); |
| | | |
| | | for(Value::ConstValueIterator itr = s.Begin(); itr != s.End(); ++itr) { |
| | | |
| | | if (itr->HasMember("item") && itr->HasMember("tts")) { |
| | | const Value &s1 = (*itr)["item"]; |
| | | const Value &s2 = (*itr)["tts"]; |
| | | |
| | | content[n].item = s1.GetInt(); |
| | | content[n].tts = s2.GetString(); |
| | | |
| | | DEBUG("题目 %s", s2.GetString()); |
| | | } |
| | | |
| | | if (itr->HasMember("wrong_code")) { |
| | | const Value &s = (*itr)["wrong_code"]; |
| | | |
| | | content[n].wrongCode = s.GetInt(); |
| | | |
| | | DEBUG("题目wrongCode %d", s.GetInt()); |
| | | } |
| | | |
| | | if (itr->HasMember("process")) { |
| | | const Value& s = doc["process"]; |
| | | const Value& s = (*itr)["process"]; |
| | | for(Value::ConstValueIterator itr2 = s.Begin(); itr2 != s.End(); ++itr2) { |
| | | DEBUG("题目process %d", itr2->GetInt()); |
| | | content[n].process.push_back(itr2->GetInt()); |
| | | } |
| | | } |
| | | if (itr->HasMember("solution")) { |
| | | const Value& s = doc["solution"]; |
| | | const Value& s = (*itr)["solution"]; |
| | | for(Value::ConstValueIterator itr2 = s.Begin(); itr2 != s.End(); ++itr2) { |
| | | DEBUG("题目solution %d", itr2->GetInt()); |
| | | content[n].solution.push_back(itr2->GetInt()); |
| | | } |
| | | } |