Flutter Engine
The Flutter Engine
Classes | Macros | Functions
SkDOM.cpp File Reference
#include "src/xml/SkDOM.h"
#include <memory>
#include "include/core/SkStream.h"
#include "include/private/base/SkTo.h"
#include "src/xml/SkXMLParser.h"
#include "src/xml/SkXMLWriter.h"
#include "include/private/base/SkTDArray.h"
#include "include/utils/SkParse.h"

Go to the source code of this file.

Classes

struct  SkDOMAttr
 
struct  SkDOMNode
 
class  SkDOMParser
 

Macros

#define kMinChunkSize   4096
 

Functions

static char * dupstr (SkArenaAlloc *chunk, const char src[], size_t srcLen)
 
static void walk_dom (const SkDOM &dom, const SkDOM::Node *node, SkXMLParser *parser)
 

Macro Definition Documentation

◆ kMinChunkSize

#define kMinChunkSize   4096

Definition at line 70 of file SkDOM.cpp.

Function Documentation

◆ dupstr()

static char * dupstr ( SkArenaAlloc chunk,
const char  src[],
size_t  srcLen 
)
static

Definition at line 182 of file SkDOM.cpp.

182 {
183 SkASSERT(chunk && src);
184 char* dst = chunk->makeArrayDefault<char>(srcLen + 1);
185 memcpy(dst, src, srcLen);
186 dst[srcLen] = '\0';
187 return dst;
188}
#define SkASSERT(cond)
Definition: SkAssert.h:116
T * makeArrayDefault(size_t count)
Definition: SkArenaAlloc.h:171
dst
Definition: cp.py:12

◆ walk_dom()

static void walk_dom ( const SkDOM dom,
const SkDOM::Node node,
SkXMLParser parser 
)
static

Definition at line 309 of file SkDOM.cpp.

309 {
310 const char* elem = dom.getName(node);
311 if (dom.getType(node) == SkDOM::kText_Type) {
312 SkASSERT(dom.countChildren(node) == 0);
313 parser->text(elem, SkToInt(strlen(elem)));
314 return;
315 }
316
317 parser->startElement(elem);
318
319 SkDOM::AttrIter iter(dom, node);
320 const char* name;
321 const char* value;
322 while ((name = iter.next(&value)) != nullptr)
323 parser->addAttribute(name, value);
324
325 node = dom.getFirstChild(node, nullptr);
326 while (node)
327 {
328 walk_dom(dom, node, parser);
329 node = dom.getNextSibling(node, nullptr);
330 }
331
332 parser->endElement(elem);
333}
static void walk_dom(const SkDOM &dom, const SkDOM::Node *node, SkXMLParser *parser)
Definition: SkDOM.cpp:309
constexpr int SkToInt(S x)
Definition: SkTo.h:29
@ kText_Type
Definition: SkDOM.h:44
uint8_t value
Definition: dom.py:1
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
parser
Definition: zip.py:78