/src/skia/modules/skottie/src/SkottieJson.h
Line | Count | Source |
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> |
23 | 9.72M | T ParseDefault(const skjson::Value& v, const T& defaultValue) { |
24 | 9.72M | T res; |
25 | 9.72M | if (!Parse<T>(v, &res)) { |
26 | 6.05M | res = defaultValue; |
27 | 6.05M | } |
28 | 9.72M | return res; |
29 | 9.72M | } SkString skottie::ParseDefault<SkString>(skjson::Value const&, SkString const&) Line | Count | Source | 23 | 144k | T ParseDefault(const skjson::Value& v, const T& defaultValue) { | 24 | 144k | T res; | 25 | 144k | if (!Parse<T>(v, &res)) { | 26 | 21.1k | res = defaultValue; | 27 | 21.1k | } | 28 | 144k | return res; | 29 | 144k | } |
float skottie::ParseDefault<float>(skjson::Value const&, float const&) Line | Count | Source | 23 | 1.64M | T ParseDefault(const skjson::Value& v, const T& defaultValue) { | 24 | 1.64M | T res; | 25 | 1.64M | if (!Parse<T>(v, &res)) { | 26 | 914k | res = defaultValue; | 27 | 914k | } | 28 | 1.64M | return res; | 29 | 1.64M | } |
bool skottie::ParseDefault<bool>(skjson::Value const&, bool const&) Line | Count | Source | 23 | 4.10M | T ParseDefault(const skjson::Value& v, const T& defaultValue) { | 24 | 4.10M | T res; | 25 | 4.10M | if (!Parse<T>(v, &res)) { | 26 | 2.58M | res = defaultValue; | 27 | 2.58M | } | 28 | 4.10M | return res; | 29 | 4.10M | } |
int skottie::ParseDefault<int>(skjson::Value const&, int const&) Line | Count | Source | 23 | 2.54M | T ParseDefault(const skjson::Value& v, const T& defaultValue) { | 24 | 2.54M | T res; | 25 | 2.54M | if (!Parse<T>(v, &res)) { | 26 | 1.76M | res = defaultValue; | 27 | 1.76M | } | 28 | 2.54M | return res; | 29 | 2.54M | } |
unsigned long skottie::ParseDefault<unsigned long>(skjson::Value const&, unsigned long const&) Line | Count | Source | 23 | 1.17M | T ParseDefault(const skjson::Value& v, const T& defaultValue) { | 24 | 1.17M | T res; | 25 | 1.17M | if (!Parse<T>(v, &res)) { | 26 | 720k | res = defaultValue; | 27 | 720k | } | 28 | 1.17M | return res; | 29 | 1.17M | } |
SkV2 skottie::ParseDefault<SkV2>(skjson::Value const&, SkV2 const&) Line | Count | Source | 23 | 109k | T ParseDefault(const skjson::Value& v, const T& defaultValue) { | 24 | 109k | T res; | 25 | 109k | if (!Parse<T>(v, &res)) { | 26 | 52.7k | res = defaultValue; | 27 | 52.7k | } | 28 | 109k | return res; | 29 | 109k | } |
|
30 | | |
31 | | const skjson::StringValue* ParseSlotID(const skjson::ObjectValue* jobj); |
32 | | |
33 | | } // namespace skottie |
34 | | |
35 | | #endif // SkottieJson_DEFINED |