18 const char* elemName =
dom.getName(node);
33 if ((node =
dom.getFirstChild(node)) !=
nullptr) {
35 if (!this->
parse(dom, node)) {
38 }
while ((node =
dom.getNextSibling(node)) !=
nullptr);
70#define kMinChunkSize 4096
98 for (; sibling !=
nullptr; sibling = sibling->
fNextSibling) {
122 while (attr < stop) {
139 if (attr ==
nullptr) {
142 return (attr - node->
attrs() + 1) < node->
fAttrCount ? attr + 1 :
nullptr;
161 fAttr = node->
attrs();
166 const char*
name =
nullptr;
171 *
value = fAttr->fValue;
205 int attrCount = fAttrs.size();
210 node->
fName = fElemName;
211 node->fFirstChild =
nullptr;
212 node->fAttrCount =
SkToU16(attrCount);
213 node->fAttrs = attrs;
214 node->fType = fElemType;
216 if (fRoot ==
nullptr) {
217 node->fNextSibling =
nullptr;
225 *fParentStack.append() = node;
245 this->flushAttributes();
246 fNeedToFlush =
false;
250 fParentStack.pop_back();
272 void startCommon(
const char elem[],
size_t elemSize,
SkDOM::Type type) {
273 if (fLevel > 0 && fNeedToFlush) {
274 this->flushAttributes();
277 fElemName =
dupstr(fAlloc, elem, elemSize);
296 if (!
parser.parse(docStream))
310 const char* elem =
dom.getName(node);
317 parser->startElement(elem);
325 node =
dom.getFirstChild(node,
nullptr);
329 node =
dom.getNextSibling(node,
nullptr);
346 fParser = std::make_unique<SkDOMParser>(&fAlloc);
348 return fParser.get();
353 fRoot = fParser->getRoot();
403 return vstr && !strcmp(vstr,
value);
static float next(float f)
static float prev(float f)
static void walk_dom(const SkDOM &dom, const SkDOM::Node *node, SkXMLParser *parser)
static char * dupstr(SkArenaAlloc *chunk, const char src[], size_t srcLen)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static void * sk_careful_memcpy(void *dst, const void *src, size_t len)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
constexpr uint16_t SkToU16(S x)
constexpr int SkToInt(S x)
T * makeArrayDefault(size_t count)
auto make(Ctor &&ctor) -> decltype(ctor(nullptr))
bool onEndElement(const char elem[]) override
SkXMLParserError fParserError
SkDOM::Node * getRoot() const
bool onAddAttribute(const char name[], const char value[]) override
SkDOMParser(SkArenaAllocWithReset *chunk)
bool onText(const char text[], int len) override
bool onStartElement(const char elem[]) override
const char * next(const char **value)
AttrIter(const SkDOM &, const Node *)
const Node * finishParsing()
const Attr * getNextAttr(const Node *, const Attr *) const
bool hasS32(const Node *, const char name[], int32_t value) const
bool findS32(const Node *, const char name[], int32_t *value) const
const Attr * getFirstAttr(const Node *) const
int findList(const Node *, const char name[], const char list[]) const
const char * getAttrValue(const Node *, const Attr *) const
bool findBool(const Node *, const char name[], bool *) const
const Node * getRootNode() const
const Node * copy(const SkDOM &dom, const Node *node)
bool findScalars(const Node *, const char name[], SkScalar value[], int count) const
bool hasScalar(const Node *, const char name[], SkScalar value) const
const Node * getNextSibling(const Node *, const char elem[]=nullptr) const
bool hasHex(const Node *, const char name[], uint32_t value) const
bool findHex(const Node *, const char name[], uint32_t *value) const
bool hasAttr(const Node *, const char name[], const char value[]) const
const Node * getFirstChild(const Node *, const char elem[]=nullptr) const
const char * getName(const Node *) const
bool hasBool(const Node *, const char name[], bool value) const
Type getType(const Node *) const
SkXMLParser * beginParsing()
const Node * build(SkStream &)
int countChildren(const Node *node, const char elem[]=nullptr) const
const char * findAttr(const Node *, const char attrName[]) const
const char * getAttrName(const Node *, const Attr *) const
static const char * FindScalar(const char str[], SkScalar *value)
static const char * FindHex(const char str[], uint32_t *value)
static const char * FindS32(const char str[], int32_t *value)
static const char * FindScalars(const char str[], SkScalar value[], int count)
static int FindList(const char str[], const char list[])
static bool FindBool(const char str[], bool *value)
bool startElement(const char elem[])
bool endElement(const char elem[])
bool addAttribute(const char name[], const char value[])
bool parse(const char doc[], size_t len)
DEF_SWITCHES_START aot vmservice shared library name
const SkDOMAttr * attrs() const