~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/dom/uri.h

  • Committer: ishmal
  • Date: 2006-04-12 13:25:21 UTC
  • Revision ID: ishmal@users.sourceforge.net-20060412132521-5ynoezpwbzq4d1c3
Add new rearranged /dom directory

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef __URI_H__
 
2
#define __URI_H__
 
3
 
 
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
 */
 
32
 
 
33
 
 
34
#include "dom.h"
 
35
 
 
36
 
 
37
namespace org
 
38
{
 
39
namespace w3c
 
40
{
 
41
namespace dom
 
42
{
 
43
 
 
44
 
 
45
/**
 
46
 *  A class that implements the W3C URI resource reference.
 
47
 */
 
48
class URI
 
49
{
 
50
public:
 
51
 
 
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;
 
65
 
 
66
    /**
 
67
     *
 
68
     */
 
69
    URI();
 
70
 
 
71
    /**
 
72
     *
 
73
     */
 
74
    URI(const DOMString &str);
 
75
 
 
76
 
 
77
    /**
 
78
     *
 
79
     */
 
80
    URI(const char *str);
 
81
 
 
82
    /**
 
83
     * Copy constructor
 
84
     */
 
85
    URI(const URI &other);
 
86
 
 
87
    /**
 
88
     *
 
89
     */
 
90
    virtual ~URI();
 
91
 
 
92
    /**
 
93
     *
 
94
     */
 
95
    virtual bool parse(const DOMString &str);
 
96
 
 
97
    /**
 
98
     *
 
99
     */
 
100
    virtual DOMString toString() const;
 
101
 
 
102
    /**
 
103
     *
 
104
     */
 
105
    virtual int getScheme() const;
 
106
 
 
107
    /**
 
108
     *
 
109
     */
 
110
    virtual DOMString getSchemeStr() const;
 
111
 
 
112
    /**
 
113
     *
 
114
     */
 
115
    virtual DOMString getAuthority() const;
 
116
 
 
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;
 
122
 
 
123
    /**
 
124
     *
 
125
     */
 
126
    virtual int getPort() const;
 
127
 
 
128
    /**
 
129
     *
 
130
     */
 
131
    virtual DOMString getPath() const;
 
132
 
 
133
    /**
 
134
     *
 
135
     */
 
136
    virtual bool getIsAbsolute() const;
 
137
 
 
138
    /**
 
139
     *
 
140
     */
 
141
    virtual DOMString getQuery() const;
 
142
 
 
143
    /**
 
144
     *
 
145
     */
 
146
    virtual DOMString getFragment() const;
 
147
 
 
148
private:
 
149
 
 
150
    void init();
 
151
 
 
152
    int scheme;
 
153
 
 
154
    DOMString schemeStr;
 
155
 
 
156
    DOMString authority;
 
157
 
 
158
    bool portSpecified;
 
159
 
 
160
    int port;
 
161
 
 
162
    DOMString path;
 
163
 
 
164
    bool absolute;
 
165
 
 
166
    DOMString query;
 
167
 
 
168
    DOMString fragment;
 
169
 
 
170
    void error(const char *fmt, ...);
 
171
 
 
172
    void trace(const char *fmt, ...);
 
173
 
 
174
 
 
175
    int peek(int p);
 
176
 
 
177
    int match(int p, char *key);
 
178
 
 
179
    int parseScheme(int p);
 
180
 
 
181
    int parseHierarchicalPart(int p0);
 
182
 
 
183
    int parseQuery(int p0);
 
184
 
 
185
    int parseFragment(int p0);
 
186
 
 
187
    int parse(int p);
 
188
 
 
189
    char *parsebuf;
 
190
 
 
191
    int parselen;
 
192
 
 
193
};
 
194
 
 
195
 
 
196
 
 
197
}  //namespace dom
 
198
}  //namespace w3c
 
199
}  //namespace org
 
200
 
 
201
 
 
202
 
 
203
#endif /* __URI_H__ */
 
204