Code

add proper unix socket includes
[inkscape.git] / src / dom / uri.h
1 #ifndef __URI_H__
2 #define __URI_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 "dom.h"
37 namespace org
38 {
39 namespace w3c
40 {
41 namespace dom
42 {
45 /**
46  *  A class that implements the W3C URI resource reference.
47  */
48 class URI
49 {
50 public:
52     typedef enum
53         {
54         SCHEME_NONE =0,
55         SCHEME_DATA,
56         SCHEME_HTTP,
57         SCHEME_HTTPS,
58         SCHEME_FTP,
59         SCHEME_FILE,
60         SCHEME_LDAP,
61         SCHEME_MAILTO,
62         SCHEME_NEWS,
63         SCHEME_TELNET
64         } SchemeTypes;
66     /**
67      *
68      */
69     URI();
71     /**
72      *
73      */
74     URI(const DOMString &str);
77     /**
78      *
79      */
80     URI(const char *str);
82     /**
83      * Copy constructor
84      */
85     URI(const URI &other);
87     /**
88      *
89      */
90     virtual ~URI();
92     /**
93      *
94      */
95     virtual bool parse(const DOMString &str);
97     /**
98      *
99      */
100     virtual DOMString toString() const;
102     /**
103      *
104      */
105     virtual int getScheme() const;
107     /**
108      *
109      */
110     virtual DOMString getSchemeStr() const;
112     /**
113      *
114      */
115     virtual DOMString getAuthority() const;
117     /**
118      *  Same as getAuthority, but if the port has been specified
119      *  as host:port , the port will not be included
120      */
121     virtual DOMString getHost() const;
123     /**
124      *
125      */
126     virtual int getPort() const;
128     /**
129      *
130      */
131     virtual DOMString getPath() const;
133     /**
134      *
135      */
136     virtual bool getIsAbsolute() const;
138     /**
139      *
140      */
141     virtual DOMString getQuery() const;
143     /**
144      *
145      */
146     virtual DOMString getFragment() const;
148 private:
150     void init();
152     int scheme;
154     DOMString schemeStr;
156     DOMString authority;
158     bool portSpecified;
160     int port;
162     DOMString path;
164     bool absolute;
166     DOMString query;
168     DOMString fragment;
170     void error(const char *fmt, ...);
172     void trace(const char *fmt, ...);
175     int peek(int p);
177     int match(int p, char *key);
179     int parseScheme(int p);
181     int parseHierarchicalPart(int p0);
183     int parseQuery(int p0);
185     int parseFragment(int p0);
187     int parse(int p);
189     char *parsebuf;
191     int parselen;
193 };
197 }  //namespace dom
198 }  //namespace w3c
199 }  //namespace org
203 #endif /* __URI_H__ */