remove macros use in objects mofule
This commit is contained in:
parent
0fb9326c08
commit
7927226484
31 changed files with 362 additions and 386 deletions
|
|
@ -19,7 +19,7 @@ namespace tp::obj {
|
|||
void addMember(Object* obj, const std::string& id);
|
||||
void createMember(const std::string& type, const std::string& id);
|
||||
|
||||
template<typename Type>
|
||||
template <typename Type>
|
||||
Type* createMember(const std::string& id) {
|
||||
auto out = NDO->create(Type::TypeData.name);
|
||||
addMember(out, id);
|
||||
|
|
@ -27,19 +27,19 @@ namespace tp::obj {
|
|||
return (Type*) out;
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
template <typename Type>
|
||||
Type* getMember(const std::string& id) {
|
||||
auto idx = members->presents(id);
|
||||
if (bool(idx)) {
|
||||
return ((Type*)ndo_cast(members->getSlotVal(idx), &Type::TypeData));
|
||||
return objects_api::cast<Type>(members->getSlotVal(idx));
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
template <typename Type>
|
||||
Type* getMemberAssert(const std::string& id) {
|
||||
auto out = getMember<Type>(id);
|
||||
assert(out && "invalid member access");
|
||||
ASSERT(out && "invalid member access")
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace tp::obj {
|
|||
static ObjectType TypeData;
|
||||
static ObjectTypeAriphmetics TypeAriphm;
|
||||
|
||||
static void constructor(Object* self);
|
||||
static void constructor(ColorObject* self);
|
||||
static void copy(ColorObject* self, const ColorObject* in);
|
||||
|
||||
static void from_int(ColorObject* self, alni in);
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ namespace tp::obj {
|
|||
|
||||
struct DictObject : Object {
|
||||
static ObjectType TypeData;
|
||||
static void copy(Object* self, const Object* in);
|
||||
static void destructor(Object* self);
|
||||
static void constructor(Object* self);
|
||||
static void copy(DictObject* self, const DictObject* in);
|
||||
static void destructor(DictObject* self);
|
||||
static void constructor(DictObject* self);
|
||||
|
||||
static alni save_size(DictObject* self);
|
||||
static void save(DictObject* self, ArchiverOut& file_self);
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@ namespace tp::obj {
|
|||
static ObjectType TypeData;
|
||||
static ObjectTypeAriphmetics TypeAriphm;
|
||||
|
||||
static void constructor(Object* self);
|
||||
static void constructor(IntObject* self);
|
||||
static void copy(IntObject* self, const IntObject* in);
|
||||
static IntObject* create(alni in);
|
||||
|
||||
static void from_int(Object* self, alni in);
|
||||
static void from_float(Object* self, alnf in);
|
||||
static void from_string(Object* self, const std::string& in);
|
||||
static std::string to_string(Object* self);
|
||||
static alni to_int(Object* self);
|
||||
static alnf to_float(Object* self);
|
||||
static void from_int(IntObject* self, alni in);
|
||||
static void from_float(IntObject* self, alnf in);
|
||||
static void from_string(IntObject* self, const std::string& in);
|
||||
static std::string to_string(IntObject* self);
|
||||
static alni to_int(IntObject* self);
|
||||
static alnf to_float(IntObject* self);
|
||||
};
|
||||
}
|
||||
|
|
@ -7,9 +7,10 @@ namespace tp::obj {
|
|||
|
||||
struct LinkObject : Object {
|
||||
static ObjectType TypeData;
|
||||
static void constructor(Object* self);
|
||||
|
||||
static void constructor(LinkObject* self);
|
||||
static void destructor(LinkObject* self);
|
||||
static void copy(Object* self, const Object* in);
|
||||
static void copy(LinkObject* self, const LinkObject* in);
|
||||
static LinkObject* create(Object* in);
|
||||
|
||||
static alni save_size(LinkObject* self);
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ namespace tp::obj {
|
|||
|
||||
struct ListObject : Object {
|
||||
static ObjectType TypeData;
|
||||
static void constructor(Object* self);
|
||||
static void copy(Object* self, const Object* in);
|
||||
static void destructor(Object* self);
|
||||
static void constructor(ListObject* self);
|
||||
static void copy(ListObject* self, const ListObject* in);
|
||||
static void destructor(ListObject* self);
|
||||
|
||||
static alni allocated_size_recursive(ListObject* self);
|
||||
static alni allocated_size(ListObject* self);
|
||||
|
|
|
|||
|
|
@ -9,9 +9,10 @@ namespace tp::obj {
|
|||
std::string val;
|
||||
|
||||
static ObjectType TypeData;
|
||||
static void constructor(Object* self);
|
||||
static void constructor(StringObject* self);
|
||||
static void destructor(StringObject* self);
|
||||
static void copy(Object* self, const Object* in);
|
||||
static void copy(StringObject* self, const StringObject* in);
|
||||
|
||||
static StringObject* create(const std::string& in);
|
||||
|
||||
static void from_int(StringObject* self, alni in);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue