#include <Pt/Xml/InputSource.h>
String input source for the XML reader. More...
Inherits TextInputSource.
Public Member Functions | |
| StringInputSource (const String &str) | |
| Construct from a string. | |
| ~StringInputSource () | |
| Destructor. | |
| void | reset () |
| Resets the input source and removes the input stream. | |
| void | reset (std::basic_istream< Char > &ios) |
| Resets the input source to begin reading from a stream. | |
| void | setId (const Pt::String &id) |
| Sets the ID. | |
| std::size_t | line () const |
| Current line count. | |
| void | setLine (std::size_t n) |
| Sets the current line count. | |
| std::streamsize | import () |
| Import available bytes into buffer. More... | |
| int_type | get () |
| Returns the next character or EOF. | |
| const XmlDeclaration * | declaration () const |
| Returns the XML declaration or a nullptr if none was read. | |
| const Pt::String & | id () const |
| Returns the ID of the input stream. | |
Protected Member Functions | |
| virtual bool | onImportText () |
| Refill the character buffer. | |
| virtual std::streamsize | onImport () |
| Refills the stream buffer. | |
| virtual int_type | onGet () |
| Returns the next character or EOF. | |
| const Pt::String & | onId () const |
| Returns the ID of the input stream. | |
| void | init (std::basic_streambuf< Char > *rdbuf=0, XmlDeclaration *decl=0) |
| Initialize to use an input buffer and XML declaration. More... | |
This input source can read characters from an unicode string, so no character conversion is performed, but the XML declaration is parsed.
|
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.