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 "SkSLString.h" 12 13 namespace SkSL { 14 15 class OutputStream { 16 public: isValid()17 virtual bool isValid() const { 18 return true; 19 } 20 21 virtual void write8(uint8_t b) = 0; 22 23 virtual void writeText(const char* s) = 0; 24 25 virtual void write(const void* s, size_t size) = 0; 26 writeString(String s)27 void writeString(String s) { 28 this->write(s.c_str(), s.size()); 29 } 30 ~OutputStream()31 virtual ~OutputStream() {} 32 }; 33 34 } // namespace 35 36 #endif 37