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

Revision 2674, 7.5 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: Wrapper4DOMInputSource.hpp 568078 2007-08-21 11:43:25Z amassari $
20 */
21
22
23#ifndef WRAPPER4DOMINPUTSOURCE_HPP
24#define WRAPPER4DOMINPUTSOURCE_HPP
25
26#include <xercesc/sax/InputSource.hpp>
27
28XERCES_CPP_NAMESPACE_BEGIN
29
30class DOMInputSource;
31
32
33/**
34  * Wrap a DOMInputSource object to a SAX InputSource.
35  */
36class XMLPARSER_EXPORT Wrapper4DOMInputSource: public InputSource
37{
38public:
39    /** @name Constructors and Destructor */
40    //@{
41
42  /**
43    * Constructor
44    *
45    * Wrap a DOMInputSource and pretend it to be a SAX InputSource.
46    * By default, the wrapper will adopt the DOMInputSource that is wrapped.
47    *
48    * @param  inputSource  The DOMInputSource to be wrapped
49    * @param  adoptFlag    Indicates if the wrapper should adopt the wrapped
50    *                      DOMInputSource. Default is true.
51    * @param  manager      Pointer to the memory manager to be used to
52    *                      allocate objects.
53    */
54    Wrapper4DOMInputSource
55    (
56        DOMInputSource* const inputSource
57        , const bool adoptFlag = true
58        , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
59    );
60
61  /**
62    * Destructor
63    *
64    */
65    virtual ~Wrapper4DOMInputSource();
66    //@}
67
68
69    // -----------------------------------------------------------------------
70    /** @name Virtual input source interface */
71    //@{
72  /**
73    * <p><b>"Experimental - subject to change"</b></p>
74    *
75    * Makes the byte stream for this input source.
76    *
77    * <p>The function will call the makeStream of the wrapped input source.
78    * The returned stream becomes the parser's property.</p>
79    *
80    * @see BinInputStream
81    */
82    BinInputStream* makeStream() const;
83
84    //@}
85
86    // -----------------------------------------------------------------------
87    /** @name Getter methods */
88    //@{
89  /**
90    * <p><b>"Experimental - subject to change"</b></p>
91    *
92    * An input source can be set to force the parser to assume a particular
93    * encoding for the data that input source reprsents, via the setEncoding()
94    * method. This method will delegate to the wrapped input source to return
95    * name of the encoding that is to be forced. If the encoding has never
96    * been forced, it returns a null pointer.
97    *
98    * @return The forced encoding, or null if none was supplied.
99    * @see #setEncoding
100    */
101    const XMLCh* getEncoding() const;
102
103
104  /**
105    * <p><b>"Experimental - subject to change"</b></p>
106    *
107    * Get the public identifier for this input source. Delegated to the
108    * wrapped input source object.
109    *
110    * @return The public identifier, or null if none was supplied.
111    * @see #setPublicId
112    */
113    const XMLCh* getPublicId() const;
114
115
116  /**
117    * <p><b>"Experimental - subject to change"</b></p>
118    *
119    * Get the system identifier for this input source. Delegated to the
120    * wrapped input source object.
121    *
122    * <p>If the system ID is a URL, it will be fully resolved.</p>
123    *
124    * @return The system identifier.
125    * @see #setSystemId
126    */
127    const XMLCh* getSystemId() const;
128
129 /**
130    * <p><b>"Experimental - subject to change"</b></p>
131    *
132    * Get the flag that indicates if the parser should issue fatal error if
133    * this input source is not found. Delegated to the wrapped input source
134    * object.
135    *
136    * @return True  if the parser should issue fatal error if this input source
137    *               is not found.
138    *         False if the parser issue warning message instead.
139    * @see #setIssueFatalErrorIfNotFound
140    */
141    bool getIssueFatalErrorIfNotFound() const;
142
143    //@}
144
145
146    // -----------------------------------------------------------------------
147    /** @name Setter methods */
148    //@{
149
150  /**
151    * <p><b>"Experimental - subject to change"</b></p>
152    *
153    * Set the encoding which will be required for use with the XML text read
154    * via a stream opened by this input source. This will update the wrapped
155    * input source object.
156    *
157    * <p>This is usually not set, allowing the encoding to be sensed in the
158    * usual XML way. However, in some cases, the encoding in the file is known
159    * to be incorrect because of intermediate transcoding, for instance
160    * encapsulation within a MIME document.
161    *
162    * @param encodingStr The name of the encoding to force.
163    */
164    void setEncoding(const XMLCh* const encodingStr);
165
166
167  /**
168    * <p><b>"Experimental - subject to change"</b></p>
169    *
170    * Set the public identifier for this input source. This will update the
171    * wrapped input source object.
172    *
173    * <p>The public identifier is always optional: if the application writer
174    * includes one, it will be provided as part of the location information.</p>
175    *
176    * @param publicId The public identifier as a string.
177    * @see Locator#getPublicId
178    * @see SAXParseException#getPublicId
179    * @see #getPublicId
180    */
181    void setPublicId(const XMLCh* const publicId);
182
183  /**
184    * <p><b>"Experimental - subject to change"</b></p>
185    *
186    * Set the system identifier for this input source. This will update the
187    * wrapped input source object.
188    *
189    * <p>The system id is always required. The public id may be used to map
190    * to another system id, but the system id must always be present as a fall
191    * back.</p>
192    *
193    * <p>If the system ID is a URL, it must be fully resolved.</p>
194    *
195    * @param systemId The system identifier as a string.
196    * @see #getSystemId
197    * @see Locator#getSystemId
198    * @see SAXParseException#getSystemId
199    */
200    void setSystemId(const XMLCh* const systemId);
201
202  /**
203    * <p><b>"Experimental - subject to change"</b></p>
204    *
205    * Indicates if the parser should issue fatal error if this input source
206    * is not found.  If set to false, the parser issue warning message instead.
207    * This will update the wrapped input source object.
208    *
209    * @param  flag True if the parser should issue fatal error if this input source is not found.
210    *               If set to false, the parser issue warning message instead.  (Default: true)
211    *
212    * @see #getIssueFatalErrorIfNotFound
213    */
214    void setIssueFatalErrorIfNotFound(const bool flag);
215
216    //@}
217
218
219private:
220    // -----------------------------------------------------------------------
221    //  Unimplemented constructors and operators
222    // -----------------------------------------------------------------------
223    Wrapper4DOMInputSource(const Wrapper4DOMInputSource&);
224    Wrapper4DOMInputSource& operator=(const Wrapper4DOMInputSource&);
225
226    // -----------------------------------------------------------------------
227    //  Private data members
228    // -----------------------------------------------------------------------
229    bool            fAdoptInputSource;
230    DOMInputSource* fInputSource;
231};
232
233XERCES_CPP_NAMESPACE_END
234
235
236#endif
Note: See TracBrowser for help on using the repository browser.