#include <Pt/Xml/InputSource.h>
Binary input source for the XML reader. More...
Inherits InputSource.
Public Member Functions | |
BinaryInputSource () | |
Construct an empty input source. | |
BinaryInputSource (std::istream &is) | |
Construct from byte stream. | |
BinaryInputSource (XmlResolver &resolver) | |
Construct with resolver. | |
BinaryInputSource (XmlResolver &resolver, std::istream &is) | |
Construct with resolver and input stream. | |
~BinaryInputSource () | |
Destructor. | |
const XmlDeclaration * | declaration () const |
Returns the XML declaration or a nullptr if none was read. | |
int_type | get () |
Returns the next character or EOF. | |
const Pt::String & | id () const |
Returns the ID of the input stream. | |
std::streamsize | import () |
Import available bytes into buffer. More... | |
std::size_t | line () const |
Current line count. | |
void | reset () |
Resets the input source and removes the input stream. | |
void | reset (std::istream &is) |
Resets the input source to begin reading from a stream. | |
void | setId (const Pt::String &id) |
Sets the ID. | |
void | setLine (std::size_t n) |
Sets the current line count. | |
Protected Member Functions | |
void | init (std::basic_streambuf< Char > *rdbuf=0, XmlDeclaration *decl=0) |
Initialize to use an input buffer and XML declaration. More... | |
virtual int_type | onGet () |
Returns the next character or EOF. | |
const Pt::String & | onId () const |
Returns the ID of the input stream. | |
virtual std::streamsize | onImport () |
Refills the stream buffer. | |
virtual bool | onImportData () |
Refill the input buffer. | |
This input source reads from a byte stream and converts from the external character encoding to unicode depending on the byte order mark (BOM) and the encoding specified in the XML declaration. The XmlResolver is used to resolve encoding strings to text codecs. The underlying input stream and resolver must
|
inherited |
If no more characters can be read directly from the input stream buffer without blocking read operations, the virtual method onInput() is called. The number of available characters is returned, which can be 0 if no data is available.
|
protectedinherited |
The derived input sources must call this method once the XML or text declaration is parsed or if none was found. Normally, this is done in the virtual methods onGet() and onImport(), which are called by the public interface methods get() and import() when no buffer was set yet. The passed buffer and declaration are owned by the derived class.