gfx/skia/trunk/src/xml/SkXMLParser.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1
michael@0 2 /*
michael@0 3 * Copyright 2006 The Android Open Source Project
michael@0 4 *
michael@0 5 * Use of this source code is governed by a BSD-style license that can be
michael@0 6 * found in the LICENSE file.
michael@0 7 */
michael@0 8
michael@0 9
michael@0 10 #include "SkXMLParser.h"
michael@0 11
michael@0 12 static char const* const gErrorStrings[] = {
michael@0 13 "empty or missing file ",
michael@0 14 "unknown element ",
michael@0 15 "unknown attribute name ",
michael@0 16 "error in attribute value ",
michael@0 17 "duplicate ID ",
michael@0 18 "unknown error "
michael@0 19 };
michael@0 20
michael@0 21 SkXMLParserError::SkXMLParserError() : fCode(kNoError), fLineNumber(-1),
michael@0 22 fNativeCode(-1)
michael@0 23 {
michael@0 24 reset();
michael@0 25 }
michael@0 26
michael@0 27 SkXMLParserError::~SkXMLParserError()
michael@0 28 {
michael@0 29 // need a virtual destructor for our subclasses
michael@0 30 }
michael@0 31
michael@0 32 void SkXMLParserError::getErrorString(SkString* str) const
michael@0 33 {
michael@0 34 SkASSERT(str);
michael@0 35 SkString temp;
michael@0 36 if (fCode != kNoError) {
michael@0 37 if ((unsigned)fCode < SK_ARRAY_COUNT(gErrorStrings))
michael@0 38 temp.set(gErrorStrings[fCode - 1]);
michael@0 39 temp.append(fNoun);
michael@0 40 } else
michael@0 41 SkXMLParser::GetNativeErrorString(fNativeCode, &temp);
michael@0 42 str->append(temp);
michael@0 43 }
michael@0 44
michael@0 45 void SkXMLParserError::reset() {
michael@0 46 fCode = kNoError;
michael@0 47 fLineNumber = -1;
michael@0 48 fNativeCode = -1;
michael@0 49 }
michael@0 50
michael@0 51
michael@0 52 ////////////////
michael@0 53
michael@0 54 SkXMLParser::SkXMLParser(SkXMLParserError* parserError) : fParser(NULL), fError(parserError)
michael@0 55 {
michael@0 56 }
michael@0 57
michael@0 58 SkXMLParser::~SkXMLParser()
michael@0 59 {
michael@0 60 }
michael@0 61
michael@0 62 bool SkXMLParser::startElement(const char elem[])
michael@0 63 {
michael@0 64 return this->onStartElement(elem);
michael@0 65 }
michael@0 66
michael@0 67 bool SkXMLParser::addAttribute(const char name[], const char value[])
michael@0 68 {
michael@0 69 return this->onAddAttribute(name, value);
michael@0 70 }
michael@0 71
michael@0 72 bool SkXMLParser::endElement(const char elem[])
michael@0 73 {
michael@0 74 return this->onEndElement(elem);
michael@0 75 }
michael@0 76
michael@0 77 bool SkXMLParser::text(const char text[], int len)
michael@0 78 {
michael@0 79 return this->onText(text, len);
michael@0 80 }
michael@0 81
michael@0 82 ////////////////////////////////////////////////////////////////////////////////
michael@0 83
michael@0 84 bool SkXMLParser::onStartElement(const char elem[]) {return false; }
michael@0 85 bool SkXMLParser::onAddAttribute(const char name[], const char value[]) {return false; }
michael@0 86 bool SkXMLParser::onEndElement(const char elem[]) { return false; }
michael@0 87 bool SkXMLParser::onText(const char text[], int len) {return false; }

mercurial