Skip to content

Commit

Permalink
fix json
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaominghe2014 committed Apr 29, 2024
1 parent bd5ab86 commit fda761e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ void testYml()

void testSgf()
{
std::string sgfStr = "(;SZ[19]AP[MultiGo:3.6.0 \\[escaped\\] tail ]AB[pb][pc][oc][od][ne][nf][og][pg][qg][rg][rf]AW[qf][pf][of][oe][re][qd][qc][pd]\n"
std::string sgfStr = "(;SZ[19]AP[MultiGo:3.6.0 \\[escaped\\] tail ]AB[pb:pc][oc][od][ne][nf][og][pg][qg][rg][rf]AW[qf][pf][of][oe][re][qd][qc][pd]\n"
"(;B[sd](;W[rb] ;B[qe](;W[pe] ;B[rd] ;W[se] ;B[sf] ;W[qe] ;B[qb] ;W[rc] ;B[ra])\n"
"(;W[rd] ;B[sc] ;W[se] ;B[pe] ;W[qb] ;B[qa] ;W[ra] ;B[sb])\n"
")\n"
Expand Down
9 changes: 3 additions & 6 deletions src/parser/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,9 @@ namespace xlib{
return nullJSON;
}
const std::map<std::string, JSON>& obj = asObject();
for (auto it = obj.begin(); it != obj.end(); ++it) {
const std::string& k = it->first;
// 在这里使用key和value进行操作
if(k==key){
return it->second;
}
auto v = obj.find(key);
if(v!=obj.end()){
return v->second;
}
return nullJSON;
}
Expand Down

0 comments on commit fda761e

Please sign in to comment.