1 #ifndef __SVGPARSER_H__
2 #define __SVGPARSER_H__
4 /**
5 * Phoebe DOM Implementation.
6 *
7 * This is a C++ approximation of the W3C DOM model, which follows
8 * fairly closely the specifications in the various .idl files, copies of
9 * which are provided for reference. Most important is this one:
10 *
11 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
12 *
13 * Authors:
14 * Bob Jamison
15 *
16 * Copyright (C) 2005 Bob Jamison
17 *
18 * This library is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU Lesser General Public
20 * License as published by the Free Software Foundation; either
21 * version 2.1 of the License, or (at your option) any later version.
22 *
23 * This library is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26 * Lesser General Public License for more details.
27 *
28 * You should have received a copy of the GNU Lesser General Public
29 * License along with this library; if not, write to the Free Software
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 */
33 #include <glib.h>
35 #include "svgimpl.h"
37 namespace org
38 {
39 namespace w3c
40 {
41 namespace dom
42 {
43 namespace svg
44 {
47 class SvgParser
48 {
49 public:
51 /**
52 *
53 */
54 SvgParser()
55 {
56 }
58 /**
59 *
60 */
61 SvgParser(const SvgParser &other)
62 {
63 }
65 /**
66 *
67 */
68 virtual ~SvgParser()
69 {
70 }
72 /**
73 *
74 */
75 SVGDocumentPtr parse(const DocumentPtr sourceDoc);
80 protected:
82 /**
83 * Get the next character in the parse buf, 0 if out
84 * of range
85 */
86 XMLCh get(int p);
88 /**
89 * Test if the given substring exists at the given position
90 * in parsebuf. Use get() in case of out-of-bounds
91 */
92 bool match(int pos, char *str);
94 /**
95 *
96 */
97 int skipwhite(int p);
99 /**
100 * get a word from the buffer
101 */
102 int getWord(int p, DOMString &result);
104 /**
105 * get a word from the buffer
106 */
107 int getNumber(int p0, double &result);
110 /**
111 *
112 */
113 bool parseTransform(const DOMString &str);
116 /**
117 *
118 */
119 bool parseElement(SVGElementImplPtr destElem,
120 ElementImplPtr sourceElem);
123 /**
124 *
125 */
126 void error(char *format, ...) G_GNUC_PRINTF(2,3);
130 DOMString parsebuf;
131 int parselen;
132 int lastPosition;
134 SVGDocumentImplPtr doc;
136 };
142 } //namespace svg
143 } //namespace dom
144 } //namespace w3c
145 } //namespace org
147 #endif /* __SVGPARSER_H__ */
148 /*#########################################################################
149 ## E N D O F F I L E
150 #########################################################################*/