Get rid of wxList and wxArray in wxModule code
Simply use wxVector instead, this shouldn't be less efficient (we rarely remove the modules from the list and iterating over a vector should actually be faster, as well as consuming less memory), but it avoids ugly macros, is simpler to use and to debug and will be trivial to replace with std::vector<> in the future. No real changes, this is just pure cleanup.
This commit is contained in:
@@ -12,18 +12,11 @@
|
||||
#define _WX_MODULE_H_
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/arrstr.h"
|
||||
#include "wx/dynarray.h"
|
||||
#include "wx/vector.h"
|
||||
|
||||
// declare a linked list of modules
|
||||
class WXDLLIMPEXP_FWD_BASE wxModule;
|
||||
WX_DECLARE_USER_EXPORTED_LIST(wxModule, wxModuleList, WXDLLIMPEXP_BASE);
|
||||
|
||||
// and an array of class info objects
|
||||
WX_DEFINE_USER_EXPORTED_ARRAY_PTR(wxClassInfo *, wxArrayClassInfo,
|
||||
class WXDLLIMPEXP_BASE);
|
||||
class wxModule;
|
||||
|
||||
typedef wxVector<wxModule*> wxModuleList;
|
||||
|
||||
// declaring a class derived from wxModule will automatically create an
|
||||
// instance of this class on program startup, call its OnInit() method and call
|
||||
@@ -70,14 +63,14 @@ protected:
|
||||
{
|
||||
wxCHECK_RET( dep, wxT("NULL module dependency") );
|
||||
|
||||
m_dependencies.Add(dep);
|
||||
m_dependencies.push_back(dep);
|
||||
}
|
||||
|
||||
// same as the version above except it will look up wxClassInfo by name on
|
||||
// its own. Note that className must be ASCII
|
||||
void AddDependency(const char *className)
|
||||
{
|
||||
m_namedDependencies.Add(wxASCII_STR(className));
|
||||
m_namedDependencies.push_back(wxASCII_STR(className));
|
||||
}
|
||||
|
||||
|
||||
@@ -98,11 +91,12 @@ private:
|
||||
|
||||
// module dependencies: contains wxClassInfo pointers for all modules which
|
||||
// must be initialized before this one
|
||||
typedef wxVector<wxClassInfo*> wxArrayClassInfo;
|
||||
wxArrayClassInfo m_dependencies;
|
||||
|
||||
// and the named dependencies: those will be resolved during run-time and
|
||||
// added to m_dependencies
|
||||
wxArrayString m_namedDependencies;
|
||||
wxVector<wxString> m_namedDependencies;
|
||||
|
||||
// used internally while initializing/cleaning up modules
|
||||
enum
|
||||
|
Reference in New Issue
Block a user