X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cc30b233fb58d6295028dcd6f0f2957e91618849..e14d10b039e68a701a447043a4031cf43e9fa90b:/contrib/include/wx/xrc/xml.h diff --git a/contrib/include/wx/xrc/xml.h b/contrib/include/wx/xrc/xml.h index 28037b6925..c65d1364ff 100644 --- a/contrib/include/wx/xrc/xml.h +++ b/contrib/include/wx/xrc/xml.h @@ -11,7 +11,7 @@ #ifndef _WX_XML_H_ #define _WX_XML_H_ -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(__APPLE__) #pragma interface "xml.h" #endif @@ -20,16 +20,18 @@ #include "wx/object.h" #include "wx/list.h" -#ifdef WXXMLISDLL -#define WXXMLDLLEXPORT WXDLLEXPORT -#else -#define WXXMLDLLEXPORT +#ifdef WXMAKINGDLL_XRC + #define WXDLLIMPEXP_XRC WXEXPORT +#elif defined(WXUSINGDLL) + #define WXDLLIMPEXP_XRC WXIMPORT +#else // not making nor using DLL + #define WXDLLIMPEXP_XRC #endif -class WXXMLDLLEXPORT wxXmlNode; -class WXXMLDLLEXPORT wxXmlProperty; -class WXXMLDLLEXPORT wxXmlDocument; -class WXXMLDLLEXPORT wxXmlIOHandler; +class WXDLLIMPEXP_XRC wxXmlNode; +class WXDLLIMPEXP_XRC wxXmlProperty; +class WXDLLIMPEXP_XRC wxXmlDocument; +class WXDLLIMPEXP_XRC wxXmlIOHandler; class WXDLLEXPORT wxInputStream; class WXDLLEXPORT wxOutputStream; @@ -54,23 +56,11 @@ enum wxXmlNodeType }; -// Types of XML files: - -enum wxXmlIOType -{ - wxXML_IO_AUTO = 0, // detect it automatically - wxXML_IO_EXPAT, // use Expat to load from text/xml document - wxXML_IO_TEXT_OUTPUT, // generic saver into text/xml - wxXML_IO_BIN, // save in binary uncompressed proprietary format - wxXML_IO_BINZ // svae in binary zlib-compressed proprietary format -}; - - // Represents node property(ies). // Example: in "src" is property with value // "hello.gif" and "id" is prop. with value "3". -class WXXMLDLLEXPORT wxXmlProperty +class WXDLLIMPEXP_XRC wxXmlProperty { public: wxXmlProperty() : m_next(NULL) {} @@ -103,7 +93,7 @@ private: // If wxUSE_UNICODE is 0, all strings are encoded in the encoding given to Load // (default is UTF-8). -class WXXMLDLLEXPORT wxXmlNode +class WXDLLIMPEXP_XRC wxXmlNode { public: wxXmlNode() : m_properties(NULL), m_parent(NULL), @@ -173,15 +163,13 @@ private: // This class holds XML data/document as parsed by XML parser. -class WXXMLDLLEXPORT wxXmlDocument : public wxObject +class WXDLLIMPEXP_XRC wxXmlDocument : public wxObject { public: - wxXmlDocument() : wxObject(), m_version(wxT("1.0")), m_root(NULL) {} + wxXmlDocument(); wxXmlDocument(const wxString& filename, - wxXmlIOType io_type = wxXML_IO_AUTO, const wxString& encoding = wxT("UTF-8")); wxXmlDocument(wxInputStream& stream, - wxXmlIOType io_type = wxXML_IO_AUTO, const wxString& encoding = wxT("UTF-8")); ~wxXmlDocument() { delete m_root; } @@ -191,17 +179,13 @@ public: // Parses .xml file and loads data. Returns TRUE on success, FALSE // otherwise. bool Load(const wxString& filename, - wxXmlIOType io_type = wxXML_IO_AUTO, const wxString& encoding = wxT("UTF-8")); bool Load(wxInputStream& stream, - wxXmlIOType io_type = wxXML_IO_AUTO, const wxString& encoding = wxT("UTF-8")); - + // Saves document as .xml file. - bool Save(const wxString& filename, - wxXmlIOType io_type = wxXML_IO_TEXT_OUTPUT) const; - bool Save(wxOutputStream& stream, - wxXmlIOType io_type = wxXML_IO_TEXT_OUTPUT) const; + bool Save(const wxString& filename) const; + bool Save(wxOutputStream& stream) const; bool IsOk() const { return m_root != NULL; } @@ -211,7 +195,7 @@ public: // Returns version of document (may be empty). wxString GetVersion() const { return m_version; } // Returns encoding of document (may be empty). - // Note: this is the encoding original fail was saved in, *not* the + // Note: this is the encoding original file was saved in, *not* the // encoding of in-memory representation! wxString GetFileEncoding() const { return m_fileEncoding; } @@ -225,15 +209,9 @@ public: // (same as passed to Load or ctor, defaults to UTF-8). // NB: this is meaningless in Unicode build where data are stored as wchar_t* wxString GetEncoding() const { return m_encoding; } + void SetEncoding(const wxString& enc) { m_encoding = enc; } #endif - static void AddHandler(wxXmlIOHandler *handler); - static void CleanUpHandlers(); - static void InitStandardHandlers(); - -protected: - static wxList *sm_handlers; - private: wxString m_version; wxString m_fileEncoding; @@ -245,27 +223,4 @@ private: void DoCopy(const wxXmlDocument& doc); }; - - -// wxXmlIOHandler takes care of loading and/or saving XML data. -// see xmlio.h for available handlers - -class WXXMLDLLEXPORT wxXmlIOHandler : public wxObject -{ - public: - wxXmlIOHandler() {} - - virtual wxXmlIOType GetType() = 0; - virtual bool CanLoad(wxInputStream& stream) = 0; - virtual bool CanSave() = 0; - - virtual bool Load(wxInputStream& stream, wxXmlDocument& doc, - const wxString& encoding) = 0; - virtual bool Save(wxOutputStream& stream, const wxXmlDocument& doc) = 0; -}; - - - -void wxXmlInitXmlModule(); - #endif // _WX_XML_H_