[188] | 1 | /*
|
---|
| 2 | * The Apache Software License, Version 1.1
|
---|
| 3 | *
|
---|
| 4 | * Copyright (c) 1999-2000 The Apache Software Foundation. All rights
|
---|
| 5 | * reserved.
|
---|
| 6 | *
|
---|
| 7 | * Redistribution and use in source and binary forms, with or without
|
---|
| 8 | * modification, are permitted provided that the following conditions
|
---|
| 9 | * are met:
|
---|
| 10 | *
|
---|
| 11 | * 1. Redistributions of source code must retain the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer.
|
---|
| 13 | *
|
---|
| 14 | * 2. Redistributions in binary form must reproduce the above copyright
|
---|
| 15 | * notice, this list of conditions and the following disclaimer in
|
---|
| 16 | * the documentation and/or other materials provided with the
|
---|
| 17 | * distribution.
|
---|
| 18 | *
|
---|
| 19 | * 3. The end-user documentation included with the redistribution,
|
---|
| 20 | * if any, must include the following acknowledgment:
|
---|
| 21 | * "This product includes software developed by the
|
---|
| 22 | * Apache Software Foundation (http://www.apache.org/)."
|
---|
| 23 | * Alternately, this acknowledgment may appear in the software itself,
|
---|
| 24 | * if and wherever such third-party acknowledgments normally appear.
|
---|
| 25 | *
|
---|
| 26 | * 4. The names "Xerces" and "Apache Software Foundation" must
|
---|
| 27 | * not be used to endorse or promote products derived from this
|
---|
| 28 | * software without prior written permission. For written
|
---|
| 29 | * permission, please contact apache\@apache.org.
|
---|
| 30 | *
|
---|
| 31 | * 5. Products derived from this software may not be called "Apache",
|
---|
| 32 | * nor may "Apache" appear in their name, without prior written
|
---|
| 33 | * permission of the Apache Software Foundation.
|
---|
| 34 | *
|
---|
| 35 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
|
---|
| 36 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 37 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
---|
| 38 | * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
|
---|
| 39 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
---|
| 40 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
---|
| 41 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
---|
| 42 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
---|
| 43 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
---|
| 44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
---|
| 45 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
---|
| 46 | * SUCH DAMAGE.
|
---|
| 47 | * ====================================================================
|
---|
| 48 | *
|
---|
| 49 | * This software consists of voluntary contributions made by many
|
---|
| 50 | * individuals on behalf of the Apache Software Foundation, and was
|
---|
| 51 | * originally based on software copyright (c) 1999, International
|
---|
| 52 | * Business Machines, Inc., http://www.ibm.com . For more information
|
---|
| 53 | * on the Apache Software Foundation, please see
|
---|
| 54 | * <http://www.apache.org/>.
|
---|
| 55 | */
|
---|
| 56 |
|
---|
| 57 | /*
|
---|
| 58 | * $Log: StdInInputSource.hpp,v $
|
---|
| 59 | * Revision 1.4 2004/01/29 11:46:29 cargilld
|
---|
| 60 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
| 61 | *
|
---|
| 62 | * Revision 1.3 2003/05/16 21:36:55 knoaman
|
---|
| 63 | * Memory manager implementation: Modify constructors to pass in the memory manager.
|
---|
| 64 | *
|
---|
| 65 | * Revision 1.2 2002/11/04 15:00:21 tng
|
---|
| 66 | * C++ Namespace Support.
|
---|
| 67 | *
|
---|
| 68 | * Revision 1.1.1.1 2002/02/01 22:21:50 peiyongz
|
---|
| 69 | * sane_include
|
---|
| 70 | *
|
---|
| 71 | * Revision 1.6 2000/12/14 18:49:55 tng
|
---|
| 72 | * Fix API document generation warning: "Warning: end of member group without matching begin"
|
---|
| 73 | *
|
---|
| 74 | * Revision 1.5 2000/02/24 20:00:22 abagchi
|
---|
| 75 | * Swat for removing Log from API docs
|
---|
| 76 | *
|
---|
| 77 | * Revision 1.4 2000/02/15 23:59:06 roddey
|
---|
| 78 | * More updated documentation of Framework classes.
|
---|
| 79 | *
|
---|
| 80 | * Revision 1.3 2000/02/15 01:21:30 roddey
|
---|
| 81 | * Some initial documentation improvements. More to come...
|
---|
| 82 | *
|
---|
| 83 | * Revision 1.2 2000/02/06 07:47:46 rahulj
|
---|
| 84 | * Year 2K copyright swat.
|
---|
| 85 | *
|
---|
| 86 | * Revision 1.1 2000/01/12 00:13:26 roddey
|
---|
| 87 | * These were moved from internal/ to framework/, which was something that should have
|
---|
| 88 | * happened long ago. They are really framework type of classes.
|
---|
| 89 | *
|
---|
| 90 | * Revision 1.1.1.1 1999/11/09 01:08:17 twl
|
---|
| 91 | * Initial checkin
|
---|
| 92 | *
|
---|
| 93 | * Revision 1.2 1999/11/08 20:44:44 rahul
|
---|
| 94 | * Swat for adding in Product name and CVS comment log variable.
|
---|
| 95 | *
|
---|
| 96 | */
|
---|
| 97 |
|
---|
| 98 |
|
---|
| 99 | #if !defined(STDININPUTSOURCE_HPP)
|
---|
| 100 | #define STDININPUTSOURCE_HPP
|
---|
| 101 |
|
---|
| 102 | #include <xercesc/sax/InputSource.hpp>
|
---|
| 103 |
|
---|
| 104 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
| 105 |
|
---|
| 106 | class BinInputStream;
|
---|
| 107 |
|
---|
| 108 |
|
---|
| 109 | /**
|
---|
| 110 | * This class is a derivative of the standard InputSource class. It provides
|
---|
| 111 | * for the parser access to data via the standard input. This input source
|
---|
| 112 | * is not commonly used, but can be useful when implementing such things
|
---|
| 113 | * as pipe based tools which exchange XML data.
|
---|
| 114 | *
|
---|
| 115 | * As with all InputSource derivatives. The primary objective of an input
|
---|
| 116 | * source is to create an input stream via which the parser can spool in
|
---|
| 117 | * data from the referenced source.
|
---|
| 118 | */
|
---|
| 119 | class XMLPARSER_EXPORT StdInInputSource : public InputSource
|
---|
| 120 | {
|
---|
| 121 | public :
|
---|
| 122 | // -----------------------------------------------------------------------
|
---|
| 123 | // Constructors and Destructor
|
---|
| 124 | // -----------------------------------------------------------------------
|
---|
| 125 |
|
---|
| 126 | /** @name Constructor */
|
---|
| 127 | //@{
|
---|
| 128 |
|
---|
| 129 | /**
|
---|
| 130 | * Since the standard input is a canned source, the constructor is very
|
---|
| 131 | * simple. It just uses local platform services to open up the standard
|
---|
| 132 | * input source as file, a new handleof which it gives to each new stream
|
---|
| 133 | * it creates.
|
---|
| 134 | */
|
---|
| 135 | StdInInputSource(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
|
---|
| 136 | //@}
|
---|
| 137 |
|
---|
| 138 | /** @name Destructor */
|
---|
| 139 | //@{
|
---|
| 140 | ~StdInInputSource();
|
---|
| 141 | //@}
|
---|
| 142 |
|
---|
| 143 |
|
---|
| 144 | // -----------------------------------------------------------------------
|
---|
| 145 | // Virtual input source interface
|
---|
| 146 | // -----------------------------------------------------------------------
|
---|
| 147 |
|
---|
| 148 |
|
---|
| 149 | /** @name Virtual methods */
|
---|
| 150 | //@{
|
---|
| 151 |
|
---|
| 152 | /**
|
---|
| 153 | * This method will return a binary input stream derivative that will
|
---|
| 154 | * parse from the standard input of the local host.
|
---|
| 155 | *
|
---|
| 156 | * @return A dynamically allocated binary input stream derivative that
|
---|
| 157 | * can parse from the standardinput.
|
---|
| 158 | */
|
---|
| 159 | BinInputStream* makeStream() const;
|
---|
| 160 |
|
---|
| 161 | //@}
|
---|
| 162 |
|
---|
| 163 | private:
|
---|
| 164 | // -----------------------------------------------------------------------
|
---|
| 165 | // Unimplemented constructors and operators
|
---|
| 166 | // -----------------------------------------------------------------------
|
---|
| 167 | StdInInputSource(const StdInInputSource&);
|
---|
| 168 | StdInInputSource& operator=(const StdInInputSource&);
|
---|
| 169 |
|
---|
| 170 | };
|
---|
| 171 |
|
---|
| 172 | inline StdInInputSource::StdInInputSource(MemoryManager* const manager) :
|
---|
| 173 |
|
---|
| 174 | InputSource("stdin", manager)
|
---|
| 175 | {
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | inline StdInInputSource::~StdInInputSource()
|
---|
| 179 | {
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | XERCES_CPP_NAMESPACE_END
|
---|
| 183 |
|
---|
| 184 | #endif
|
---|