/usr/include/xercesc/util/XMLURL.hpp is in libxerces-c2-dev 2.8.0+deb1-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: XMLURL.hpp 568078 2007-08-21 11:43:25Z amassari $
*/
#if !defined(XMLURL_HPP)
#define XMLURL_HPP
#include <xercesc/util/PlatformUtils.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class BinInputStream;
//
// This class supports file, http, and ftp style URLs. All others are
// rejected
//
class XMLUTIL_EXPORT XMLURL : public XMemory
{
public:
// -----------------------------------------------------------------------
// Class types
//
// And they must remain in this order because they are indexes into an
// array internally!
// -----------------------------------------------------------------------
enum Protocols
{
File
, HTTP
, FTP
, HTTPS
, Protocols_Count
, Unknown
};
// -----------------------------------------------------------------------
// Public static methods
// -----------------------------------------------------------------------
static Protocols lookupByName(const XMLCh* const protoName);
static bool parse(const XMLCh* const urlText, XMLURL& xmlURL);
// -----------------------------------------------------------------------
// Constructors and Destructor
// -----------------------------------------------------------------------
XMLURL(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
XMLURL
(
const XMLCh* const baseURL
, const XMLCh* const relativeURL
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
XMLURL
(
const XMLCh* const baseURL
, const char* const relativeURL
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
XMLURL
(
const XMLURL& baseURL
, const XMLCh* const relativeURL
);
XMLURL
(
const XMLURL& baseURL
, const char* const relativeURL
);
XMLURL
(
const XMLCh* const urlText
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
XMLURL
(
const char* const urlText
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
XMLURL(const XMLURL& toCopy);
virtual ~XMLURL();
// -----------------------------------------------------------------------
// Operators
// -----------------------------------------------------------------------
XMLURL& operator=(const XMLURL& toAssign);
bool operator==(const XMLURL& toCompare) const;
bool operator!=(const XMLURL& toCompare) const;
// -----------------------------------------------------------------------
// Getter methods
// -----------------------------------------------------------------------
const XMLCh* getFragment() const;
const XMLCh* getHost() const;
const XMLCh* getPassword() const;
const XMLCh* getPath() const;
unsigned int getPortNum() const;
Protocols getProtocol() const;
const XMLCh* getProtocolName() const;
const XMLCh* getQuery() const;
const XMLCh* getURLText() const;
const XMLCh* getUser() const;
MemoryManager* getMemoryManager() const;
// -----------------------------------------------------------------------
// Setter methods
// -----------------------------------------------------------------------
void setURL(const XMLCh* const urlText);
void setURL
(
const XMLCh* const baseURL
, const XMLCh* const relativeURL
);
void setURL
(
const XMLURL& baseURL
, const XMLCh* const relativeURL
);
// a version of setURL that doesn't throw malformed url exceptions
bool setURL(
const XMLCh* const baseURL
, const XMLCh* const relativeURL
, XMLURL& xmlURL);
// -----------------------------------------------------------------------
// Miscellaneous methods
// -----------------------------------------------------------------------
bool isRelative() const;
bool hasInvalidChar() const;
BinInputStream* makeNewStream() const;
void makeRelativeTo(const XMLCh* const baseURLText);
void makeRelativeTo(const XMLURL& baseURL);
private:
// -----------------------------------------------------------------------
// Private helper methods
// -----------------------------------------------------------------------
void buildFullText();
void cleanUp();
bool conglomerateWithBase(const XMLURL& baseURL, bool useExceptions=true);
void parse
(
const XMLCh* const urlText
);
// -----------------------------------------------------------------------
// Data members
//
// fFragment
// The fragment part of the URL, if any. If none, its a null.
//
// fHost
// The host part of the URL that was parsed out. This one will often
// be null (or "localhost", which also means the current machine.)
//
// fPassword
// The password found, if any. If none then its a null.
//
// fPath
// The path part of the URL that was parsed out, if any. If none,
// then its a null.
//
// fPortNum
// The port that was indicated in the URL. If no port was provided
// explicitly, then its left zero.
//
// fProtocol
// Indicates the type of the URL's source. The text of the prefix
// can be gotten from this.
//
// fQuery
// The query part of the URL, if any. If none, then its a null.
//
// fUser
// The username found, if any. If none, then its a null.
//
// fURLText
// This is a copy of the URL text, after it has been taken apart,
// made relative if needed, canonicalized, and then put back
// together. Its only created upon demand.
//
// fHasInvalidChar
// This indicates if the URL Text contains invalid characters as per
// RFC 2396 standard.
// -----------------------------------------------------------------------
MemoryManager* fMemoryManager;
XMLCh* fFragment;
XMLCh* fHost;
XMLCh* fPassword;
XMLCh* fPath;
unsigned int fPortNum;
Protocols fProtocol;
XMLCh* fQuery;
XMLCh* fUser;
XMLCh* fURLText;
bool fHasInvalidChar;
};
// ---------------------------------------------------------------------------
// XMLURL: Public operators
// ---------------------------------------------------------------------------
inline bool XMLURL::operator!=(const XMLURL& toCompare) const
{
return !operator==(toCompare);
}
// ---------------------------------------------------------------------------
// XMLURL: Getter methods
// ---------------------------------------------------------------------------
inline const XMLCh* XMLURL::getFragment() const
{
return fFragment;
}
inline const XMLCh* XMLURL::getHost() const
{
return fHost;
}
inline const XMLCh* XMLURL::getPassword() const
{
return fPassword;
}
inline const XMLCh* XMLURL::getPath() const
{
return fPath;
}
inline XMLURL::Protocols XMLURL::getProtocol() const
{
return fProtocol;
}
inline const XMLCh* XMLURL::getQuery() const
{
return fQuery;
}
inline const XMLCh* XMLURL::getUser() const
{
return fUser;
}
inline const XMLCh* XMLURL::getURLText() const
{
//
// Fault it in if not already. Since this is a const method and we
// can't use mutable members due the compilers we have to support,
// we have to cast off the constness.
//
if (!fURLText)
((XMLURL*)this)->buildFullText();
return fURLText;
}
inline MemoryManager* XMLURL::getMemoryManager() const
{
return fMemoryManager;
}
MakeXMLException(MalformedURLException, XMLUTIL_EXPORT)
XERCES_CPP_NAMESPACE_END
#endif
|