Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:14:52

0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  * 
0009  *      http://www.apache.org/licenses/LICENSE-2.0
0010  * 
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 /*
0019  * $Id$
0020  */
0021 
0022 
0023 #if !defined(XERCESC_INCLUDE_GUARD_LOCALFILEINPUTSOURCE_HPP)
0024 #define XERCESC_INCLUDE_GUARD_LOCALFILEINPUTSOURCE_HPP
0025 
0026 #include <xercesc/sax/InputSource.hpp>
0027 
0028 XERCES_CPP_NAMESPACE_BEGIN
0029 
0030 class BinInputStream;
0031 
0032 /**
0033  *  This class is a derivative of the standard InputSource class. It provides
0034  *  for the parser access to data which is referenced via a local file path,
0035  *  as apposed to remote file or URL. This is the most efficacious mechanism
0036  *  by which local files can be parsed, since the parse knows that it refers
0037  *  to a local file and will make no other attempts to interpret the passed
0038  *  path.
0039  *
0040  *  The path provided can either be a fully qualified path or a relative path.
0041  *  If relative, it will be completed either relative to a passed base path
0042  *  or relative to the current working directory of the process.
0043  *
0044  *  As with all InputSource derivatives. The primary objective of an input
0045  *  source is to create an input stream via which the parser can spool in
0046  *  data from the referenced source.
0047  */
0048 class XMLPARSER_EXPORT LocalFileInputSource : public InputSource
0049 {
0050 public :
0051     // -----------------------------------------------------------------------
0052     //  Constructors and Destructor
0053     // -----------------------------------------------------------------------
0054 
0055     /** @name Constructors */
0056     //@{
0057 
0058     /**
0059       * A local file input source requires a path to the file to load. This
0060       * can be provided either as a fully qualified path, a path relative to
0061       * the current working directly, or a path relative to a provided base
0062       * path.
0063       *
0064       * The completed path will become the system id of this input source.
0065       * The constructors don't take any public id for local files, but you
0066       * still set them via the parent class' setPublicId() method of course.
0067       *
0068       * This constructor takes an explicit base path and a possibly relative
0069       * path. If the relative path is seen to be fully qualified, it is used
0070       * as is. Otherwise, it is made relative to the passed base path.
0071       *
0072       * @param  basePath    The base path from which the passed relative path
0073       *                     will be based, if the relative part is indeed
0074       *                     relative.
0075       *
0076       * @param  relativePath    The relative part of the path. It can actually
0077       *                         be fully qualified, in which case it is taken
0078       *                         as is.
0079       *
0080       * @param  manager    Pointer to the memory manager to be used to
0081       *                    allocate objects.
0082       *
0083       * @exception XMLException If the path is relative and doesn't properly
0084       *            resolve to a file.
0085       */
0086     LocalFileInputSource
0087     (
0088         const   XMLCh* const   basePath
0089         , const XMLCh* const   relativePath
0090         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0091     );
0092 
0093     /**
0094       * This constructor takes a single parameter which is the fully qualified
0095       * or relative path. If it is fully qualified, it is taken as is. If it is
0096       * relative, then it is completed relative to the current working directory
0097       * (or the equivalent on the local host machine.)
0098       *
0099       * The completed path will become the system id of this input source.
0100       * The constructors don't take any public id for local files, but you
0101       * still set them via the parent class' setPublicId() method of course.
0102       *
0103       * @param  filePath    The relative or fully qualified path.
0104       *
0105       * @param  manager     Pointer to the memory manager to be used to
0106       *                     allocate objects.
0107       *
0108       * @exception XMLException If the path is relative and doesn't properly
0109       *            resolve to a file.
0110       */
0111     LocalFileInputSource
0112     (
0113         const   XMLCh* const   filePath
0114         , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
0115     );
0116     //@}
0117 
0118     /** @name Destructor */
0119     //@{
0120     ~LocalFileInputSource();
0121     //@}
0122 
0123 
0124     // -----------------------------------------------------------------------
0125     //  Virtual input source interface
0126     // -----------------------------------------------------------------------
0127 
0128     /** @name Virtual methods */
0129     //@{
0130 
0131     /**
0132     * This method will return a binary input stream derivative that will
0133     * parse from the local file indicatedby the system id.
0134     *
0135     * @return A dynamically allocated binary input stream derivative that
0136     *         can parse from the file indicated by the system id.
0137     */
0138     virtual BinInputStream* makeStream() const;
0139 
0140     //@}
0141 private:
0142     // -----------------------------------------------------------------------
0143     //  Unimplemented constructors and operators
0144     // -----------------------------------------------------------------------
0145     LocalFileInputSource(const LocalFileInputSource&);
0146     LocalFileInputSource& operator=(const LocalFileInputSource&);
0147 
0148 };
0149 
0150 XERCES_CPP_NAMESPACE_END
0151 
0152 #endif