source: NonGTP/Xerces/xerces/include/xercesc/framework/LocalFileInputSource.hpp @ 358

Revision 358, 7.4 KB checked in by bittner, 19 years ago (diff)

xerces added

Line 
1/*
2 * Copyright 1999-2000,2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * $Log: LocalFileInputSource.hpp,v $
19 * Revision 1.6  2004/09/08 13:55:57  peiyongz
20 * Apache License Version 2.0
21 *
22 * Revision 1.5  2004/01/29 11:46:29  cargilld
23 * Code cleanup changes to get rid of various compiler diagnostic messages.
24 *
25 * Revision 1.4  2003/12/01 23:23:25  neilg
26 * fix for bug 25118; thanks to Jeroen Witmond
27 *
28 * Revision 1.3  2003/05/16 21:36:55  knoaman
29 * Memory manager implementation: Modify constructors to pass in the memory manager.
30 *
31 * Revision 1.2  2002/11/04 15:00:21  tng
32 * C++ Namespace Support.
33 *
34 * Revision 1.1.1.1  2002/02/01 22:21:50  peiyongz
35 * sane_include
36 *
37 * Revision 1.7  2001/10/13 04:21:53  jasons
38 * This patch resolves bug #2409: undocumented XMLException in LocalFileInputSource::new()
39 *
40 * Revision 1.6  2000/12/14 18:49:53  tng
41 * Fix API document generation warning: "Warning: end of member group without matching begin"
42 *
43 * Revision 1.5  2000/02/24 20:00:22  abagchi
44 * Swat for removing Log from API docs
45 *
46 * Revision 1.4  2000/02/15 23:59:06  roddey
47 * More updated documentation of Framework classes.
48 *
49 * Revision 1.3  2000/02/15 01:21:30  roddey
50 * Some initial documentation improvements. More to come...
51 *
52 * Revision 1.2  2000/02/06 07:47:46  rahulj
53 * Year 2K copyright swat.
54 *
55 * Revision 1.1  2000/01/12 18:58:06  roddey
56 * Putting this back with the correct lower case extension.
57 *
58 * Revision 1.1  2000/01/12 00:13:26  roddey
59 * These were moved from internal/ to framework/, which was something that should have
60 * happened long ago. They are really framework type of classes.
61 *
62 * Revision 1.1.1.1  1999/11/09 01:08:10  twl
63 * Initial checkin
64 *
65 * Revision 1.2  1999/11/08 20:44:43  rahul
66 * Swat for adding in Product name and CVS comment log variable.
67 *
68 */
69
70
71#if !defined(LOCALFILEINPUTSOURCE_HPP)
72#define LOCALFILEINPUTSOURCE_HPP
73
74#include <xercesc/sax/InputSource.hpp>
75
76XERCES_CPP_NAMESPACE_BEGIN
77
78class BinInputStream;
79
80/**
81 *  This class is a derivative of the standard InputSource class. It provides
82 *  for the parser access to data which is referenced via a local file path,
83 *  as apposed to remote file or URL. This is the most efficacious mechanism
84 *  by which local files can be parsed, since the parse knows that it refers
85 *  to a local file and will make no other attempts to interpret the passed
86 *  path.
87 *
88 *  The path provided can either be a fully qualified path or a relative path.
89 *  If relative, it will be completed either relative to a passed base path
90 *  or relative to the current working directory of the process.
91 *
92 *  As with all InputSource derivatives. The primary objective of an input
93 *  source is to create an input stream via which the parser can spool in
94 *  data from the referenced source.
95 */
96class XMLPARSER_EXPORT LocalFileInputSource : public InputSource
97{
98public :
99    // -----------------------------------------------------------------------
100    //  Constructors and Destructor
101    // -----------------------------------------------------------------------
102
103    /** @name Constructors */
104    //@{
105
106    /**
107      * A local file input source requires a path to the file to load. This
108      * can be provided either as a fully qualified path, a path relative to
109      * the current working directly, or a path relative to a provided base
110      * path.
111      *
112      * The completed path will become the system id of this input source.
113      * The constructors don't take any public id for local files, but you
114      * still set them via the parent class' setPublicId() method of course.
115      *
116      * This constructor takes an explicit base path and a possibly relative
117      * path. If the relative path is seen to be fully qualified, it is used
118      * as is. Otherwise, it is made relative to the passed base path.
119      *
120      * @param  basePath    The base path from which the passed relative path
121      *                     will be based, if the relative part is indeed
122      *                     relative.
123      *
124      * @param  relativePath    The relative part of the path. It can actually
125      *                         be fully qualified, in which case it is taken
126      *                         as is.
127      *
128      * @param  manager    Pointer to the memory manager to be used to
129      *                    allocate objects.
130      *
131      * @exception XMLException If the path is relative and doesn't properly
132      *            resolve to a file.
133      */
134    LocalFileInputSource
135    (
136        const   XMLCh* const   basePath
137        , const XMLCh* const   relativePath
138        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
139    );
140
141    /**
142      * This constructor takes a single parameter which is the fully qualified
143      * or relative path. If it is fully qualified, it is taken as is. If it is
144      * relative, then it is completed relative to the current working directory
145      * (or the equivalent on the local host machine.)
146      *
147      * The completed path will become the system id of this input source.
148      * The constructors don't take any public id for local files, but you
149      * still set them via the parent class' setPublicId() method of course.
150      *
151      * @param  filePath    The relative or fully qualified path.
152      *
153      * @param  manager     Pointer to the memory manager to be used to
154      *                     allocate objects.
155      *
156      * @exception XMLException If the path is relative and doesn't properly
157      *            resolve to a file.
158      */
159    LocalFileInputSource
160    (
161        const   XMLCh* const   filePath
162        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
163    );
164    //@}
165
166    /** @name Destructor */
167    //@{
168    ~LocalFileInputSource();
169    //@}
170
171
172    // -----------------------------------------------------------------------
173    //  Virtual input source interface
174    // -----------------------------------------------------------------------
175
176    /** @name Virtual methods */
177    //@{
178
179    /**
180    * This method will return a binary input stream derivative that will
181    * parse from the local file indicatedby the system id.
182    *
183    * @return A dynamically allocated binary input stream derivative that
184    *         can parse from the file indicated by the system id.
185    */
186    virtual BinInputStream* makeStream() const;
187
188    //@}
189private:
190    // -----------------------------------------------------------------------
191    //  Unimplemented constructors and operators
192    // -----------------------------------------------------------------------
193    LocalFileInputSource(const LocalFileInputSource&);
194    LocalFileInputSource& operator=(const LocalFileInputSource&);
195
196};
197
198XERCES_CPP_NAMESPACE_END
199
200#endif
Note: See TracBrowser for help on using the repository browser.