blob: e16b95c95651e37bd2e0c58211e28717b7b93252 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@android.com8a1c16f2008-12-17 15:59:43 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2006 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
reed@android.com8a1c16f2008-12-17 15:59:43 +000010#ifndef SkBML_WXMLParser_DEFINED
11#define SkBML_WXMLParser_DEFINED
12
13#include "SkString.h"
14#include "SkXMLParser.h"
15
16class SkStream;
17class SkWStream;
18
19class BML_WXMLParser : public SkXMLParser {
20public:
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 */
28private:
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 U8 fNextElem, fNextAttrName, fNextAttrValue;
44};
45
46#endif // SkBML_WXMLParser_DEFINED
47