2020-03-31 11:48:38 +00:00
|
|
|
#include <string.h>
|
2020-06-21 14:15:17 +00:00
|
|
|
#include "ruamoko/qwaq/debugger/views/basicview.h"
|
|
|
|
#include "ruamoko/qwaq/debugger/views/nameview.h"
|
2020-03-31 11:48:38 +00:00
|
|
|
|
|
|
|
static string type_views[] = {
|
|
|
|
"VoidView",
|
|
|
|
"StringView",
|
|
|
|
"FloatView",
|
|
|
|
"VectorView",
|
|
|
|
"EntityView",
|
|
|
|
"FieldView",
|
|
|
|
"FuncView",
|
|
|
|
"PointerView",
|
|
|
|
"QuatView",
|
|
|
|
"IntView",
|
|
|
|
"UIntView", // uinteger
|
|
|
|
"IntView", // short
|
|
|
|
"DoubleView",
|
|
|
|
};
|
|
|
|
|
|
|
|
@implementation BasicView
|
|
|
|
|
|
|
|
-init
|
|
|
|
{
|
|
|
|
if (!(self = [super init])) {
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2021-06-01 14:52:04 +00:00
|
|
|
+(DefView *)withDef:(qdb_def_t)def in:(void *)data type:(qfot_type_t *)type
|
2020-03-31 11:48:38 +00:00
|
|
|
{
|
|
|
|
string typename = nil;
|
|
|
|
if (type.type == ty_alias) {
|
|
|
|
type = type.alias.aux_type;
|
|
|
|
}
|
|
|
|
if (type.type >= 0
|
|
|
|
&& type.type < sizeof(type_views) / sizeof (type_views[0])) {
|
|
|
|
typename = type_views[type.type];
|
|
|
|
}
|
|
|
|
id class = obj_lookup_class (typename);
|
|
|
|
if (class) {
|
2021-06-01 14:52:04 +00:00
|
|
|
return [class withDef:def in:data type:type];
|
2020-03-31 11:48:38 +00:00
|
|
|
}
|
2020-04-01 10:57:24 +00:00
|
|
|
return [NameView withName:"Invalid Type"];
|
2020-03-31 11:48:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|