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>
40 #include <Pt/String.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()
332 virtual std::streamsize onImport()
335 virtual int_type onGet()
336 {
return std::char_traits<Char>::eof(); }
349 #endif // Pt_Xml_InputSource_h
Core module.
Definition: Allocator.h:33
Resolves external entities and DTDs.
Definition: XmlResolver.h:54
Convert between unicode and UTF-8.
Definition: Utf8Codec.h:44
void reset(std::basic_istream< Char > &ios)
Resets the input source to begin reading from a stream.
virtual int_type onGet()
Returns the next character or EOF.
XML declaration of an XML document.
Definition: XmlDeclaration.h:43
~TextInputSource()
Destructor.
void setId(const Pt::String &id)
Sets the ID.
virtual bool onImportText()
Refill the character buffer.
virtual std::streamsize onImport()
Refills the stream buffer.
TextInputSource(std::basic_istream< Char > &is)
Construct with input stream.
Text input source for the XML reader.
Definition: InputSource.h:163
const Pt::String & onId() const
Returns the ID of the input stream.
XML byte order mark.
Definition: ByteorderMark.h:41
Unicode capable basic_string.
Definition: Api-String.h:44
Protects derived classes from being copied.
Definition: NonCopyable.h:54
TextInputSource()
Construct an empty TextInputSource.
void reset()
Resets the input source and removes the input stream.