/* * Copyright 2017 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkJSONWriter_DEFINED #define SkJSONWriter_DEFINED #include "include/core/SkStream.h" #include "include/core/SkString.h" #include "include/core/SkTypes.h" #include "include/private/base/SkNoncopyable.h" #include "include/private/base/SkTArray.h" #include "src/base/SkUTF.h" #include <cstring> #include <cstdint> #include <string> #include <type_traits> /** * Lightweight class for writing properly structured JSON data. No random-access, everything must * be generated in-order. The resulting JSON is written directly to the SkWStream supplied at * construction time. Output is buffered, so writing to disk (via an SkFILEWStream) is ideal. * * There is a basic state machine to ensure that JSON is structured correctly, and to allow for * (optional) pretty formatting. * * This class adheres to the RFC-4627 usage of JSON (not ECMA-404). In other words, all JSON * created with this class must have a top-level object or array. Free-floating values of other * types are not considered valid. * * Note that all error checking is in the form of asserts - invalid usage in a non-debug build * will simply produce invalid JSON. */ class SkJSONWriter : SkNoncopyable { … }; #endif