1/*
2 * Copyright 2018 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkottieJson_DEFINED
9#define SkottieJson_DEFINED
10
11#include "include/core/SkRefCnt.h"
12#include "src/utils/SkJSON.h"
13
14class SkData;
15class SkStream;
16class SkString;
17
18namespace skottie {
19
20template <typename T>
21bool Parse(const skjson::Value&, T*);
22
23template <typename T>
24T ParseDefault(const skjson::Value& v, const T& defaultValue) {
25 T res;
26 if (!Parse<T>(v, &res)) {
27 res = defaultValue;
28 }
29 return res;
30}
31
32} // namespace skottie
33
34#endif // SkottieJson_DEFINED
35