* wxCreateDynamicObject() uses an hashtable now
* wxClassInfo::first = NULL after the hashtable is initialized * dynlib has been simplified. * Some fix in the serialization core and in wxObject::StoreObject()/LoadObject() * Updates in utils/serialize/sermain.cpp git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@645 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -8,53 +8,19 @@
|
||||
#include <wx/string.h>
|
||||
#include <wx/list.h>
|
||||
#include <wx/dynarray.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Some more info on a class
|
||||
|
||||
typedef struct {
|
||||
wxClassInfo *class_info;
|
||||
wxString path;
|
||||
} wxClassLibInfo;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Useful arrays
|
||||
|
||||
WX_DEFINE_ARRAY(wxClassInfo *, wxArrayClassInfo);
|
||||
WX_DEFINE_ARRAY(wxClassLibInfo *, wxArrayClassLibInfo);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxClassLibrary
|
||||
|
||||
class wxClassLibrary {
|
||||
protected:
|
||||
wxArrayClassLibInfo m_list;
|
||||
public:
|
||||
wxClassLibrary(void);
|
||||
~wxClassLibrary(void);
|
||||
|
||||
// Dynamic (un)register a (new) class in the database
|
||||
void RegisterClass(wxClassInfo *class_info, const wxString& path);
|
||||
void UnregisterClass(wxClassInfo *class_info);
|
||||
|
||||
// Fetch all infos whose name matches the string (wildcards allowed)
|
||||
bool FetchInfos(const wxString& path, wxArrayClassLibInfo& infos);
|
||||
|
||||
// Create all objects whose name matches the string (wildcards allowed)
|
||||
bool CreateObjects(const wxString& path, wxArrayClassInfo& objs);
|
||||
|
||||
// Create one object using the EXACT name
|
||||
wxObject *CreateObject(const wxString& path);
|
||||
};
|
||||
#include <wx/hash.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxLibrary
|
||||
|
||||
class wxLibrary: public wxObject {
|
||||
protected:
|
||||
wxClassLibrary *m_liblist;
|
||||
protected:
|
||||
void *m_handle;
|
||||
public:
|
||||
bool m_destroy;
|
||||
public:
|
||||
wxHashTable classTable;
|
||||
|
||||
public:
|
||||
wxLibrary(void *handle);
|
||||
~wxLibrary(void);
|
||||
|
||||
@@ -64,16 +30,21 @@ public:
|
||||
// Create the object whose classname is "name"
|
||||
wxObject *CreateObject(const wxString& name);
|
||||
|
||||
wxClassLibrary *ClassLib() const;
|
||||
// Merge the symbols with the main symbols: WARNING! the library will not
|
||||
// be unloaded.
|
||||
void MergeWithSystem();
|
||||
|
||||
protected:
|
||||
void PrepareClasses(wxClassInfo **first);
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// wxLibraries
|
||||
|
||||
class wxLibraries {
|
||||
protected:
|
||||
protected:
|
||||
wxList m_loaded;
|
||||
public:
|
||||
public:
|
||||
wxLibraries(void);
|
||||
~wxLibraries(void);
|
||||
|
||||
@@ -89,7 +60,10 @@ extern wxLibraries wxTheLibraries;
|
||||
// ---------------------------------------------------------------------------
|
||||
// Interesting defines
|
||||
|
||||
#define WXDLL_ENTRY_FUNCTION() extern "C" wxClassLibrary *GetClassList()
|
||||
#define WXDLL_EXIT_FUNCTION(param) extern "C" void FreeClassList(wxClassLibrary *param)
|
||||
#define WXDLL_ENTRY_FUNCTION() \
|
||||
extern "C" wxClassInfo **wxGetClassFirst(); \
|
||||
wxClassInfo **wxGetClassFirst() { \
|
||||
return &wxClassInfo::first; \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -29,10 +29,12 @@ class WXDLLEXPORT wxObject;
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxClassInfo;
|
||||
class WXDLLEXPORT ostream;
|
||||
class WXDLLIMPORT ostream;
|
||||
class WXDLLEXPORT wxInputStream;
|
||||
class WXDLLIMPORT wxObjectInputStream;
|
||||
class WXDLLIMPORT wxObjectOutputStream;
|
||||
class WXDLLEXPORT wxObjectInputStream;
|
||||
class WXDLLEXPORT wxObjectOutputStream;
|
||||
class WXDLLEXPORT wxHashTable;
|
||||
class WXDLLEXPORT wxObject_Serialize;
|
||||
|
||||
/*
|
||||
* Dynamic object system declarations
|
||||
@@ -57,6 +59,8 @@ class WXDLLEXPORT wxClassInfo
|
||||
static wxClassInfo *first;
|
||||
wxClassInfo *next;
|
||||
|
||||
static wxHashTable classTable;
|
||||
|
||||
wxClassInfo(char *cName, char *baseName1, char *baseName2, int sz, wxObjectConstructorFn fn);
|
||||
|
||||
wxObject *CreateObject(void);
|
||||
@@ -195,6 +199,9 @@ class WXDLLEXPORT wxObject
|
||||
|
||||
protected:
|
||||
wxObjectRefData *m_refData;
|
||||
#ifdef USE_STORABLE_CLASSES
|
||||
wxObject_Serialize *m_serialObj;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
|
@@ -65,6 +65,10 @@
|
||||
#include "wx/dirdlg.h"
|
||||
#include "wx/cmndata.h"
|
||||
#include "wx/intl.h"
|
||||
#ifdef USE_STORABLE_CLASSES
|
||||
#include "wx/objstrm.h"
|
||||
#include "wx/serbase.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// _WX_WXH__
|
||||
|
Reference in New Issue
Block a user