Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:27:05

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 #if !defined(XERCESC_INCLUDE_GUARD_WRAPPER4DOMLSINPUT_HPP)
0023 #define XERCESC_INCLUDE_GUARD_WRAPPER4DOMLSINPUT_HPP
0024 
0025 #include <xercesc/sax/InputSource.hpp>
0026 
0027 XERCES_CPP_NAMESPACE_BEGIN
0028 
0029 class DOMLSInput;
0030 class DOMLSResourceResolver;
0031 
0032 /**
0033   * Wrap a DOMLSInput object and make it behave like a SAX InputSource.
0034   */
0035 class XMLPARSER_EXPORT Wrapper4DOMLSInput: public InputSource
0036 {
0037 public:
0038     /** @name Constructors and Destructor */
0039     //@{
0040 
0041   /**
0042     * Constructor
0043     *
0044     * Wrap a DOMLSInput and make it behave like a SAX InputSource.
0045     * By default, the wrapper will adopt the DOMLSInput that is wrapped.
0046     *
0047     * @param  inputSource  The DOMLSInput to be wrapped
0048     * @param  entityResolver  The DOMLSResourceResolver to be used when resolving publicID entries
0049     * @param  adoptFlag    Indicates if the wrapper should adopt the wrapped
0050     *                      DOMLSInput. Default is true.
0051     * @param  manager      Pointer to the memory manager to be used to
0052     *                      allocate objects.
0053     */
0054     Wrapper4DOMLSInput
0055     (
0056         DOMLSInput* const inputSource
0057         , DOMLSResourceResolver* entityResolver = 0
0058         , const bool adoptFlag = true
0059         , MemoryManager* const  manager = XMLPlatformUtils::fgMemoryManager
0060     );
0061 
0062   /**
0063     * Destructor
0064     *
0065     */
0066     virtual ~Wrapper4DOMLSInput();
0067     //@}
0068 
0069 
0070     // -----------------------------------------------------------------------
0071     /** @name Virtual input source interface */
0072     //@{
0073   /**
0074     *
0075     * Makes the byte stream for this input source.
0076     *
0077     * <p>The function will call the makeStream of the wrapped input source.
0078     * The returned stream becomes the parser's property.</p>
0079     *
0080     * @see BinInputStream
0081     */
0082     BinInputStream* makeStream() const;
0083 
0084     //@}
0085 
0086     // -----------------------------------------------------------------------
0087     /** @name Getter methods */
0088     //@{
0089   /**
0090     *
0091     * An input source can be set to force the parser to assume a particular
0092     * encoding for the data that input source reprsents, via the setEncoding()
0093     * method. This method will delegate to the wrapped input source to return
0094     * name of the encoding that is to be forced. If the encoding has never
0095     * been forced, it returns a null pointer.
0096     *
0097     * @return The forced encoding, or null if none was supplied.
0098     * @see #setEncoding
0099     */
0100     const XMLCh* getEncoding() const;
0101 
0102 
0103   /**
0104     *
0105     * Get the public identifier for this input source. Delegated to the
0106     * wrapped input source object.
0107     *
0108     * @return The public identifier, or null if none was supplied.
0109     * @see #setPublicId
0110     */
0111     const XMLCh* getPublicId() const;
0112 
0113 
0114   /**
0115     *
0116     * Get the system identifier for this input source. Delegated to the
0117     * wrapped input source object.
0118     *
0119     * <p>If the system ID is a URL, it will be fully resolved.</p>
0120     *
0121     * @return The system identifier.
0122     * @see #setSystemId
0123     */
0124     const XMLCh* getSystemId() const;
0125 
0126   /**
0127     *
0128     * Get the flag that indicates if the parser should issue fatal error if
0129     * this input source is not found. Delegated to the wrapped input source
0130     * object.
0131     *
0132     * @return True  if the parser should issue fatal error if this input source
0133     *               is not found.
0134     *         False if the parser issue warning message instead.
0135     * @see #setIssueFatalErrorIfNotFound
0136     */
0137     bool getIssueFatalErrorIfNotFound() const;
0138 
0139     //@}
0140 
0141 
0142     // -----------------------------------------------------------------------
0143     /** @name Setter methods */
0144     //@{
0145 
0146   /**
0147     *
0148     * Set the encoding which will be required for use with the XML text read
0149     * via a stream opened by this input source. This will update the wrapped
0150     * input source object.
0151     *
0152     * <p>This is usually not set, allowing the encoding to be sensed in the
0153     * usual XML way. However, in some cases, the encoding in the file is known
0154     * to be incorrect because of intermediate transcoding, for instance
0155     * encapsulation within a MIME document.
0156     *
0157     * @param encodingStr The name of the encoding to force.
0158     */
0159     void setEncoding(const XMLCh* const encodingStr);
0160 
0161 
0162   /**
0163     *
0164     * Set the public identifier for this input source. This will update the
0165     * wrapped input source object.
0166     *
0167     * <p>The public identifier is always optional: if the application writer
0168     * includes one, it will be provided as part of the location information.</p>
0169     *
0170     * @param publicId The public identifier as a string.
0171     * @see Locator#getPublicId
0172     * @see SAXParseException#getPublicId
0173     * @see #getPublicId
0174     */
0175     void setPublicId(const XMLCh* const publicId);
0176 
0177   /**
0178     *
0179     * Set the system identifier for this input source. This will update the
0180     * wrapped input source object.
0181     *
0182     * <p>The system id is always required. The public id may be used to map
0183     * to another system id, but the system id must always be present as a fall
0184     * back.</p>
0185     *
0186     * <p>If the system ID is a URL, it must be fully resolved.</p>
0187     *
0188     * @param systemId The system identifier as a string.
0189     * @see #getSystemId
0190     * @see Locator#getSystemId
0191     * @see SAXParseException#getSystemId
0192     */
0193     void setSystemId(const XMLCh* const systemId);
0194 
0195   /**
0196     *
0197     * Indicates if the parser should issue fatal error if this input source
0198     * is not found.  If set to false, the parser issue warning message instead.
0199     * This will update the wrapped input source object.
0200     *
0201     * @param  flag True if the parser should issue fatal error if this input source is not found.
0202     *               If set to false, the parser issue warning message instead.  (Default: true)
0203     *
0204     * @see #getIssueFatalErrorIfNotFound
0205     */
0206     void setIssueFatalErrorIfNotFound(const bool flag);
0207 
0208     //@}
0209 
0210 
0211 private:
0212     // -----------------------------------------------------------------------
0213     //  Unimplemented constructors and operators
0214     // -----------------------------------------------------------------------
0215     Wrapper4DOMLSInput(const Wrapper4DOMLSInput&);
0216     Wrapper4DOMLSInput& operator=(const Wrapper4DOMLSInput&);
0217 
0218     // -----------------------------------------------------------------------
0219     //  Private data members
0220     // -----------------------------------------------------------------------
0221     bool                    fAdoptInputSource,
0222                             fForceXMLChEncoding;
0223     DOMLSInput*             fInputSource;
0224     DOMLSResourceResolver*  fEntityResolver;
0225 };
0226 
0227 XERCES_CPP_NAMESPACE_END
0228 
0229 
0230 #endif