OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkXMLParser_DEFINED | 10 #ifndef SkXMLParser_DEFINED |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 virtual bool addAttribute(const char name[], const char value[]); | 77 virtual bool addAttribute(const char name[], const char value[]); |
78 virtual bool endElement(const char elem[]); | 78 virtual bool endElement(const char elem[]); |
79 virtual bool text(const char text[], int len); | 79 virtual bool text(const char text[], int len); |
80 void* fParser; | 80 void* fParser; |
81 protected: | 81 protected: |
82 SkXMLParserError* fError; | 82 SkXMLParserError* fError; |
83 private: | 83 private: |
84 void reportError(void* parser); | 84 void reportError(void* parser); |
85 }; | 85 }; |
86 | 86 |
87 #if 0 | |
88 class SkXMLPullParser { | |
89 public: | |
90 SkXMLPullParser(); | |
91 explicit SkXMLPullParser(SkStream*); | |
92 virtual ~SkXMLPullParser(); | |
93 | |
94 SkStream* getStream() const { return fStream; } | |
95 SkStream* setStream(SkStream* stream); | |
96 | |
97 enum EventType { | |
98 ERROR = -1, | |
99 START_DOCUMENT, | |
100 END_DOCUMENT, | |
101 START_TAG, | |
102 END_TAG, | |
103 TEXT, | |
104 CDSECT, | |
105 ENTITY_REF, | |
106 IGNORABLE_WHITESPACE, | |
107 PROCESSING_INSTRUCTION, | |
108 COMMENT, | |
109 DOCDECL | |
110 }; | |
111 | |
112 EventType nextToken(); | |
113 EventType getEventType() const { return fCurr.fEventType; } | |
114 | |
115 struct AttrInfo { | |
116 const char* fName; | |
117 const char* fValue; | |
118 }; | |
119 | |
120 int getDepth() const { return fDepth; } | |
121 const char* getName(); | |
122 int getAttributeCount(); | |
123 void getAttributeInfo(int, AttrInfo*); | |
124 const char* getText(); | |
125 bool isWhitespace(); | |
126 | |
127 protected: | |
128 virtual bool onEntityReplacement(const char name[], | |
129 SkString* replacement); | |
130 | |
131 public: | |
132 struct Curr { | |
133 EventType fEventType; | |
134 const char* fName; | |
135 AttrInfo* fAttrInfos; | |
136 int fAttrInfoCount; | |
137 bool fIsWhitespace; | |
138 }; | |
139 | |
140 private: | |
141 // implemented in the porting layer | |
142 bool onInit(); // return false on failure | |
143 EventType onNextToken(); | |
144 void onExit(); | |
145 | |
146 SkStream* fStream; | |
147 Curr fCurr; | |
148 int fDepth; | |
149 | |
150 struct Impl; | |
151 Impl* fImpl; | |
152 }; | |
153 #endif | 87 #endif |
154 | |
155 #endif | |
OLD | NEW |