| 1 | // |
| 2 | // XMLStream.h |
| 3 | // |
| 4 | // Library: XML |
| 5 | // Package: XML |
| 6 | // Module: XMLStream |
| 7 | // |
| 8 | // Definition of the XMLByteInputStream and XMLCharInputStream classes. |
| 9 | // |
| 10 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
| 11 | // and Contributors. |
| 12 | // |
| 13 | // SPDX-License-Identifier: BSL-1.0 |
| 14 | // |
| 15 | |
| 16 | |
| 17 | #ifndef XML_XMLStream_INCLUDED |
| 18 | #define XML_XMLStream_INCLUDED |
| 19 | |
| 20 | |
| 21 | #include "Poco/XML/XML.h" |
| 22 | #include <istream> |
| 23 | #include <ostream> |
| 24 | |
| 25 | |
| 26 | namespace Poco { |
| 27 | namespace XML { |
| 28 | |
| 29 | |
| 30 | // The byte input stream is always a narrow stream. |
| 31 | typedef std::istream XMLByteInputStream; |
| 32 | typedef std::ostream XMLByteOutputStream; |
| 33 | |
| 34 | |
| 35 | // |
| 36 | // The XML parser uses the stream classes provided by the C++ |
| 37 | // standard library (based on the basic_stream<> template). |
| 38 | // In Unicode mode, a wide stream is used. |
| 39 | // To turn on Unicode mode, #define XML_UNICODE and |
| 40 | // XML_UNICODE_WCHAR_T when compiling the library. |
| 41 | // |
| 42 | // XML_UNICODE XML_UNICODE_WCHAR_T XMLCharInputStream XMLCharOutputStream |
| 43 | // ------------------------------------------------------------------------- |
| 44 | // N N std::istream std::ostream |
| 45 | // N Y std::wistream std::wostream |
| 46 | // Y Y std::wistream std::wostream |
| 47 | // Y N <not supported> |
| 48 | // |
| 49 | #if defined(XML_UNICODE_WCHAR_T) |
| 50 | |
| 51 | // Unicode - use wide streams |
| 52 | typedef std::wistream XMLCharInputStream; |
| 53 | typedef std::wostream XMLCharOutputStream; |
| 54 | |
| 55 | #elif defined(XML_UNICODE) |
| 56 | |
| 57 | // not supported - leave XMLString undefined |
| 58 | |
| 59 | #else |
| 60 | |
| 61 | // Characters are UTF-8 encoded |
| 62 | typedef std::istream XMLCharInputStream; |
| 63 | typedef std::ostream XMLCharOutputStream; |
| 64 | |
| 65 | #endif |
| 66 | |
| 67 | |
| 68 | } } // namespace Poco::XML |
| 69 | |
| 70 | |
| 71 | #endif // XML_XMLStream_INCLUDED |
| 72 | |