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 SkDOM_DEFINED | 10 #ifndef SkDOM_DEFINED |
11 #define SkDOM_DEFINED | 11 #define SkDOM_DEFINED |
12 | 12 |
13 #include "../private/SkTemplates.h" | 13 #include "../private/SkTemplates.h" |
14 #include "SkChunkAlloc.h" | 14 #include "SkChunkAlloc.h" |
15 #include "SkScalar.h" | 15 #include "SkScalar.h" |
| 16 #include "SkTypes.h" |
16 | 17 |
17 struct SkDOMNode; | 18 struct SkDOMNode; |
18 struct SkDOMAttr; | 19 struct SkDOMAttr; |
19 | 20 |
20 class SkDOMParser; | 21 class SkDOMParser; |
| 22 class SkStream; |
21 class SkXMLParser; | 23 class SkXMLParser; |
22 | 24 |
23 class SkDOM { | 25 class SK_API SkDOM : public SkNoncopyable { |
24 public: | 26 public: |
25 SkDOM(); | 27 SkDOM(); |
26 ~SkDOM(); | 28 ~SkDOM(); |
27 | 29 |
28 typedef SkDOMNode Node; | 30 typedef SkDOMNode Node; |
29 typedef SkDOMAttr Attr; | 31 typedef SkDOMAttr Attr; |
30 | 32 |
31 /** Returns null on failure | 33 /** Returns null on failure |
32 */ | 34 */ |
33 const Node* build(const char doc[], size_t len); | 35 const Node* build(const char doc[], size_t len); |
| 36 const Node* build(SkStream&); |
34 const Node* copy(const SkDOM& dom, const Node* node); | 37 const Node* copy(const SkDOM& dom, const Node* node); |
35 | 38 |
36 const Node* getRootNode() const; | 39 const Node* getRootNode() const; |
37 | 40 |
38 SkXMLParser* beginParsing(); | 41 SkXMLParser* beginParsing(); |
39 const Node* finishParsing(); | 42 const Node* finishParsing(); |
40 | 43 |
41 enum Type { | 44 enum Type { |
42 kElement_Type, | 45 kElement_Type, |
43 kText_Type | 46 kText_Type |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 class AttrIter { | 81 class AttrIter { |
79 public: | 82 public: |
80 AttrIter(const class SkDOM&, const Node*); | 83 AttrIter(const class SkDOM&, const Node*); |
81 const char* next(const char** value); | 84 const char* next(const char** value); |
82 private: | 85 private: |
83 const Attr* fAttr; | 86 const Attr* fAttr; |
84 const Attr* fStop; | 87 const Attr* fStop; |
85 }; | 88 }; |
86 | 89 |
87 SkDEBUGCODE(void dump(const Node* node = NULL, int tabLevel = 0) const;) | 90 SkDEBUGCODE(void dump(const Node* node = NULL, int tabLevel = 0) const;) |
88 SkDEBUGCODE(static void UnitTest();) | |
89 | 91 |
90 private: | 92 private: |
91 SkChunkAlloc fAlloc; | 93 SkChunkAlloc fAlloc; |
92 Node* fRoot; | 94 Node* fRoot; |
93 SkAutoTDelete<SkDOMParser> fParser; | 95 SkAutoTDelete<SkDOMParser> fParser; |
94 | 96 |
95 friend class AttrIter; | 97 typedef SkNoncopyable INHERITED; |
96 friend class SkDOMParser; | |
97 }; | 98 }; |
98 | 99 |
99 #endif | 100 #endif |
OLD | NEW |