1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24#ifndef __com_sun_star_uri_XUriReference_idl__
25#define __com_sun_star_uri_XUriReference_idl__
26
27#include <com/sun/star/uno/XInterface.idl>
28
29module com { module sun { module star { module uri {
30
31/**
32   represents generic, mutable URI references.
33
34   <p>See <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC&nbsp;2396</a> for a
35   description of URI references and related terms.</p>
36
37   <p>This interface only handles generic URI references (both absolute and
38   relative).  For specific URI schemes, there will be additional interfaces
39   that offer extra, scheme-specific functionality.</p>
40
41   @see com::sun::star::uri::UriReferenceFactory
42   which allows to create URI reference objects that support
43   <type scope="com::sun::star::uri">XUriReference</type> and additional,
44   scheme-specific interfaces.
45
46   @since OpenOffice 2.0
47 */
48published interface XUriReference: com::sun::star::uno::XInterface {
49    /**
50       returns the textual representation of the complete URI reference.
51
52       @returns
53       the textual representation of the complete URI reference.  The exact
54       spelling of the URI reference is retained.
55     */
56    string getUriReference();
57
58    /**
59       returns whether this URI reference is absolute or relative.
60
61       @returns
62       <TRUE/> if this URI reference is absolute, <FALSE/> if it is relative.
63     */
64    boolean isAbsolute();
65
66    /**
67       returns the scheme part of this (absolute) URI reference.
68
69       @returns
70       the textual representation of the scheme part (with the exact spelling
71       retained; without the delimiting &ldquo;<code>:</code>&rdquo;), if this
72       is an absolute URI reference; otherwise, an empty <atom>string</atom> is
73       returned.
74     */
75    string getScheme();
76
77    /**
78       returns the scheme-specific part of this URI reference.
79
80       <p>For an absolute URI reference, the scheme-specific part is everything
81       after the scheme part and the delimiting &ldquo;<code>:</code>&rdquo;,
82       and before the optional &ldquo;<code>#</code>&rdquo; and fragment part.
83       For a relative URI reference, the scheme-specific part is everything
84       before the optional &ldquo;<code>#</code>&rdquo; and fragment part.</p>
85
86       @returns
87       the textual representation of the scheme-specific part (with the exact
88       spelling retained).
89     */
90    string getSchemeSpecificPart();
91
92    /**
93       returns whether this URI reference is hierarchical or opaque.
94
95       <p>An absolute URI reference is hierarchical if its scheme-specific part
96       starts with &ldquo;<code>/</code>&rdquo;.  A relative URI reference is
97       always hierarchical.</p>
98
99       @returns
100       <TRUE/> if this URI reference is hierarchical, <FALSE/> if it is opaque.
101     */
102    boolean isHierarchical();
103
104    /**
105       returns whether this (hierarchical) URI reference has an authority part.
106
107       @returns
108       <TRUE/> if this URI reference is hierarchical and has an authority part.
109     */
110    boolean hasAuthority();
111
112    /**
113       returns the authority part of this (hierarchical) URI reference.
114
115       @returns
116       the textual representation of the authority part (with the exact spelling
117       retained), if this is a hierarchical URI reference that has an authority
118       part; otherwise, an empty <atom>string</atom> is returned.
119     */
120    string getAuthority();
121
122    /**
123       returns the path part of this URI reference.
124
125       @returns
126       the textual representation of the path part (with the exact spelling
127       retained), if this is a hierarchical URI reference; for an opaque URI
128       reference, the scheme-specific part (with the exact spelling retained) is
129       returned.
130     */
131    string getPath();
132
133    /**
134       returns whether this (relative) URI reference has a relative path.
135
136       @returns
137       <TRUE/> if this URI reference is relative and has a relative path.
138     */
139    boolean hasRelativePath();
140
141    /**
142       returns the number of path segments of this (hierarchical) URI reference.
143
144       <p>For an opaque URI reference, and for a hierarchical URI reference with
145       an empty path, the number of path segments is zero.  For a hierarchical
146       URI reference with an absolute, non-empty path, the number of path
147       segments equals the number of &ldquo;<code>/</code>&rdquo; delimiters.
148       For a hierarchical URI reference with a relative, non-empty path, the
149       number of path segments equals the number of &ldquo;<code>/</code>&rdquo;
150       delimiters, plus one.</p>
151
152       @returns
153       the number of path segments.
154     */
155    long getPathSegmentCount();
156
157    /**
158       returns a given path segment of this (hierarchical) URI reference.
159
160       @param index
161       the index of the path segment, starting at zero.
162
163       @returns
164       the textual representation of the given path segment (with the exact
165       spelling retained, without any delimiting &ldquo;<code>/</code>&rdquo;),
166       if this URI reference is hierarchical and has that many path segments;
167       otherwise, and in particular if <code>index</code> is negative, an empty
168       <atom>string</atom> is returned.
169     */
170    string getPathSegment([in] long index);
171
172    /**
173       returns whether this (hierarchical) URI reference has a query part.
174
175       @returns
176       <TRUE/> if this URI reference is hierarchical and has a query part.
177     */
178    boolean hasQuery();
179
180    /**
181       returns the query part of this (hierarchical) URI reference.
182
183       @returns
184       the textual representation of the query part (with the exact spelling
185       retained; without the delimiting &ldquo;<code>?</code>&rdquo;), if this
186       is a hierarchical URI reference that has a query part; otherwise, an
187       empty <atom>string</atom> is returned.
188     */
189    string getQuery();
190
191    /**
192       returns whether this URI reference has a fragment part.
193
194       @returns
195       <TRUE/> if this URI reference has a fragment part.
196     */
197    boolean hasFragment();
198
199    /**
200       returns the fragment part of this URI reference.
201
202       @returns
203       the textual representation of the fragment part (with the exact spelling
204       retained; without the delimiting &ldquo;<code>#</code>&rdquo;), if this
205       is a URI reference that has a fragment part; otherwise, an empty
206       <atom>string</atom> is returned.
207     */
208    string getFragment();
209
210    /**
211       sets the fragment part of this URI reference.
212
213       @param fragment
214       the textual representation of the new fragment part.  The exact spelling
215       will be preserved, and no escaping is performed.
216     */
217    void setFragment([in] string fragment);
218
219    /**
220       clears the fragment part of this URI reference.
221     */
222    void clearFragment();
223};
224
225}; }; }; };
226
227#endif
228