diff options
author | Florin Malita <fmalita@chromium.org> | 2018-05-26 09:49:28 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-27 02:21:33 +0000 |
commit | 3d856bdeee7fae2ff36cdb6a9807c588fc030eb1 (patch) | |
tree | b26aa52b2d2f8877bdc7a7c647e4a34fd3e96f35 /experimental/skottie/SkottieJson.h | |
parent | d8eb7b6b12d5b155214031d4aa4d8f582ebb91a1 (diff) |
[skottie] Relocate to modules/skottie
TBR=
Change-Id: I218d251ca56578a3a7fd4fb86cba9abdc10fb3bd
Reviewed-on: https://skia-review.googlesource.com/130322
Reviewed-by: Florin Malita <fmalita@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'experimental/skottie/SkottieJson.h')
-rw-r--r-- | experimental/skottie/SkottieJson.h | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/experimental/skottie/SkottieJson.h b/experimental/skottie/SkottieJson.h deleted file mode 100644 index 76e17c610e..0000000000 --- a/experimental/skottie/SkottieJson.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkottieJson_DEFINED -#define SkottieJson_DEFINED - -#include "SkRefCnt.h" - -#include "rapidjson/document.h" - -class SkData; -class SkStream; -class SkString; - -namespace skottie { - -namespace json { - -class ValueRef { -public: - ValueRef() : fValue(nullptr) {} - ValueRef(const rapidjson::Value& v) : fValue(v.IsNull() ? nullptr : &v) {} - - bool isNull() const { return !fValue; } - bool isObject() const { return fValue && fValue->IsObject(); } - bool isArray() const { return fValue && fValue->IsArray(); } - - template <typename T> - bool to(T*) const; - - template <typename T> - T toDefault(const T& defaultValue) const { - T v; - if (!this->to<T>(&v)) { - v = defaultValue; - } - return v; - } - - size_t size() const; - ValueRef operator[](size_t i) const; - ValueRef operator[](const char* key) const; - - bool operator==(const ValueRef& other) const { return fValue == other.fValue; } - bool operator!=(const ValueRef& other) const { return !(*this == other); } - - const rapidjson::Value* begin() const; - const rapidjson::Value* end() const; - - SkString toString() const; - -private: - const rapidjson::Value* fValue; -}; - -// Container for the json DOM -class Document { -public: - explicit Document(SkStream*); - - ValueRef root() const { return fDocument; } - -private: - sk_sp<SkData> fData; // raw data - rapidjson::Document fDocument; // in-place json DOM -}; - -} // namespace json - -} // namespace skottie - -#endif // SkottieJson_DEFINED |