Code

9305a553a24b61119f5635d6c7dc05e6485d1e66
[inkscape.git] / src / dom / svg / svgparser.h
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  */
34 #include "svgimpl.h"
36 namespace org
37 {
38 namespace w3c
39 {
40 namespace dom
41 {
42 namespace svg
43 {
46 class SvgParser
47 {
48 public:
50     /**
51      *
52      */
53     SvgParser()
54         {
55         }
57     /**
58      *
59      */
60     SvgParser(const SvgParser &other)
61         {
62         }
64     /**
65      *
66      */
67     virtual ~SvgParser()
68         {
69         }
71     /**
72      *
73      */
74     SVGDocumentPtr parse(const DocumentPtr sourceDoc);
79 protected:
81     /**
82      *  Get the next character in the parse buf,  0 if out
83      *  of range
84      */
85     XMLCh get(int p);
87     /**
88      *  Test if the given substring exists at the given position
89      *  in parsebuf.  Use get() in case of out-of-bounds
90      */
91     bool match(int pos, char *str);
93     /**
94      *
95      */
96     int skipwhite(int p);
98     /**
99      * get a word from the buffer
100      */
101     int getWord(int p, DOMString &result);
103     /**
104      * get a word from the buffer
105      */
106     int getNumber(int p0, double &result);
109     /**
110      *
111      */
112     bool parseTransform(const DOMString &str);
115     /**
116      *
117      */
118     bool parseElement(SVGElementImplPtr destElem,
119                           ElementImplPtr sourceElem);
122     /**
123      *
124      */
125     void error(char *format, ...);
129     DOMString parsebuf;
130     int parselen;
131     int lastPosition;
133     SVGDocumentImplPtr doc;
135 };
141 }  //namespace svg
142 }  //namespace dom
143 }  //namespace w3c
144 }  //namespace org
146 #endif /* __SVGPARSER_H__ */
147 /*#########################################################################
148 ## E N D    O F    F I L E
149 #########################################################################*/