29#ifndef Pt_Xml_InputSource_h
30#define Pt_Xml_InputSource_h
32#include <Pt/Xml/Api.h>
33#include <Pt/Xml/ByteorderMark.h>
34#include <Pt/Xml/XmlDeclaration.h>
35#include <Pt/NonCopyable.h>
36#include <Pt/TextBuffer.h>
37#include <Pt/TextStream.h>
38#include <Pt/Utf8Codec.h>
39#include <Pt/StringStream.h>
63 typedef std::char_traits<Char>::int_type int_type;
96 inline std::streamsize
import()
98 std::streamsize r = 0;
99 return (_rdbuf && (r =_rdbuf->in_avail()) > 0) ? r
107 return _rdbuf ? _rdbuf->sbumpc()
152 std::basic_streambuf<Char>* _rdbuf;
183 void reset(std::basic_istream<Char>& ios);
205 bool onParseXml(int_type c);
208 std::basic_istream<Char>* _ios;
211 unsigned char _xmlState;
212 const char* _pbBegin;
299 bool onParseBom(
unsigned char c);
302 bool onParseXml(
int c);
305 void onDeclaration();
316 unsigned char _bomState;
317 unsigned char _xmlState;
318 const char* _pbBegin;
327 explicit NullInputSource()
335 virtual int_type
onGet()
336 {
return std::char_traits<Char>::eof(); }
338 const Pt::String& onId()
const
NonCopyable()
Default constructor.
Definition NonCopyable.h:63
Unicode string stream.
Definition StringStream.h:192
Unicode capable basic_string.
Definition Api-String.h:67
Convert between unicode and UTF-8.
Definition Utf8Codec.h:44
XML byte order mark.
Definition ByteorderMark.h:41
void setId(const Pt::String &id)
Sets the ID.
TextInputSource()
Construct an empty TextInputSource.
void reset(std::basic_istream< Char > &ios)
Resets the input source to begin reading from a stream.
virtual std::streamsize onImport()
Refills the stream buffer.
virtual bool onImportText()
Refill the character buffer.
void reset()
Resets the input source and removes the input stream.
virtual int_type onGet()
Returns the next character or EOF.
~TextInputSource()
Destructor.
TextInputSource(std::basic_istream< Char > &is)
Construct with input stream.
const Pt::String & onId() const
Returns the ID of the input stream.
XML declaration of an XML document.
Definition XmlDeclaration.h:43
Resolves external entities and DTDs.
Definition XmlResolver.h:54
Read and write XML ducuments.
Core module.
Definition Allocator.h:33