]> git.saurik.com Git - wxWidgets.git/blobdiff - src/xrc/xmlres.cpp
export statement added
[wxWidgets.git] / src / xrc / xmlres.cpp
index a802efe57c67771eeb428a4b55402200bf8e4f04..ade30b60395046eb4a00322f81af7f1908ca1fba 100644 (file)
 WX_DEFINE_OBJARRAY(wxXmlResourceDataRecords);
 
 
+wxXmlResource *wxXmlResource::ms_instance = NULL;
+
+/*static*/ wxXmlResource *wxXmlResource::Get()
+{
+    if ( !ms_instance )
+        ms_instance = new wxXmlResource;
+    return ms_instance;
+}
+
+/*static*/ wxXmlResource *wxXmlResource::Set(wxXmlResource *res)
+{
+    wxXmlResource *old = ms_instance;
+    ms_instance = res;
+    return old;
+}
+
 wxXmlResource::wxXmlResource(int flags)
 {
     m_handlers.DeleteContents(TRUE);
@@ -1085,21 +1101,18 @@ static void CleanXMLID_Records()
 
 // --------------- module and globals -----------------------------
 
-
-static wxXmlResource gs_XmlResource;
-
-wxXmlResource *wxTheXmlResource = &gs_XmlResource;
-
-
 class wxXmlResourceModule: public wxModule
 {
 DECLARE_DYNAMIC_CLASS(wxXmlResourceModule)
 public:
     wxXmlResourceModule() {}
-    bool OnInit() {return TRUE;}
+    bool OnInit()
+    {
+        return TRUE;
+    }
     void OnExit()
     {
-        wxTheXmlResource->ClearHandlers();
+        delete wxXmlResource::Set(NULL);
         CleanXMLID_Records();
     }
 };