SkSLOutputStream.h 790 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #ifndef SKSL_OUTPUTSTREAM
  8. #define SKSL_OUTPUTSTREAM
  9. #include "src/sksl/SkSLDefines.h"
  10. #include "src/sksl/SkSLString.h"
  11. namespace SkSL {
  12. class OutputStream {
  13. public:
  14. virtual bool isValid() const {
  15. return true;
  16. }
  17. virtual void write8(uint8_t b) = 0;
  18. virtual void writeText(const char* s) = 0;
  19. virtual void write(const void* s, size_t size) = 0;
  20. void writeString(String s);
  21. void printf(const char format[], ...) SKSL_PRINTF_LIKE(2, 3);
  22. void appendVAList(const char format[], va_list args);
  23. virtual ~OutputStream() {}
  24. private:
  25. static const int kBufferSize = 1024;
  26. };
  27. } // namespace
  28. #endif