37c772ae2d
BUG=skia: R=bensong@google.com, epoger@google.com Author: kelvinly@google.com Review URL: https://codereview.chromium.org/304613002 git-svn-id: http://skia.googlecode.com/svn/trunk@14966 2bbb7eff-a529-9590-31e7-b0007b416f81
34 lines
838 B
C++
34 lines
838 B
C++
/*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*
|
|
* Helper functions for result writing operations.
|
|
*/
|
|
|
|
#include "ResultsWriter.h"
|
|
|
|
#ifdef SK_BUILD_JSON_WRITER
|
|
|
|
Json::Value* SkFindNamedNode(Json::Value* root, const char name[]) {
|
|
Json::Value* search_results = NULL;
|
|
for(Json::Value::iterator iter = root->begin();
|
|
iter!= root->end(); ++iter) {
|
|
if(SkString(name).equals((*iter)["name"].asCString())) {
|
|
search_results = &(*iter);
|
|
break;
|
|
}
|
|
}
|
|
|
|
if(search_results != NULL) {
|
|
return search_results;
|
|
} else {
|
|
Json::Value* new_val = &(root->append(Json::Value()));
|
|
(*new_val)["name"] = name;
|
|
return new_val;
|
|
}
|
|
}
|
|
|
|
#endif // SK_BUILD_JSON_WRITER
|