Flutter Engine
The Flutter Engine
Public Types | Public Member Functions | Protected Member Functions | List of all members
SkXMLStreamWriter Class Reference

#include <SkXMLWriter.h>

Inheritance diagram for SkXMLStreamWriter:
SkXMLWriter

Public Types

enum  : uint32_t { kNoPretty_Flag = 0x01 }
 

Public Member Functions

 SkXMLStreamWriter (SkWStream *, uint32_t flags=0)
 
 ~SkXMLStreamWriter () override
 
void writeHeader () override
 
- Public Member Functions inherited from SkXMLWriter
 SkXMLWriter (bool doEscapeMarkup=true)
 
virtual ~SkXMLWriter ()
 
void addS32Attribute (const char name[], int32_t value)
 
void addAttribute (const char name[], const char value[])
 
void addAttributeLen (const char name[], const char value[], size_t length)
 
void addHexAttribute (const char name[], uint32_t value, int minDigits=0)
 
void addScalarAttribute (const char name[], SkScalar value)
 
void addText (const char text[], size_t length)
 
void endElement ()
 
void startElement (const char elem[])
 
void startElementLen (const char elem[], size_t length)
 
void writeDOM (const SkDOM &, const SkDOM::Node *, bool skipRoot)
 
void flush ()
 
virtual void writeHeader ()
 

Protected Member Functions

void onStartElementLen (const char elem[], size_t length) override
 
void onEndElement () override
 
void onAddAttributeLen (const char name[], const char value[], size_t length) override
 
void onAddText (const char text[], size_t length) override
 
- Protected Member Functions inherited from SkXMLWriter
virtual void onStartElementLen (const char elem[], size_t length)=0
 
virtual void onAddAttributeLen (const char name[], const char value[], size_t length)=0
 
virtual void onAddText (const char text[], size_t length)=0
 
virtual void onEndElement ()=0
 
void doEnd (Elem *elem)
 
bool doStart (const char name[], size_t length)
 
ElemgetEnd ()
 
const char * getHeader ()
 

Additional Inherited Members

- Protected Attributes inherited from SkXMLWriter
SkTDArray< Elem * > fElems
 

Detailed Description

Definition at line 64 of file SkXMLWriter.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : uint32_t
Enumerator
kNoPretty_Flag 

Definition at line 66 of file SkXMLWriter.h.

66 : uint32_t {
67 kNoPretty_Flag = 0x01,
68 };

Constructor & Destructor Documentation

◆ SkXMLStreamWriter()

SkXMLStreamWriter::SkXMLStreamWriter ( SkWStream stream,
uint32_t  flags = 0 
)

Definition at line 193 of file SkXMLWriter.cpp.

194 : fStream(*stream)
195 , fFlags(flags) {}
FlutterSemanticsFlag flags

◆ ~SkXMLStreamWriter()

SkXMLStreamWriter::~SkXMLStreamWriter ( )
override

Definition at line 197 of file SkXMLWriter.cpp.

197 {
198 this->flush();
199}
void flush()
Definition: SkXMLWriter.cpp:20

Member Function Documentation

◆ onAddAttributeLen()

void SkXMLStreamWriter::onAddAttributeLen ( const char  name[],
const char  value[],
size_t  length 
)
overrideprotectedvirtual

Implements SkXMLWriter.

Definition at line 201 of file SkXMLWriter.cpp.

201 {
202 SkASSERT(!fElems.back()->fHasChildren && !fElems.back()->fHasText);
203 fStream.writeText(" ");
204 fStream.writeText(name);
205 fStream.writeText("=\"");
206 fStream.write(value, length);
207 fStream.writeText("\"");
208}
#define SkASSERT(cond)
Definition: SkAssert.h:116
virtual bool write(const void *buffer, size_t size)=0
bool writeText(const char text[])
Definition: SkStream.h:247
SkTDArray< Elem * > fElems
Definition: SkXMLWriter.h:56
uint8_t value
size_t length
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ onAddText()

void SkXMLStreamWriter::onAddText ( const char  text[],
size_t  length 
)
overrideprotectedvirtual

Implements SkXMLWriter.

Definition at line 210 of file SkXMLWriter.cpp.

210 {
211 Elem* elem = fElems.back();
212
213 if (!elem->fHasChildren && !elem->fHasText) {
214 fStream.writeText(">");
215 this->newline();
216 }
217
218 this->tab(fElems.size() + 1);
219 fStream.write(text, length);
220 this->newline();
221}
std::u16string text

◆ onEndElement()

void SkXMLStreamWriter::onEndElement ( )
overrideprotectedvirtual

Implements SkXMLWriter.

Definition at line 223 of file SkXMLWriter.cpp.

223 {
224 Elem* elem = getEnd();
225 if (elem->fHasChildren || elem->fHasText) {
226 this->tab(fElems.size());
227 fStream.writeText("</");
228 fStream.writeText(elem->fName.c_str());
229 fStream.writeText(">");
230 } else {
231 fStream.writeText("/>");
232 }
233 this->newline();
234 doEnd(elem);
235}
void doEnd(Elem *elem)
Definition: SkXMLWriter.cpp:58
Elem * getEnd()
Definition: SkXMLWriter.cpp:73

◆ onStartElementLen()

void SkXMLStreamWriter::onStartElementLen ( const char  elem[],
size_t  length 
)
overrideprotectedvirtual

Implements SkXMLWriter.

Definition at line 237 of file SkXMLWriter.cpp.

237 {
238 int level = fElems.size();
239 if (this->doStart(name, length)) {
240 // the first child, need to close with >
241 fStream.writeText(">");
242 this->newline();
243 }
244
245 this->tab(level);
246 fStream.writeText("<");
247 fStream.write(name, length);
248}
bool doStart(const char name[], size_t length)
Definition: SkXMLWriter.cpp:62

◆ writeHeader()

void SkXMLStreamWriter::writeHeader ( )
overridevirtual

Reimplemented from SkXMLWriter.

Definition at line 250 of file SkXMLWriter.cpp.

250 {
251 const char* header = getHeader();
252 fStream.write(header, strlen(header));
253 this->newline();
254}
const char * getHeader()
Definition: SkXMLWriter.cpp:79
static const char header[]
Definition: skpbench.cpp:88

The documentation for this class was generated from the following files: