source: NonGTP/Xerces/xerces-c_2_8_0/include/xercesc/framework/LocalFileInputSource.hpp @ 2674

Revision 2674, 5.7 KB checked in by mattausch, 16 years ago (diff)
Line 
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: LocalFileInputSource.hpp 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22
23#if !defined(LOCALFILEINPUTSOURCE_HPP)
24#define LOCALFILEINPUTSOURCE_HPP
25
26#include <xercesc/sax/InputSource.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30class BinInputStream;
31
32/**
33 *  This class is a derivative of the standard InputSource class. It provides
34 *  for the parser access to data which is referenced via a local file path,
35 *  as apposed to remote file or URL. This is the most efficacious mechanism
36 *  by which local files can be parsed, since the parse knows that it refers
37 *  to a local file and will make no other attempts to interpret the passed
38 *  path.
39 *
40 *  The path provided can either be a fully qualified path or a relative path.
41 *  If relative, it will be completed either relative to a passed base path
42 *  or relative to the current working directory of the process.
43 *
44 *  As with all InputSource derivatives. The primary objective of an input
45 *  source is to create an input stream via which the parser can spool in
46 *  data from the referenced source.
47 */
48class XMLPARSER_EXPORT LocalFileInputSource : public InputSource
49{
50public :
51    // -----------------------------------------------------------------------
52    //  Constructors and Destructor
53    // -----------------------------------------------------------------------
54
55    /** @name Constructors */
56    //@{
57
58    /**
59      * A local file input source requires a path to the file to load. This
60      * can be provided either as a fully qualified path, a path relative to
61      * the current working directly, or a path relative to a provided base
62      * path.
63      *
64      * The completed path will become the system id of this input source.
65      * The constructors don't take any public id for local files, but you
66      * still set them via the parent class' setPublicId() method of course.
67      *
68      * This constructor takes an explicit base path and a possibly relative
69      * path. If the relative path is seen to be fully qualified, it is used
70      * as is. Otherwise, it is made relative to the passed base path.
71      *
72      * @param  basePath    The base path from which the passed relative path
73      *                     will be based, if the relative part is indeed
74      *                     relative.
75      *
76      * @param  relativePath    The relative part of the path. It can actually
77      *                         be fully qualified, in which case it is taken
78      *                         as is.
79      *
80      * @param  manager    Pointer to the memory manager to be used to
81      *                    allocate objects.
82      *
83      * @exception XMLException If the path is relative and doesn't properly
84      *            resolve to a file.
85      */
86    LocalFileInputSource
87    (
88        const   XMLCh* const   basePath
89        , const XMLCh* const   relativePath
90        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
91    );
92
93    /**
94      * This constructor takes a single parameter which is the fully qualified
95      * or relative path. If it is fully qualified, it is taken as is. If it is
96      * relative, then it is completed relative to the current working directory
97      * (or the equivalent on the local host machine.)
98      *
99      * The completed path will become the system id of this input source.
100      * The constructors don't take any public id for local files, but you
101      * still set them via the parent class' setPublicId() method of course.
102      *
103      * @param  filePath    The relative or fully qualified path.
104      *
105      * @param  manager     Pointer to the memory manager to be used to
106      *                     allocate objects.
107      *
108      * @exception XMLException If the path is relative and doesn't properly
109      *            resolve to a file.
110      */
111    LocalFileInputSource
112    (
113        const   XMLCh* const   filePath
114        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
115    );
116    //@}
117
118    /** @name Destructor */
119    //@{
120    ~LocalFileInputSource();
121    //@}
122
123
124    // -----------------------------------------------------------------------
125    //  Virtual input source interface
126    // -----------------------------------------------------------------------
127
128    /** @name Virtual methods */
129    //@{
130
131    /**
132    * This method will return a binary input stream derivative that will
133    * parse from the local file indicatedby the system id.
134    *
135    * @return A dynamically allocated binary input stream derivative that
136    *         can parse from the file indicated by the system id.
137    */
138    virtual BinInputStream* makeStream() const;
139
140    //@}
141private:
142    // -----------------------------------------------------------------------
143    //  Unimplemented constructors and operators
144    // -----------------------------------------------------------------------
145    LocalFileInputSource(const LocalFileInputSource&);
146    LocalFileInputSource& operator=(const LocalFileInputSource&);
147
148};
149
150XERCES_CPP_NAMESPACE_END
151
152#endif
Note: See TracBrowser for help on using the repository browser.