Flutter Engine
The Flutter Engine
SkSLStringStream.h
Go to the documentation of this file.
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_STRINGSTREAM
9#define SKSL_STRINGSTREAM
10
11#include "include/core/SkData.h"
14
15namespace SkSL {
16
17class StringStream : public OutputStream {
18public:
19 void write8(uint8_t b) override {
20 SkASSERT(fString.empty());
21 fStream.write8(b);
22 }
23
24 void writeText(const char* s) override {
25 SkASSERT(fString.empty());
26 fStream.writeText(s);
27 }
28
29 void write(const void* s, size_t size) override {
30 SkASSERT(fString.empty());
31 fStream.write(s, size);
32 }
33
34 size_t bytesWritten() const {
35 return fStream.bytesWritten();
36 }
37
38 const std::string& str() const {
39 if (!fString.size()) {
41 fString = std::string((const char*) data->data(), data->size());
42 }
43 return fString;
44 }
45
46 void reset() {
47 fStream.reset();
48 fString = "";
49 }
50
51private:
52 mutable SkDynamicMemoryWStream fStream;
53 mutable std::string fString;
54};
55
56} // namespace SkSL
57
58#endif
#define SkASSERT(cond)
Definition: SkAssert.h:116
size_t bytesWritten() const override
Definition: SkStream.cpp:526
bool write(const void *buffer, size_t size) override
Definition: SkStream.cpp:535
sk_sp< SkData > detachAsData()
Definition: SkStream.cpp:707
size_t bytesWritten() const
void write8(uint8_t b) override
void writeText(const char *s) override
const std::string & str() const
void write(const void *s, size_t size) override
bool write8(U8CPU value)
Definition: SkStream.h:235
bool writeText(const char text[])
Definition: SkStream.h:247
static bool b
struct MyStruct s
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63