Xalan-C++ API Reference  1.12.0
URISupport.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 #if !defined(URISUPPORT_HEADER_GUARD_1357924680)
19 #define URISUPPORT_HEADER_GUARD_1357924680
20 
21 
22 
23 // Base include file. Must be first.
25 
26 
27 
28 #include <xercesc/util/XMLURL.hpp>
29 
30 
31 
33 
34 
35 
37 
38 
39 
41 
42 
43 
44 namespace XALAN_CPP_NAMESPACE {
45 
46 
47 
48 typedef xercesc::XMLURL XMLURLType;
49 
50 
51 
53 {
54 public:
55 
57 
58  /**
59  * Determine the fully qualified URI for a string.
60  *
61  * @param urlString string to qualify
62  * @return auto pointer to fully qualified URI
63  */
64  static URLAutoPtrType
65  getURLFromString(const XalanDOMString& urlString,
66  MemoryManager& theManager)
67  {
68  return getURLFromString(urlString.c_str(), theManager);
69  }
70 
71  /**
72  * Determine the fully qualified URI for a string.
73  *
74  * @param urlString string to qualify
75  * @param url to update with the qualified string.
76  */
77  static void
79  const XalanDOMString& urlString,
80  XMLURLType& url,
81  MemoryManager& theManager)
82  {
83  getURLFromString(urlString.c_str(), url, theManager);
84  }
85 
86  /**
87  * Determine the fully qualified URI for a string.
88  *
89  * @param urlString string to qualify
90  * @return auto pointer to fully qualified URI
91  */
92  static URLAutoPtrType
93  getURLFromString(const XalanDOMChar* urlString,
94  MemoryManager& theManager);
95 
96  /**
97  * Determine the fully qualified URI for a string.
98  *
99  * @param urlString string to qualify
100  * @param url to update with the qualified string.
101  */
102  static void
104  const XalanDOMChar* urlString,
105  XMLURLType& url,
106  MemoryManager& theManager)
107  {
108  XalanDOMString buffer(theManager);
109 
110  getURLStringFromString(urlString, buffer);
111 
112  url.setURL(buffer.c_str());
113  }
114 
115  /**
116  * Determine the fully qualified URI for a string.
117  *
118  * @param urlString string to qualify
119  * @param base base location for URI
120  * @return auto pointer to fully qualified URI
121  */
122  static URLAutoPtrType
124  const XalanDOMString& urlString,
125  const XalanDOMString& base,
126  MemoryManager& theManager)
127  {
128  XalanDOMString theResult(theManager);
129 
130  getURLStringFromString(urlString, base, theResult);
131 
132  return getURLFromString(theResult, theManager);
133  }
134 
135  /**
136  * Determine the fully qualified URI for a string.
137  *
138  * @param urlString string to qualify
139  * @param base base location for URI
140  * @return auto pointer to fully qualified URI
141  */
142  static URLAutoPtrType
143  getURLFromString(
144  const XalanDOMChar* urlString,
145  const XalanDOMChar* base);
146 
147 
148  /**
149  * Determine the fully qualified URI for a string.
150  *
151  * @param urlString string to qualify
152  * @return string to fully qualified URI
153  */
154  static void
156  const XalanDOMString& urlString,
157  XalanDOMString& theNormalizedURI)
158  {
159  getURLStringFromString(urlString.c_str(), urlString.length(), theNormalizedURI);
160  }
161 
162 
163  /**
164  * Determine the fully qualified URI for a string.
165  *
166  * @param urlString string to qualify
167  * @param theNormalizedURI fully qualified URI
168  */
169  static void
171  const XalanDOMChar* urlString,
172  XalanDOMString& theNormalizedURI)
173  {
174  assert(urlString != 0);
175 
176  getURLStringFromString(
177  urlString,
178  XalanDOMString::length(urlString),
179  theNormalizedURI);
180  }
181 
182  /**
183  * Determine the fully qualified URI for a string.
184  *
185  * @param urlString string to qualify
186  * @param len the length of urlString
187  * @param theNormalizedURI fully qualified URI
188  */
189  static void
190  getURLStringFromString(
191  const XalanDOMChar* urlString,
193  XalanDOMString& theNormalizedURI);
194 
195  /**
196  * Determine the fully qualified URI for a string.
197  *
198  * @param urlString string to qualify
199  * @param base base location for URI
200  * @param theNormalizedURI fully qualified URI
201  */
202  static void
204  const XalanDOMString& urlString,
205  const XalanDOMString& base,
206  XalanDOMString& theNormalizedURI)
207  {
208  getURLStringFromString(urlString.c_str(), base.c_str(), theNormalizedURI);
209  }
210 
211 
212  /**
213  * Determine the fully qualified URI for a string.
214  *
215  * @param urlString string to qualify
216  * @param base base location for URI
217  * @param theNormalizedURI fully qualified URI
218  */
219  static void
221  const XalanDOMChar* urlString,
222  const XalanDOMChar* base,
223  XalanDOMString& theNormalizedURI)
224  {
225  assert(urlString != 0 && base != 0);
226 
227  getURLStringFromString(
228  urlString,
229  XalanDOMString::length(urlString),
230  base,
232  theNormalizedURI);
233  }
234 
235  /**
236  * Determine the fully qualified URI for a string.
237  *
238  * @param urlString string to qualify
239  * @param base base location for URI
240  * @param theNormalizedURI fully qualified URI
241  */
242  static void
243  getURLStringFromString(
244  const XalanDOMChar* urlString,
245  XalanDOMString::size_type urlStringLen,
246  const XalanDOMChar* base,
248  XalanDOMString& theNormalizedURI);
249 
250  /**
251  * Normalizes the string passed in, replacing
252  * \ with /.
253  *
254  * @param urlString string to normalize
255  * @return a reference to the passed parameter
256  */
257  static XalanDOMString&
258  NormalizeURIText(XalanDOMString& uriString);
259 
260  /**
261  * Normalizes the string passed in, replacing
262  * \ with /.
263  *
264  * @param urlString string to normalize
265  * @return a copy of the normalized URI
266  */
267 
268 
270  {
271  public:
272 
273  /**
274  * Construct an InvalidURIException.
275  *
276  * @param theMessage the error message
277  */
279  const XalanDOMString& theMessage,
280  MemoryManager& theManager,
281  const Locator* theLocator);
282 
283  /**
284  * Construct an InvalidURIException.
285  *
286  * @param theMessage the error message
287  */
289  const XalanDOMString& theMessage,
290  MemoryManager& theManager);
291 
292  virtual
294 
295  virtual const XalanDOMChar*
296  getType() const;
297 
298  private:
299  };
300 
301 
302  static const XalanDOMChar s_fileProtocolString1[];
303 
304  static const XalanDOMChar s_fileProtocolString2[];
305 };
306 
307 
308 
309 }
310 
311 
312 
313 #endif // URISUPPORT_HEADER_GUARD_1357924680
XALAN_CPP_NAMESPACE
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
Definition: XalanVersion.hpp:76
XalanDOMString.hpp
xalanc::URISupport::URLAutoPtrType
XalanAutoPtr< XMLURLType > URLAutoPtrType
Definition: URISupport.hpp:56
xalanc::URISupport::getURLStringFromString
static void getURLStringFromString(const XalanDOMChar *urlString, const XalanDOMChar *base, XalanDOMString &theNormalizedURI)
Determine the fully qualified URI for a string.
Definition: URISupport.hpp:220
xalanc::URISupport::getURLFromString
static URLAutoPtrType getURLFromString(const XalanDOMString &urlString, MemoryManager &theManager)
Determine the fully qualified URI for a string.
Definition: URISupport.hpp:65
xalanc::URISupport::getURLStringFromString
static void getURLStringFromString(const XalanDOMString &urlString, XalanDOMString &theNormalizedURI)
Determine the fully qualified URI for a string.
Definition: URISupport.hpp:155
XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_PLATFORMSUPPORT_EXPORT
Definition: PlatformSupportDefinitions.hpp:35
PlatformSupportDefinitions.hpp
xalanc::URISupport::InvalidURIException
Normalizes the string passed in, replacing \ with /.
Definition: URISupport.hpp:269
xalanc::URISupport::getURLFromString
static void getURLFromString(const XalanDOMChar *urlString, XMLURLType &url, MemoryManager &theManager)
Determine the fully qualified URI for a string.
Definition: URISupport.hpp:103
xalanc::XSLException
Definition: XSLException.hpp:42
xalanc::URISupport::getURLStringFromString
static void getURLStringFromString(const XalanDOMChar *urlString, XalanDOMString &theNormalizedURI)
Determine the fully qualified URI for a string.
Definition: URISupport.hpp:170
xalanc::XalanDOMString::length
size_type length() const
Definition: XalanDOMString.hpp:209
xalanc::XalanAutoPtr
Definition: XalanAutoPtr.hpp:40
xalanc::length
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
Definition: DOMStringHelper.hpp:235
xalanc::XMLURLType
xercesc::XMLURL XMLURLType
Definition: URISupport.hpp:48
XalanAutoPtr.hpp
XSLException.hpp
xalanc::URISupport
Definition: URISupport.hpp:52
xalanc::XalanDOMString::c_str
const XalanDOMChar * c_str() const
Definition: XalanDOMString.hpp:344
xalanc::URISupport::getURLFromString
static void getURLFromString(const XalanDOMString &urlString, XMLURLType &url, MemoryManager &theManager)
Determine the fully qualified URI for a string.
Definition: URISupport.hpp:78
xalanc::XalanDOMString::size_type
XalanSize_t size_type
Definition: XalanDOMString.hpp:57
xalanc::URISupport::getURLFromString
static URLAutoPtrType getURLFromString(const XalanDOMString &urlString, const XalanDOMString &base, MemoryManager &theManager)
Determine the fully qualified URI for a string.
Definition: URISupport.hpp:123
xalanc::URISupport::getURLStringFromString
static void getURLStringFromString(const XalanDOMString &urlString, const XalanDOMString &base, XalanDOMString &theNormalizedURI)
Determine the fully qualified URI for a string.
Definition: URISupport.hpp:203
xalanc::XalanDOMString
Definition: XalanDOMString.hpp:45