31#include "lightclass.h"
38#define isSubclassOf(classname) inheritsFrom(&classname::ClassInfo)
39#define isSuperclassOf(classname) isInheritedBy(&classname::ClassInfo)
41#ifdef WITH_SCRIPT_ENGINE
43# define CLASS_DECLARATION(parentclass, classname, classid) \
44 ClassDef classname::ClassInfo( \
48 (ResponseDef<Class> *)classname::Responses, \
49 classname::_newInstance, \
52 void *classname::_newInstance(void) \
54 return new classname; \
56 ClassDef *classname::classinfo(void) const \
58 return &(classname::ClassInfo); \
60 ClassDef *classname::classinfostatic(void) \
62 return &(classname::ClassInfo); \
64 void classname::AddWaitTill(str s) \
66 classname::ClassInfo.AddWaitTill(s); \
68 void classname::AddWaitTill(const_str s) \
70 classname::ClassInfo.AddWaitTill(s); \
72 void classname::RemoveWaitTill(str s) \
74 classname::ClassInfo.RemoveWaitTill(s); \
76 void classname::RemoveWaitTill(const_str s) \
78 classname::ClassInfo.RemoveWaitTill(s); \
80 bool classname::WaitTillDefined(str s) \
82 return classname::ClassInfo.WaitTillDefined(s); \
84 bool classname::WaitTillDefined(const_str s) \
86 return classname::ClassInfo.WaitTillDefined(s); \
88 bool classname::WaitTillAllowed(str s) \
90 for (ClassDef *c = classinfo(); c; c = c->super) { \
91 if (c->WaitTillDefined(s)) { \
97 bool classname::WaitTillAllowed(const_str s) \
99 for (ClassDef *c = classinfo(); c; c = c->super) { \
100 if (c->WaitTillDefined(s)) { \
106 ResponseDef<classname> classname::Responses[] =
108# define CLASS_PROTOTYPE(classname) \
111 static ClassDef ClassInfo; \
112 static ClassDefHook _ClassInfo_; \
113 static void *_newInstance(void); \
114 static ClassDef *classinfostatic(void); \
115 ClassDef *classinfo(void) const override; \
116 static void AddWaitTill(str s); \
117 static void AddWaitTill(const_str s); \
118 static void RemoveWaitTill(str s); \
119 static void RemoveWaitTill(const_str s); \
120 static bool WaitTillDefined(str s); \
121 static bool WaitTillDefined(const_str s); \
122 bool WaitTillAllowed(str s); \
123 bool WaitTillAllowed(const_str s); \
124 static ResponseDef<classname> Responses[]
128# define CLASS_DECLARATION(parentclass, classname, classid) \
129 ClassDef classname::ClassInfo( \
133 (ResponseDef<Class> *)classname::Responses, \
134 classname::_newInstance, \
137 void *classname::_newInstance(void) \
139 return new classname; \
141 ClassDef *classname::classinfo(void) const \
143 return &(classname::ClassInfo); \
145 ClassDef *classname::classinfostatic(void) \
147 return &(classname::ClassInfo); \
149 ResponseDef<classname> classname::Responses[] =
151# define CLASS_PROTOTYPE(classname) \
154 static ClassDef ClassInfo; \
155 static ClassDefHook _ClassInfo_; \
156 static void *_newInstance(void); \
157 static ClassDef *classinfostatic(void); \
158 ClassDef *classinfo(void) const override; \
159 static ResponseDef<classname> Responses[]
170 void (Type::*response)(
Event *ev);
177 const char *classname;
179 const char *superclass;
180 void *(*newInstance)(void);
188#ifdef WITH_SCRIPT_ENGINE
194 static ClassDef *classlist;
195 static ClassDef *classroot;
196 static int numclasses;
198 static int dump_numclasses;
199 static int dump_numevents;
207 static int compareClasses(
const void *arg1,
const void *arg2);
210#ifdef WITH_SCRIPT_ENGINE
211 void AddWaitTill(
str s);
212 void AddWaitTill(const_str s);
213 void RemoveWaitTill(
str s);
214 void RemoveWaitTill(const_str s);
215 bool WaitTillDefined(
str s);
216 bool WaitTillDefined(const_str s);
221 const char *classname,
223 const char *superclass,
225 void *(*newInstance)(
void),
231 int GetFlags(
Event *event);
236 static void BuildEventResponses();
238 void BuildResponseList();
242qboolean checkInheritance(
const ClassDef *superclass,
const ClassDef *subclass);
243qboolean checkInheritance(
ClassDef *superclass,
const char *subclass);
244qboolean checkInheritance(
const char *superclass,
const char *subclass);
245void CLASS_Print(FILE *class_file,
const char *fmt, ...);
246void ClassEvents(
const char *classname, qboolean print_to_disk);
247void DumpClass(FILE *class_file,
const char *className);
248void DumpAllClasses(
void);
266ClassDef *getClassForID(
const char *name);
267ClassDef *getClass(
const char *name);
269void listAllClasses(
void);
270void listInheritanceOrder(
const char *classname);
278 friend class SafePtrBase;
279 SafePtrBase *SafePtrList;
287 void ClearSafePointers();
292 virtual ClassDef *classinfo(
void)
const;
294 static void *_newInstance(
void);
295 static ClassDef *classinfostatic(
void);
297 void warning(
const char *function,
const char *format, ...)
const;
298 void error(
const char *function,
const char *format, ...)
const;
300 qboolean inheritsFrom(
ClassDef *c)
const;
301 qboolean inheritsFrom(
const char *name)
const;
302 qboolean isInheritedBy(
const char *name)
const;
303 qboolean isInheritedBy(
ClassDef *c)
const;
304 const char *getClassname(
void)
const;
305 const char *getClassID(
void)
const;
306 const char *getSuperclass(
void)
const;
308 virtual void Archive(
Archiver& arc);
Definition container.h:85
Definition listener.h:196
Definition listener.h:246
Definition lightclass.h:30