• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 namespace skjson {
12 class ObjectValue;
13 class StringValue;
14 class Value;
15 }  // namespace skjson
16 
17 namespace skottie {
18 
19 template <typename T>
20 bool Parse(const skjson::Value&, T*);
21 
22 template <typename T>
ParseDefault(const skjson::Value & v,const T & defaultValue)23 T ParseDefault(const skjson::Value& v, const T& defaultValue) {
24     T res;
25     if (!Parse<T>(v, &res)) {
26         res = defaultValue;
27     }
28     return res;
29 }
30 
31 const skjson::StringValue* ParseSlotID(const skjson::ObjectValue* jobj);
32 
33 } // namespace skottie
34 
35 #endif // SkottieJson_DEFINED
36