1 2 /* 3 * Copyright 2006 The Android Open Source Project 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10 #ifndef SkBML_WXMLParser_DEFINED 11 #define SkBML_WXMLParser_DEFINED 12 13 #include "SkString.h" 14 #include "SkXMLParser.h" 15 16 class SkStream; 17 class SkWStream; 18 19 class BML_WXMLParser : public SkXMLParser { 20 public: 21 BML_WXMLParser(SkWStream& writer); 22 virtual ~BML_WXMLParser(); 23 static void Write(SkStream& s, const char filename[]); 24 25 /** @cond UNIT_TEST */ 26 SkDEBUGCODE(static void UnitTest();) 27 /** @endcond */ 28 private: 29 virtual bool onAddAttribute(const char name[], const char value[]); 30 virtual bool onEndElement(const char name[]); 31 virtual bool onStartElement(const char name[]); 32 BML_WXMLParser& operator=(const BML_WXMLParser& src); 33 #ifdef SK_DEBUG 34 int fElemsCount, fElemsReused; 35 int fAttrsCount, fNamesReused, fValuesReused; 36 #endif 37 SkWStream& fWriter; 38 char* fElems[256]; 39 char* fAttrNames[256]; 40 char* fAttrValues[256]; 41 42 // important that these are U8, so we get automatic wrap-around 43 uint8_t fNextElem, fNextAttrName, fNextAttrValue; 44 }; 45 46 #endif // SkBML_WXMLParser_DEFINED 47