source: trunk/VUT/GtpVisibilityPreprocessor/support/xercesc/framework/URLInputSource.hpp @ 188

Revision 188, 12.0 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1/*
2 * The Apache Software License, Version 1.1
3 *
4 * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
5 * reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in
16 *    the documentation and/or other materials provided with the
17 *    distribution.
18 *
19 * 3. The end-user documentation included with the redistribution,
20 *    if any, must include the following acknowledgment:
21 *       "This product includes software developed by the
22 *        Apache Software Foundation (http://www.apache.org/)."
23 *    Alternately, this acknowledgment may appear in the software itself,
24 *    if and wherever such third-party acknowledgments normally appear.
25 *
26 * 4. The names "Xerces" and "Apache Software Foundation" must
27 *    not be used to endorse or promote products derived from this
28 *    software without prior written permission. For written
29 *    permission, please contact apache\@apache.org.
30 *
31 * 5. Products derived from this software may not be called "Apache",
32 *    nor may "Apache" appear in their name, without prior written
33 *    permission of the Apache Software Foundation.
34 *
35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * SUCH DAMAGE.
47 * ====================================================================
48 *
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Apache Software Foundation, and was
51 * originally based on software copyright (c) 1999, International
52 * Business Machines, Inc., http://www.ibm.com .  For more information
53 * on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57/*
58 * $Log: URLInputSource.hpp,v $
59 * Revision 1.5  2004/01/29 11:46:29  cargilld
60 * Code cleanup changes to get rid of various compiler diagnostic messages.
61 *
62 * Revision 1.4  2003/12/01 23:23:25  neilg
63 * fix for bug 25118; thanks to Jeroen Witmond
64 *
65 * Revision 1.3  2003/05/16 21:36:55  knoaman
66 * Memory manager implementation: Modify constructors to pass in the memory manager.
67 *
68 * Revision 1.2  2002/11/04 15:00:21  tng
69 * C++ Namespace Support.
70 *
71 * Revision 1.1.1.1  2002/02/01 22:21:50  peiyongz
72 * sane_include
73 *
74 * Revision 1.8  2000/12/14 18:49:56  tng
75 * Fix API document generation warning: "Warning: end of member group without matching begin"
76 *
77 * Revision 1.7  2000/02/24 20:00:22  abagchi
78 * Swat for removing Log from API docs
79 *
80 * Revision 1.6  2000/02/15 23:59:07  roddey
81 * More updated documentation of Framework classes.
82 *
83 * Revision 1.5  2000/02/15 01:21:30  roddey
84 * Some initial documentation improvements. More to come...
85 *
86 * Revision 1.4  2000/02/06 07:47:46  rahulj
87 * Year 2K copyright swat.
88 *
89 * Revision 1.3  2000/01/26 18:56:02  roddey
90 * Needed to include XMLURL.hpp so that it compiles standalone.
91 *
92 * Revision 1.2  2000/01/15 01:26:16  rahulj
93 * Added support for HTTP to the parser using libWWW 5.2.8.
94 * Renamed URL.[ch]pp to XMLURL.[ch]pp and like wise for the class name.
95 * Only tested under NT 4.0 SP 5.
96 * Removed URL.hpp from files where it was not used.
97 *
98 * Revision 1.1  2000/01/12 00:13:26  roddey
99 * These were moved from internal/ to framework/, which was something that should have
100 * happened long ago. They are really framework type of classes.
101 *
102 * Revision 1.1.1.1  1999/11/09 01:08:18  twl
103 * Initial checkin
104 *
105 * Revision 1.2  1999/11/08 20:44:44  rahul
106 * Swat for adding in Product name and CVS comment log variable.
107 *
108 */
109
110
111
112#if !defined(URLINPUTSOURCE_HPP)
113#define URLINPUTSOURCE_HPP
114
115#include <xercesc/util/XMLURL.hpp>
116#include <xercesc/sax/InputSource.hpp>
117
118XERCES_CPP_NAMESPACE_BEGIN
119
120class BinInputStream;
121
122/**
123 *  This class is a derivative of the standard InputSource class. It provides
124 *  for the parser access to data which is referenced via a URL, as apposed to
125 *  a local file name. The URL can be provided via an XMLURL class, as a fully
126 *  qualified system id, or a base system id and a system id which may be
127 *  fully qualified or may be relative to the base.
128 *
129 *  As with all InputSource derivatives. The primary objective of an input
130 *  source is to create an input stream via which the parser can spool in
131 *  data from the referenced source.
132 *
133 *  Note that the parse system does not necessarily support URL based XML
134 *  entities out of the box. Support for socket based access is optional and
135 *  controlled by the per-platform support.
136 */
137class XMLPARSER_EXPORT URLInputSource : public InputSource
138{
139public :
140    // -----------------------------------------------------------------------
141    //  Constructors and Destructor
142    // -----------------------------------------------------------------------
143
144    /** @name Constructors */
145    //@{
146
147    /**
148      * This constructor accepts an already built URL. It is assumed that
149      * it is correct and it will be used as is. In this case, no public id
150      * accepted, but it can still be set via the parent class' setPublicId()
151      * method.
152      *
153      * @param  urlId   The URL which holds the system id of the entity
154      *                 to parse.
155      * @param  manager Pointer to the memory manager to be used to
156      *                 allocate objects.
157      */
158    URLInputSource
159    (
160        const XMLURL& urlId
161        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
162    );
163
164
165    /**
166     *  This constructor takes a base system id URL and a possibly relative
167     *  system id. The relative part is parsed and, if it is indeed relative,
168     *  it will be made relative to the passed base id. Otherwise, it will be
169     *  taken as is.
170     *
171     *  @param  baseId      The base system id URL which provides the base
172     *                      for any relative id part.
173     *
174     *  @param  systemId    The possibly relative system id URL. If its relative
175     *                      its based on baseId, else its taken as is.
176     *  @param  manager     Pointer to the memory manager to be used to
177     *                      allocate objects.
178     */
179    URLInputSource
180    (
181        const   XMLCh* const    baseId
182        , const XMLCh* const    systemId
183        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
184    );
185
186    /**
187     *  This constructor is indentical to the previous one, except that it also
188     *  allows you to set a public id if you want to.
189     *
190     *  @param  baseId      The base system id URL which provides the base
191     *                      for any relative id part.
192     *
193     *  @param  systemId    The possibly relative system id URL. If its relative
194     *                      its based on baseId, else its taken as is.
195     *
196     *  @param  publicId    The optional public id to set. This is just passed
197     *                      on to the parent class for storage.
198     *
199     * @param  manager      Pointer to the memory manager to be used to
200     *                      allocate objects.
201     */
202    URLInputSource
203    (
204        const   XMLCh* const    baseId
205        , const XMLCh* const    systemId
206        , const XMLCh* const    publicId
207        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
208    );
209
210
211    /**
212     *  This constructor is identical to the second constructor above, except that
213     *  it accepts the relative system id part as a local code page string and
214     *  just transcodes it internally, as a convenience.
215     *
216     *  @param  baseId      The base system id URL which provides the base
217     *                      for any relative id part.
218     *
219     *  @param  systemId    The possibly relative system id URL. If its relative
220     *                      its based on baseId, else its taken as is.
221     *
222     *  @param  manager     Pointer to the memory manager to be used to
223     *                      allocate objects.
224     */
225    URLInputSource
226    (
227        const   XMLCh* const    baseId
228        , const char* const     systemId
229        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
230    );
231
232    /**
233     *  This constructor is identical to the third constructor above, except that
234     *  it accepts the relative and public ids as local code page strings and just
235     *  transcodes them internally, as a convenience.
236     *
237     *  @param  baseId      The base system id URL which provides the base
238     *                      for any relative id part.
239     *
240     *  @param  systemId    The possibly relative system id URL. If its relative
241     *                      its based on baseId, else its taken as is.
242     *
243     *  @param  publicId    The optional public id to set. This is just passed
244     *                      on to the parent class for storage.
245     *                      on to the parent class for storage.
246     *
247     *  @param  manager     Pointer to the memory manager to be used to
248     *                      allocate objects.
249     */
250    URLInputSource
251    (
252        const   XMLCh* const    baseId
253        , const char* const     systemId
254        , const char* const     publicId
255        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
256    );
257
258    //@}
259
260    /** @name Destructor */
261    //@{
262    ~URLInputSource();
263    //@}
264
265
266    // -----------------------------------------------------------------------
267    //  Virtual input source interface
268    // -----------------------------------------------------------------------
269
270    /** @name Virtual methods */
271    //@{
272
273    /**
274     * This method will return a binary input stream derivative that will
275     * parse from the source refered to by the URL system id.
276     */
277    BinInputStream* makeStream() const;
278
279    //@}
280
281
282    // -----------------------------------------------------------------------
283    //  Getter methods
284    // -----------------------------------------------------------------------
285
286    /** @name Getter methods */
287    //@{
288
289    /**
290      * This method will return a const reference to the URL member which
291      * contains the system id in pre-parsed URL form. If you just want the
292      * string format, call getSystemId() on the parent class.
293      *
294      * @return A const reference to a URL object that contains the current
295      *         system id set for this input source.
296      */
297    const XMLURL& urlSrc() const;
298
299    //@}
300
301
302private :
303    // -----------------------------------------------------------------------
304    //  Unimplemented constructors and operators
305    // -----------------------------------------------------------------------   
306    URLInputSource(const URLInputSource&);
307    URLInputSource& operator=(const URLInputSource&);
308
309    // -----------------------------------------------------------------------
310    //  Private data members
311    //
312    //  fURL
313    //      This is the URL created from the passed ids.
314    // -----------------------------------------------------------------------
315    XMLURL fURL;
316};
317
318
319inline const XMLURL& URLInputSource::urlSrc() const
320{
321    return fURL;
322}
323
324XERCES_CPP_NAMESPACE_END
325
326#endif
Note: See TracBrowser for help on using the repository browser.