[971] | 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(GZFILEINPUTSOURCE_H)
|
---|
| 72 | #define GZFILEINPUTSOURCE_H
|
---|
| 73 |
|
---|
| 74 | //#include <xercesc/sax/InputSource.hpp>
|
---|
| 75 | #include <xercesc/framework/LocalFileInputSource.hpp>
|
---|
| 76 |
|
---|
| 77 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 78 |
|
---|
| 79 | class BinInputStream;
|
---|
| 80 |
|
---|
| 81 | /**
|
---|
| 82 | * This class is a derivative of the standard InputSource class. It provides
|
---|
| 83 | * for the parser access to data which is referenced via a local file path,
|
---|
| 84 | * as apposed to remote file or URL. This is the most efficacious mechanism
|
---|
| 85 | * by which local files can be parsed, since the parse knows that it refers
|
---|
| 86 | * to a local file and will make no other attempts to interpret the passed
|
---|
| 87 | * path.
|
---|
| 88 | *
|
---|
| 89 | * The path provided can either be a fully qualified path or a relative path.
|
---|
| 90 | * If relative, it will be completed either relative to a passed base path
|
---|
| 91 | * or relative to the current working directory of the process.
|
---|
| 92 | *
|
---|
| 93 | * As with all InputSource derivatives. The primary objective of an input
|
---|
| 94 | * source is to create an input stream via which the parser can spool in
|
---|
| 95 | * data from the referenced source.
|
---|
| 96 | */
|
---|
| 97 | class /*XMLPARSER_EXPORT*/ GzFileInputSource: public LocalFileInputSource
|
---|
| 98 | {
|
---|
| 99 | public :
|
---|
| 100 | // -----------------------------------------------------------------------
|
---|
| 101 | // Constructors and Destructor
|
---|
| 102 | // -----------------------------------------------------------------------
|
---|
| 103 |
|
---|
| 104 | /** @name Constructors */
|
---|
| 105 | //@{
|
---|
| 106 |
|
---|
| 107 | /**
|
---|
| 108 | * A local file input source requires a path to the file to load. This
|
---|
| 109 | * can be provided either as a fully qualified path, a path relative to
|
---|
| 110 | * the current working directly, or a path relative to a provided base
|
---|
| 111 | * path.
|
---|
| 112 | *
|
---|
| 113 | * The completed path will become the system id of this input source.
|
---|
| 114 | * The constructors don't take any public id for local files, but you
|
---|
| 115 | * still set them via the parent class' setPublicId() method of course.
|
---|
| 116 | *
|
---|
| 117 | * This constructor takes an explicit base path and a possibly relative
|
---|
| 118 | * path. If the relative path is seen to be fully qualified, it is used
|
---|
| 119 | * as is. Otherwise, it is made relative to the passed base path.
|
---|
| 120 | *
|
---|
| 121 | * @param basePath The base path from which the passed relative path
|
---|
| 122 | * will be based, if the relative part is indeed
|
---|
| 123 | * relative.
|
---|
| 124 | *
|
---|
| 125 | * @param relativePath The relative part of the path. It can actually
|
---|
| 126 | * be fully qualified, in which case it is taken
|
---|
| 127 | * as is.
|
---|
| 128 | *
|
---|
| 129 | * @param manager Pointer to the memory manager to be used to
|
---|
| 130 | * allocate objects.
|
---|
| 131 | *
|
---|
| 132 | * @exception XMLException If the path is relative and doesn't properly
|
---|
| 133 | * resolve to a file.
|
---|
| 134 | */
|
---|
| 135 | GzFileInputSource
|
---|
| 136 | (
|
---|
| 137 | const XMLCh* const basePath
|
---|
| 138 | , const XMLCh* const relativePath
|
---|
| 139 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 140 | );
|
---|
| 141 |
|
---|
| 142 | /**
|
---|
| 143 | * This constructor takes a single parameter which is the fully qualified
|
---|
| 144 | * or relative path. If it is fully qualified, it is taken as is. If it is
|
---|
| 145 | * relative, then it is completed relative to the current working directory
|
---|
| 146 | * (or the equivalent on the local host machine.)
|
---|
| 147 | *
|
---|
| 148 | * The completed path will become the system id of this input source.
|
---|
| 149 | * The constructors don't take any public id for local files, but you
|
---|
| 150 | * still set them via the parent class' setPublicId() method of course.
|
---|
| 151 | *
|
---|
| 152 | * @param filePath The relative or fully qualified path.
|
---|
| 153 | *
|
---|
| 154 | * @param manager Pointer to the memory manager to be used to
|
---|
| 155 | * allocate objects.
|
---|
| 156 | *
|
---|
| 157 | * @exception XMLException If the path is relative and doesn't properly
|
---|
| 158 | * resolve to a file.
|
---|
| 159 | */
|
---|
| 160 | GzFileInputSource
|
---|
| 161 | (
|
---|
| 162 | const XMLCh* const filePath
|
---|
| 163 | , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
| 164 | );
|
---|
| 165 | //@}
|
---|
| 166 |
|
---|
| 167 | /** @name Destructor */
|
---|
| 168 | //@{
|
---|
| 169 | ~GzFileInputSource();
|
---|
| 170 | //@}
|
---|
| 171 |
|
---|
| 172 |
|
---|
| 173 | // -----------------------------------------------------------------------
|
---|
| 174 | // Virtual input source interface
|
---|
| 175 | // -----------------------------------------------------------------------
|
---|
| 176 |
|
---|
| 177 | /** @name Virtual methods */
|
---|
| 178 | //@{
|
---|
| 179 |
|
---|
| 180 | /**
|
---|
| 181 | * This method will return a binary input stream derivative that will
|
---|
| 182 | * parse from the local file indicatedby the system id.
|
---|
| 183 | *
|
---|
| 184 | * @return A dynamically allocated binary input stream derivative that
|
---|
| 185 | * can parse from the file indicated by the system id.
|
---|
| 186 | */
|
---|
| 187 | virtual BinInputStream* makeStream() const;
|
---|
| 188 |
|
---|
| 189 | //@}
|
---|
| 190 | private:
|
---|
| 191 | // -----------------------------------------------------------------------
|
---|
| 192 | // Unimplemented constructors and operators
|
---|
| 193 | // -----------------------------------------------------------------------
|
---|
| 194 | GzFileInputSource(const GzFileInputSource&);
|
---|
| 195 | GzFileInputSource& operator=(const GzFileInputSource&);
|
---|
| 196 |
|
---|
| 197 | };
|
---|
| 198 |
|
---|
| 199 | XERCES_CPP_NAMESPACE_END
|
---|
| 200 |
|
---|
| 201 | #endif
|
---|