Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


XalanParsedURI.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #if !defined(XALANPARSEDURI_HEADER_GUARD_1357924680)
20 #define XALANPARSEDURI_HEADER_GUARD_1357924680
21 
22 
23 
24 // Base include file. Must be first.
26 
27 
28 
30 
31 
32 
33 
34 XALAN_CPP_NAMESPACE_BEGIN
35 
36 
37 
38 /**
39  * URI handling (hopefully) according to RFC2396.
40  */
42 {
43 public:
44 
45  // Flags to say if a component is defined. Note that each component may
46  // be defined but empty, except for the path.
47 #if defined(XALAN_INLINE_INITIALIZATION)
48  static const int d_scheme = 1;
49  static const int d_authority = 2;
50  static const int d_query = 4;
51  static const int d_fragment = 8;
52 #else
54  {
55  d_scheme = 1,
56  d_authority = 2,
57  d_query = 4,
58  d_fragment = 8
59  };
60 #endif
61 
62  /**
63  * Default constructor
64  */
65  XalanParsedURI(MemoryManager& theManager) :
66  m_scheme(theManager),
67  m_authority(theManager),
68  m_path(theManager),
69  m_query(theManager),
70  m_fragment(theManager),
71  m_defined(0)
72  {
73  }
74 
75  /**
76  * Constructor which parses the passed in uri
77  *
78  * @param uriString URI to parse
79  * @param uriStringLen Length of the URI string
80  */
82  const XalanDOMChar* uriString,
83  XalanDOMString::size_type uriStringLen,
84  MemoryManager& theManager) :
85  m_scheme(theManager),
86  m_authority(theManager),
87  m_path(theManager),
88  m_query(theManager),
89  m_fragment(theManager),
90  m_defined(0)
91  {
92  parse(uriString, uriStringLen);
93  }
94 
95  /**
96  * Constructor which parses the passed in uri
97  *
98  * @param uriString URI to parse
99  */
101  const XalanDOMString &uriString,
102  MemoryManager& theManager) :
103  m_scheme(theManager),
104  m_authority(theManager),
105  m_path(theManager),
106  m_query(theManager),
107  m_fragment(theManager),
108  m_defined(0)
109  {
110  parse(uriString.c_str(), uriString.length());
111  }
112 
113  MemoryManager&
115  {
116  return m_scheme.getMemoryManager();
117  }
118 
119  /**
120  * Parse the passed in uri
121  *
122  * @param uriString URI to parse
123  * @param uriStringLen Length of the URI string
124  */
125  void parse(
126  const XalanDOMChar* uriString,
127  XalanDOMString::size_type uriStringLen);
128 
129  /**
130  * Parse the passed in uri
131  *
132  * @param uriString URI to parse
133  * @param uriStringLen Length of the URI string
134  */
135  void parse(
136  const XalanDOMString &uriString)
137  {
138  parse(uriString.c_str(), uriString.length());
139  }
140 
141  /**
142  * Reassemble the uri components to make a complete URI
143  *
144  * @return The reassembled URI
145  */
146  XalanDOMString& make(XalanDOMString& theResult) const;
147 
148  /**
149  * Resolve this URI relative to another, according to RFC2396.
150  *
151  * @param base The base URI to use during resolution.
152  */
153  void resolve(const XalanParsedURI &base);
154 
155  /**
156  * Resolve this URI relative to another.
157  *
158  * @param base The base URI string
159  * @param baseLen The length of the base URI
160  */
161  void resolve(
162  const XalanDOMChar *base,
163  const XalanDOMString::size_type baseLen)
164  {
165  XalanParsedURI baseURI(base, baseLen,getMemoryManager());
166 
167  resolve(baseURI);
168  }
169 
170  /**
171  * Resolve this URI relative to another.
172  *
173  * @param base The base URI string
174  */
175  void resolve(
176  const XalanDOMString &base)
177  {
178  resolve(base.c_str(), base.length());
179  }
180 
181  /**
182  * Resolve the one URI relative to another.
183  *
184  * @relative The URI string to resolve
185  * @relativeLen The lengh of the relative URI string
186  * @base The base URI string
187  * @baseLen The length of the base URI string
188  *
189  */
190  static XalanDOMString& resolve(
191  const XalanDOMChar *relative,
192  XalanDOMString::size_type relativeLen,
193  const XalanDOMChar *base,
195  XalanDOMString& theResult
196  );
197 
198 
199  /**
200  * Resolve the one URI relative to another.
201  *
202  * @relative The URI string to resolve
203  * @base The base URI string
204  *
205  */
207  const XalanDOMString &relative,
208  const XalanDOMString &base,
209  XalanDOMString& theResult
210  )
211  {
212  return resolve(relative.c_str(), relative.length(), base.c_str(), base.length(), theResult);
213  }
214 
215  /**
216  * Get the scheme component
217  */
218  const XalanDOMString& getScheme() const
219  {
220  return m_scheme;
221  }
222 
223  /**
224  * See if the scheme component is defined.
225  */
226  bool isSchemeDefined() const
227  {
228  return m_defined & d_scheme;
229  }
230 
231  /**
232  * Set the scheme component. Also sets the scheme defined flag.
233  */
234  void setScheme(const XalanDOMChar *scheme)
235  {
236  m_scheme = scheme;
237  m_defined |= d_scheme;
238  }
239 
240  /**
241  * Set the scheme component. Also sets the scheme defined flag.
242  */
243  void setScheme(const XalanDOMString &scheme)
244  {
245  m_scheme = scheme;
246  m_defined |= d_scheme;
247  }
248 
249  /**
250  * Get the authority component
251  */
252  const XalanDOMString& getAuthority() const
253  {
254  return m_authority;
255  }
256 
257  /**
258  * See if the authority component is defined.
259  */
260  bool isAuthorityDefined() const
261  {
262  return m_defined & d_authority ? true : false;
263  }
264 
265  /**
266  * Set the authority component. Also sets the authority defined flag.
267  */
268  void setAuthority(const XalanDOMChar *authority)
269  {
270  m_authority = authority;
271  m_defined |= d_authority;
272  }
273 
274  /**
275  * Set the authority component. Also sets the authority defined flag.
276  */
277  void setAuthority(const XalanDOMString &authority)
278  {
279  m_authority = authority;
280  m_defined |= d_authority;
281  }
282 
283  /**
284  * Get the path component
285  */
286  const XalanDOMString& getPath() const
287  {
288  return m_path;
289  }
290 
291  /**
292  * Set the path component.
293  */
294  void setPath(const XalanDOMChar *path)
295  {
296  m_path = path;
297  }
298 
299  /**
300  * Set the path component.
301  */
302  void setPath(const XalanDOMString &path)
303  {
304  m_path = path;
305  }
306 
307  /**
308  * Get function to get the query component
309  */
310  const XalanDOMString& getQuery() const
311  {
312  return m_query;
313  }
314 
315  /**
316  * See if the query component is defined.
317  */
318  bool isQueryDefined() const
319  {
320  return m_defined & d_query ? true : false;
321  }
322 
323  /**
324  * Set the query component. Also sets the query defined flag.
325  */
326  void setQuery(const XalanDOMChar *query)
327  {
328  m_query = query;
329  m_defined |= d_query;
330  }
331 
332  /**
333  * Set the query component. Also sets the query defined flag.
334  */
335  void setQuery(const XalanDOMString &query)
336  {
337  m_query = query;
338  m_defined |= d_query;
339  }
340 
341  /**
342  * Get the fragment component
343  */
344  const XalanDOMString& getFragment() const
345  {
346  return m_fragment;
347  }
348 
349  /**
350  * See if the fragment component is defined.
351  */
352  bool isFragmentDefined() const
353  {
354  return m_defined & d_fragment ? true : false;
355  }
356 
357  /**
358  * Set the fragment component. Also sets the fragment defined flag.
359  */
360  void setFragment(const XalanDOMChar *fragment)
361  {
362  m_fragment = fragment;
363  m_defined |= d_fragment;
364  }
365 
366  /**
367  * Set the fragment component. Also sets the fragment defined flag.
368  */
369  void setFragment(const XalanDOMString &fragment)
370  {
371  m_fragment = fragment;
372  m_defined |= d_fragment;
373  }
374 
375  /**
376  * Get the defined components mask.
377  */
378  unsigned int getDefined() const
379  {
380  return m_defined;
381  }
382 
383  /**
384  * Set the defined components mask.
385  */
386  void setDefined(unsigned int defined)
387  {
388  m_defined = defined;
389  }
390 
391 private:
392  // not implemented
393  XalanParsedURI();
395 
396  XalanDOMString m_scheme;
397  XalanDOMString m_authority;
398  XalanDOMString m_path;
399  XalanDOMString m_query;
400  XalanDOMString m_fragment;
401 
402  unsigned int m_defined;
403 };
404 
405 XALAN_CPP_NAMESPACE_END
406 
407 #endif // XALANPARSEDURI_HEADER_GUARD_1357924680
bool isSchemeDefined() const
See if the scheme component is defined.
void setFragment(const XalanDOMChar *fragment)
Set the fragment component.
MemoryManager & getMemoryManager()
void setQuery(const XalanDOMChar *query)
Set the query component.
void setDefined(unsigned int defined)
Set the defined components mask.
const XalanDOMString & getPath() const
Get the path component.
void setAuthority(const XalanDOMString &authority)
Set the authority component.
const XalanDOMString & getScheme() const
Get the scheme component.
URI handling (hopefully) according to RFC2396.
XalanParsedURI(MemoryManager &theManager)
Default constructor.
XalanSize_t size_type
const XalanDOMChar * c_str() const
void setScheme(const XalanDOMString &scheme)
Set the scheme component.
unsigned int getDefined() const
Get the defined components mask.
bool isQueryDefined() const
See if the query component is defined.
const XalanDOMString & getFragment() const
Get the fragment component.
const XalanDOMString & getQuery() const
Get function to get the query component.
void setFragment(const XalanDOMString &fragment)
Set the fragment component.
size_type length() const
void setQuery(const XalanDOMString &query)
Set the query component.
void setPath(const XalanDOMChar *path)
Set the path component.
XalanParsedURI(const XalanDOMString &uriString, MemoryManager &theManager)
Constructor which parses the passed in uri.
const XalanDOMString & getAuthority() const
Get the authority component.
void resolve(const XalanDOMString &base)
Resolve this URI relative to another.
XalanParsedURI(const XalanDOMChar *uriString, XalanDOMString::size_type uriStringLen, MemoryManager &theManager)
Constructor which parses the passed in uri.
#define XALAN_PLATFORMSUPPORT_EXPORT
void setAuthority(const XalanDOMChar *authority)
Set the authority component.
void setPath(const XalanDOMString &path)
Set the path component.
void parse(const XalanDOMString &uriString)
Parse the passed in uri.
void setScheme(const XalanDOMChar *scheme)
Set the scheme component.
void resolve(const XalanDOMChar *base, const XalanDOMString::size_type baseLen)
Resolve this URI relative to another.
static XalanDOMString & resolve(const XalanDOMString &relative, const XalanDOMString &base, XalanDOMString &theResult)
Resolve the one URI relative to another.
bool isAuthorityDefined() const
See if the authority component is defined.
bool isFragmentDefined() const
See if the fragment component is defined.

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.11
Copyright © 1999-2012 The Apache Software Foundation.
All Rights Reserved.

Apache Logo