1 /* 2 * Copyright 2017 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 SKSL_OUTPUTSTREAM 9 #define SKSL_OUTPUTSTREAM 10 11 #include "SkSLDefines.h" 12 #include "SkSLString.h" 13 14 namespace SkSL { 15 16 class OutputStream { 17 public: isValid()18 virtual bool isValid() const { 19 return true; 20 } 21 22 virtual void write8(uint8_t b) = 0; 23 24 virtual void writeText(const char* s) = 0; 25 26 virtual void write(const void* s, size_t size) = 0; 27 28 void writeString(String s); 29 30 void printf(const char format[], ...) SKSL_PRINTF_LIKE(2, 3); 31 32 void appendVAList(const char format[], va_list args); 33 ~OutputStream()34 virtual ~OutputStream() {} 35 36 private: 37 static const int kBufferSize = 1024; 38 }; 39 40 } // namespace 41 42 #endif 43