Xerces-C++  3.2.3
XMLURL.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /*
19  * $Id$
20  */
21 
22 #if !defined(XERCESC_INCLUDE_GUARD_XMLURL_HPP)
23 #define XERCESC_INCLUDE_GUARD_XMLURL_HPP
24 
26 
28 
29 class BinInputStream;
30 
31 //
32 // This class supports file, http, and ftp style URLs. All others are
33 // rejected
34 //
36 {
37 public:
38  // -----------------------------------------------------------------------
39  // Class types
40  //
41  // And they must remain in this order because they are indexes into an
42  // array internally!
43  // -----------------------------------------------------------------------
44  enum Protocols
45  {
46  File
47  , HTTP
48  , FTP
49  , HTTPS
50 
51  , Protocols_Count
52  , Unknown
53  };
54 
55 
56  // -----------------------------------------------------------------------
57  // Public static methods
58  // -----------------------------------------------------------------------
59  static Protocols lookupByName(const XMLCh* const protoName);
60  static bool parse(const XMLCh* const urlText, XMLURL& xmlURL);
61 
62  // -----------------------------------------------------------------------
63  // Constructors and Destructor
64  // -----------------------------------------------------------------------
67  (
68  const XMLCh* const baseURL
69  , const XMLCh* const relativeURL
71  );
73  (
74  const XMLCh* const baseURL
75  , const char* const relativeURL
77  );
79  (
80  const XMLURL& baseURL
81  , const XMLCh* const relativeURL
82  );
84  (
85  const XMLURL& baseURL
86  , const char* const relativeURL
87  );
89  (
90  const XMLCh* const urlText
92  );
94  (
95  const char* const urlText
97  );
98  XMLURL(const XMLURL& toCopy);
99  virtual ~XMLURL();
100 
101 
102  // -----------------------------------------------------------------------
103  // Operators
104  // -----------------------------------------------------------------------
105  XMLURL& operator=(const XMLURL& toAssign);
106  bool operator==(const XMLURL& toCompare) const;
107  bool operator!=(const XMLURL& toCompare) const;
108 
109 
110  // -----------------------------------------------------------------------
111  // Getter methods
112  // -----------------------------------------------------------------------
113  const XMLCh* getFragment() const;
114  const XMLCh* getHost() const;
115  const XMLCh* getPassword() const;
116  const XMLCh* getPath() const;
117  unsigned int getPortNum() const;
118  Protocols getProtocol() const;
119  const XMLCh* getProtocolName() const;
120  const XMLCh* getQuery() const;
121  const XMLCh* getURLText() const;
122  const XMLCh* getUser() const;
123  MemoryManager* getMemoryManager() const;
124 
125 
126  // -----------------------------------------------------------------------
127  // Setter methods
128  // -----------------------------------------------------------------------
129  void setURL(const XMLCh* const urlText);
130  void setURL
131  (
132  const XMLCh* const baseURL
133  , const XMLCh* const relativeURL
134  );
135  void setURL
136  (
137  const XMLURL& baseURL
138  , const XMLCh* const relativeURL
139  );
140  // a version of setURL that doesn't throw malformed url exceptions
141  bool setURL(
142