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
105 inline int_type
get()
107 return _rdbuf ? _rdbuf->sbumpc()
140 virtual std::streamsize
onImport() = 0;
144 virtual int_type
onGet() = 0;
152 std::basic_streambuf<Char>* _rdbuf;
183 void reset(std::basic_istream<Char>& ios);
191 virtual std::streamsize onImport();
194 virtual int_type onGet();
201 virtual bool onImportText();
205 bool onParseXml(int_type c);
208 std::basic_istream<Char>* _ios;
211 unsigned char _xmlState;
212 const char* _pbBegin;
234 virtual bool onImportText();
277 void reset(std::istream& is);
285 virtual std::streamsize onImport();
288 virtual int_type onGet();
295 virtual bool onImportData();
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
XML byte order mark.
Definition: ByteorderMark.h:40
Converts character sequences with different encodings.
Protects derived classes from being copied.
Definition: NonCopyable.h:54
XML declaration of an XML document.
Definition: XmlDeclaration.h:42
Text input source for the XML reader.
Definition: InputSource.h:162
Unicode capable basic_string.
Definition: String.h:42
Resolves external entities and DTDs.
Definition: XmlResolver.h:53
Convert between unicode and UTF-8.
Definition: Utf8Codec.h:43