MaulingMonkey >> Yes, that's essentially what I wanted. What helped me the most is reading that the statics were stored per-class with templating (don't know why I didn't think about that).
This is what I've gotten to so far: (I've given a lot more of the structure, but it's still relatively simple)
//Once again, assume all scoping/forwarding is correcttypedef (Object*)(*OBJ_FUNC)();class Object { class Type { Type(string name,Type *parent=NULL,OBJ_FUNC func); template<typename T> static Object* NewFunc() { return new T; } }; Type *__type; //The type this object is //Standard typing //Automatic type-handling (inherent type by template) template<typename T=Object,const char *tname="",typename Parent=Object> class Auto : public Parent { static Type type; inline Auto() { __type=&type; } }; friend class Auto; //This doesn't have to be templating, right? static Type type; //Static type - Name?};static Object::Type Object::type("null"); template<typename T=Object,const char *tname="",typename Parent=Object>static Object::Type Object::Auto::type(tname,&Parent::type,&Object::Type::NewFunc<T>);
Of course, the new problem with not having this 'type system' manual is that it can be corrupted by changing the header (templating and all that jazz) and not recompiling the source - but of course, as long as someone handles everything correctly, this shouldn't be too much of a problem.
Also, I'm not able to compile it right now, since I have to fix a couple of other errors in the engine, but now it should be relatively simple to define a new object (without overusing macros).
Elaboration:
//Old Style of defining objectsextern Object::Type tBob;class Bob : public Object { ...}; //In source //This macro is in included header#define OBJECT_TYPE(var,class,parent) Object::Type var( #var, parent, &Object::Type::NewFunc<class> )OBJECT_TYPE(tBob,Bob,NULL);//And from here, you could optionally assign the type - Not something I want to do repetitively//New style (already established)class Bob : public Object::Auto<Bob,"Bob"> { //Not too pretty, but better //And that's about it //Objects aren't required to have types (NOTE: this is for a game engine, not scripting), so they can easily inherit //Major downfalls: Header dependency (stated above), parents HAVE to be defined with similar method, etc};//It can also boil down to (using macros) //DGI is the project namespace#define DGI_OBJECT(name) class name : public Object::Auto<name,#name>#define DGI_OBJECT_EX(name,parent) class name : public Object::Auto<name,#name,parent>//AndDGI_OBJECT(Bob) { ...};//Or: class DGI_OBJECT(Bob) ... (adjusting the macro of course)
Thanks for the help!
Once again, sorry I wasn't entirely clear. Wasn't sure what exactly to say.
EDIT:
As for the naming conventions of my private variables, and using virtual methods to retrieve them, I'm still thinking on those. I'm going to change the name, seeing as how it might conflict with a compiler. But on virtuals, maybe or maybe not - the only problem is performance (vtable lookup and such), obviously minute. As I'm typing this, I'm seeing how much better virtuals'll be.
Thanks again!