]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: xmlio.h | |
3 | // Purpose: wxXmlIOHandler - XML I/O classes | |
4 | // Author: Vaclav Slavik | |
5 | // Created: 2000/07/24 | |
6 | // RCS-ID: $Id$ | |
7 | // Copyright: (c) 2000 Vaclav Slavik | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | #ifndef _WX_XMLIO_H_ | |
12 | #define _WX_XMLIO_H_ | |
13 | ||
14 | #ifdef __GNUG__ | |
15 | #pragma interface "xmlio.h" | |
16 | #endif | |
17 | ||
18 | #include "wx/defs.h" | |
19 | #include "wx/string.h" | |
20 | #include "wx/xrc/xml.h" | |
21 | ||
22 | ||
23 | class WXXMLDLLEXPORT wxXmlIOHandlerExpat : public wxXmlIOHandler | |
24 | { | |
25 | public: | |
26 | virtual wxXmlIOType GetType() { return wxXML_IO_EXPAT; } | |
27 | virtual bool CanLoad(wxInputStream& stream); | |
28 | virtual bool CanSave() { return FALSE; } | |
29 | ||
30 | virtual bool Load(wxInputStream& stream, wxXmlDocument& doc, | |
31 | const wxString& encoding); | |
32 | virtual bool Save(wxOutputStream& WXUNUSED(stream), const wxXmlDocument& WXUNUSED(doc)) | |
33 | { return FALSE; } | |
34 | }; | |
35 | ||
36 | ||
37 | class WXXMLDLLEXPORT wxXmlIOHandlerWriter : public wxXmlIOHandler | |
38 | { | |
39 | public: | |
40 | virtual wxXmlIOType GetType() { return wxXML_IO_TEXT_OUTPUT; } | |
41 | virtual bool CanLoad(wxInputStream& WXUNUSED(stream)) { return FALSE; } | |
42 | virtual bool CanSave() { return TRUE; } | |
43 | ||
44 | virtual bool Load(wxInputStream& WXUNUSED(stream), wxXmlDocument& WXUNUSED(doc), | |
45 | const wxString& WXUNUSED(encoding)) | |
46 | { return FALSE; } | |
47 | virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc); | |
48 | }; | |
49 | ||
50 | ||
51 | class WXXMLDLLEXPORT wxXmlIOHandlerBin : public wxXmlIOHandler | |
52 | { | |
53 | public: | |
54 | wxXmlIOHandlerBin() {} | |
55 | ||
56 | virtual wxXmlIOType GetType() { return wxXML_IO_BIN; } | |
57 | virtual bool CanLoad(wxInputStream& stream); | |
58 | virtual bool CanSave() { return TRUE; } | |
59 | ||
60 | virtual bool Load(wxInputStream& stream, wxXmlDocument& doc, | |
61 | const wxString& encoding); | |
62 | virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc); | |
63 | ||
64 | protected: | |
65 | wxString ReadHeader(wxInputStream& stream); | |
66 | void WriteHeader(wxOutputStream& stream, const wxString& header); | |
67 | }; | |
68 | ||
69 | ||
70 | ||
71 | #if wxUSE_ZLIB | |
72 | ||
73 | class WXXMLDLLEXPORT wxXmlIOHandlerBinZ : public wxXmlIOHandlerBin | |
74 | { | |
75 | public: | |
76 | wxXmlIOHandlerBinZ() {} | |
77 | ||
78 | virtual wxXmlIOType GetType() { return wxXML_IO_BINZ; } | |
79 | virtual bool CanLoad(wxInputStream& stream); | |
80 | ||
81 | virtual bool Load(wxInputStream& stream, wxXmlDocument& doc, | |
82 | const wxString& encoding); | |
83 | virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc); | |
84 | }; | |
85 | ||
86 | #endif | |
87 | ||
88 | ||
89 | #endif // _WX_XMLIO_H_ |