OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2012 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 SkJsonWriteBuffer_DEFINED |
| 9 #define SkJsonWriteBuffer_DEFINED |
| 10 |
| 11 #include "SkWriteBuffer.h" |
| 12 |
| 13 #include "SkJSONCPP.h" |
| 14 |
| 15 class SkPath; |
| 16 class UrlDataManager; |
| 17 |
| 18 class SkJsonWriteBuffer final : public SkWriteBuffer { |
| 19 public: |
| 20 SkJsonWriteBuffer(UrlDataManager* urlDataManager) |
| 21 : fUrlDataManager(urlDataManager) |
| 22 , fFieldCount(0) {} |
| 23 |
| 24 bool isCrossProcess() const override { return false; } |
| 25 |
| 26 void writeByteArray(const void* data, size_t size) override; |
| 27 void writeDataAsByteArray(SkData* data) override; |
| 28 void writeBool(bool value) override; |
| 29 void writeScalar(SkScalar value) override; |
| 30 void writeScalarArray(const SkScalar* value, uint32_t count) override; |
| 31 void writeInt(int32_t value) override; |
| 32 void writeIntArray(const int32_t* value, uint32_t count) override; |
| 33 void writeUInt(uint32_t value) override; |
| 34 void write32(int32_t value) override; |
| 35 void writeString(const char* value) override; |
| 36 void writeEncodedString(const void* value, size_t byteLength, |
| 37 SkPaint::TextEncoding encoding) override; |
| 38 void writeFunctionPtr(void* ptr) override; |
| 39 |
| 40 void writeFlattenable(const SkFlattenable* flattenable) override; |
| 41 void writeColor(const SkColor& color) override; |
| 42 void writeColorArray(const SkColor* color, uint32_t count) override; |
| 43 void writePoint(const SkPoint& point) override; |
| 44 void writePointArray(const SkPoint* point, uint32_t count) override; |
| 45 void writeMatrix(const SkMatrix& matrix) override; |
| 46 void writeIRect(const SkIRect& rect) override; |
| 47 void writeRect(const SkRect& rect) override; |
| 48 void writeRegion(const SkRegion& region) override; |
| 49 void writePath(const SkPath& path) override; |
| 50 size_t writeStream(SkStream* stream, size_t length) override; |
| 51 void writeBitmap(const SkBitmap& bitmap) override; |
| 52 void writeImage(const SkImage*) override; |
| 53 void writeTypeface(SkTypeface* typeface) override; |
| 54 void writePaint(const SkPaint& paint) override; |
| 55 |
| 56 const Json::Value& getValue() const { return fJson; } |
| 57 |
| 58 private: |
| 59 void append(const char* type, const Json::Value& value); |
| 60 |
| 61 UrlDataManager* fUrlDataManager; |
| 62 Json::Value fJson; |
| 63 uint32_t fFieldCount; |
| 64 }; |
| 65 |
| 66 #endif |
OLD | NEW |