00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 #if !defined(XALANPARSEDURI_HEADER_GUARD_1357924680) 00018 #define XALANPARSEDURI_HEADER_GUARD_1357924680 00019 00020 00021 00022 // Base include file. Must be first. 00023 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp> 00024 00025 00026 00027 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00028 00029 00030 00031 00032 XALAN_CPP_NAMESPACE_BEGIN 00033 00034 00035 00039 class XALAN_PLATFORMSUPPORT_EXPORT XalanParsedURI 00040 { 00041 public: 00042 00043 // Flags to say if a component is defined. Note that each component may 00044 // be defined but empty, except for the path. 00045 #if defined(XALAN_INLINE_INITIALIZATION) 00046 static const int d_scheme = 1; 00047 static const int d_authority = 2; 00048 static const int d_query = 4; 00049 static const int d_fragment = 8; 00050 #else 00051 enum eComponent 00052 { 00053 d_scheme = 1, 00054 d_authority = 2, 00055 d_query = 4, 00056 d_fragment = 8 00057 }; 00058 #endif 00059 00063 XalanParsedURI(MemoryManagerType& theManager) : 00064 m_scheme(theManager), 00065 m_authority(theManager), 00066 m_path(theManager), 00067 m_query(theManager), 00068 m_fragment(theManager), 00069 m_defined(0) 00070 { 00071 } 00072 00079 XalanParsedURI( 00080 const XalanDOMChar* uriString, 00081 XalanDOMString::size_type uriStringLen, 00082 MemoryManagerType& theManager) : 00083 m_scheme(theManager), 00084 m_authority(theManager), 00085 m_path(theManager), 00086 m_query(theManager), 00087 m_fragment(theManager), 00088 m_defined(0) 00089 { 00090 parse(uriString, uriStringLen); 00091 } 00092 00098 XalanParsedURI( 00099 const XalanDOMString &uriString, 00100 MemoryManagerType& theManager) : 00101 m_scheme(theManager), 00102 m_authority(theManager), 00103 m_path(theManager), 00104 m_query(theManager), 00105 m_fragment(theManager), 00106 m_defined(0) 00107 { 00108 parse(uriString.c_str(), uriString.length()); 00109 } 00110 00111 MemoryManagerType& 00112 getMemoryManager() 00113 { 00114 return m_scheme.getMemoryManager(); 00115 } 00116 00123 void parse( 00124 const XalanDOMChar* uriString, 00125 XalanDOMString::size_type uriStringLen); 00126 00133 void parse( 00134 const XalanDOMString &uriString) 00135 { 00136 parse(uriString.c_str(), uriString.length()); 00137 } 00138 00144 XalanDOMString& make(XalanDOMString& theResult) const; 00145 00151 void resolve(const XalanParsedURI &base); 00152 00159 void resolve( 00160 const XalanDOMChar *base, 00161 const XalanDOMString::size_type baseLen) 00162 { 00163 XalanParsedURI baseURI(base, baseLen,getMemoryManager()); 00164 00165 resolve(baseURI); 00166 } 00167 00173 void resolve( 00174 const XalanDOMString &base) 00175 { 00176 resolve(base.c_str(), base.length()); 00177 } 00178 00188 static XalanDOMString& resolve( 00189 const XalanDOMChar *relative, 00190 XalanDOMString::size_type relativeLen, 00191 const XalanDOMChar *base, 00192 XalanDOMString::size_type baseLen, 00193 XalanDOMString& theResult 00194 ); 00195 00196 00204 static XalanDOMString& resolve( 00205 const XalanDOMString &relative, 00206 const XalanDOMString &base, 00207 XalanDOMString& theResult 00208 ) 00209 { 00210 return resolve(relative.c_str(), relative.length(), base.c_str(), base.length(), theResult); 00211 } 00212 00216 const XalanDOMString& getScheme() const 00217 { 00218 return m_scheme; 00219 } 00220 00224 bool isSchemeDefined() const 00225 { 00226 return m_defined & d_scheme; 00227 } 00228 00232 void setScheme(const XalanDOMChar *scheme) 00233 { 00234 m_scheme = scheme; 00235 m_defined |= d_scheme; 00236 } 00237 00241 void setScheme(const XalanDOMString &scheme) 00242 { 00243 m_scheme = scheme; 00244 m_defined |= d_scheme; 00245 } 00246 00250 const XalanDOMString& getAuthority() const 00251 { 00252 return m_authority; 00253 } 00254 00258 bool isAuthorityDefined() const 00259 { 00260 return m_defined & d_authority ? true : false; 00261 } 00262 00266 void setAuthority(const XalanDOMChar *authority) 00267 { 00268 m_authority = authority; 00269 m_defined |= d_authority; 00270 } 00271 00275 void setAuthority(const XalanDOMString &authority) 00276 { 00277 m_authority = authority; 00278 m_defined |= d_authority; 00279 } 00280 00284 const XalanDOMString& getPath() const 00285 { 00286 return m_path; 00287 } 00288 00292 void setPath(const XalanDOMChar *path) 00293 { 00294 m_path = path; 00295 } 00296 00300 void setPath(const XalanDOMString &path) 00301 { 00302 m_path = path; 00303 } 00304 00308 const XalanDOMString& getQuery() const 00309 { 00310 return m_query; 00311 } 00312 00316 bool isQueryDefined() const 00317 { 00318 return m_defined & d_query ? true : false; 00319 } 00320 00324 void setQuery(const XalanDOMChar *query) 00325 { 00326 m_query = query; 00327 m_defined |= d_query; 00328 } 00329 00333 void setQuery(const XalanDOMString &query) 00334 { 00335 m_query = query; 00336 m_defined |= d_query; 00337 } 00338 00342 const XalanDOMString& getFragment() const 00343 { 00344 return m_fragment; 00345 } 00346 00350 bool isFragmentDefined() const 00351 { 00352 return m_defined & d_fragment ? true : false; 00353 } 00354 00358 void setFragment(const XalanDOMChar *fragment) 00359 { 00360 m_fragment = fragment; 00361 m_defined |= d_fragment; 00362 } 00363 00367 void setFragment(const XalanDOMString &fragment) 00368 { 00369 m_fragment = fragment; 00370 m_defined |= d_fragment; 00371 } 00372 00376 unsigned int getDefined() const 00377 { 00378 return m_defined; 00379 } 00380 00384 void setDefined(unsigned int defined) 00385 { 00386 m_defined = defined; 00387 } 00388 00389 private: 00390 // not implemented 00391 XalanParsedURI(); 00392 XalanParsedURI(const XalanParsedURI&); 00393 00394 XalanDOMString m_scheme; 00395 XalanDOMString m_authority; 00396 XalanDOMString m_path; 00397 XalanDOMString m_query; 00398 XalanDOMString m_fragment; 00399 00400 unsigned int m_defined; 00401 }; 00402 00403 XALAN_CPP_NAMESPACE_END 00404 00405 #endif // XALANPARSEDURI_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.10 |
|