2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Copyright 2006 The Android Open Source Project
|
2008-12-17 15:59:43 +00:00
|
|
|
*
|
2011-07-28 14:26:00 +00:00
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
2008-12-17 15:59:43 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-28 14:26:00 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
#ifndef SkBML_WXMLParser_DEFINED
|
|
|
|
#define SkBML_WXMLParser_DEFINED
|
|
|
|
|
|
|
|
#include "SkString.h"
|
|
|
|
#include "SkXMLParser.h"
|
|
|
|
|
|
|
|
class SkStream;
|
|
|
|
class SkWStream;
|
|
|
|
|
|
|
|
class BML_WXMLParser : public SkXMLParser {
|
|
|
|
public:
|
|
|
|
BML_WXMLParser(SkWStream& writer);
|
|
|
|
virtual ~BML_WXMLParser();
|
|
|
|
static void Write(SkStream& s, const char filename[]);
|
2012-08-23 18:09:54 +00:00
|
|
|
|
2008-12-17 15:59:43 +00:00
|
|
|
/** @cond UNIT_TEST */
|
|
|
|
SkDEBUGCODE(static void UnitTest();)
|
2012-08-23 18:09:54 +00:00
|
|
|
/** @endcond */
|
2008-12-17 15:59:43 +00:00
|
|
|
private:
|
|
|
|
virtual bool onAddAttribute(const char name[], const char value[]);
|
|
|
|
virtual bool onEndElement(const char name[]);
|
|
|
|
virtual bool onStartElement(const char name[]);
|
|
|
|
BML_WXMLParser& operator=(const BML_WXMLParser& src);
|
|
|
|
#ifdef SK_DEBUG
|
|
|
|
int fElemsCount, fElemsReused;
|
|
|
|
int fAttrsCount, fNamesReused, fValuesReused;
|
|
|
|
#endif
|
|
|
|
SkWStream& fWriter;
|
|
|
|
char* fElems[256];
|
|
|
|
char* fAttrNames[256];
|
|
|
|
char* fAttrValues[256];
|
|
|
|
|
|
|
|
// important that these are U8, so we get automatic wrap-around
|
|
|
|
U8 fNextElem, fNextAttrName, fNextAttrValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SkBML_WXMLParser_DEFINED
|
|
|
|
|