diff options
author | 2024-02-24 16:04:00 +0600 | |
---|---|---|
committer | 2024-02-24 16:04:00 +0600 | |
commit | 6277feb3be69788eac9e40a52c3a1c10f6d1311f (patch) | |
tree | 64afe50c819ea74b6b87c27afe4ac5fc4688d5e1 /src/cobj.h | |
parent | 7455c3d0bda6ab60d3f67fafd0ce04428143bcbe (diff) | |
download | c-obp-example-6277feb3be69788eac9e40a52c3a1c10f6d1311f.tar.gz c-obp-example-6277feb3be69788eac9e40a52c3a1c10f6d1311f.zip |
Use CLASS construct to define class
Signed-off-by: Mubashshir <ahmubashshir@gmail.com>
Diffstat (limited to '')
-rw-r--r-- | src/cobj.h | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -10,6 +10,7 @@ #endif /* __COBJ_IMPLS_H__ */ #if defined(__USE_C_OBJSYS__) +# undef CLASS # undef GETTER # undef SETTER # undef DEFINE @@ -18,6 +19,10 @@ # undef __USE_C_OBJSYS__ #elif defined(__COBJ_PRIV_IMPLS_H__) # define UNUSED(arg) while(0 && (arg)) +# define CLASS(klass, data) \ + typedef struct klass##_impl_struct data __ ## klass ## _impl +# define TYPE(klass) \ + __ ## klass ## _impl # define GETTER(klass, field, type, body, ...) \ type klass##_get_##field(klass self, ## __VA_ARGS__) \ body @@ -34,6 +39,8 @@ void klass ## _del(klass self, ## __VA_ARGS__) \ body #else +# define CLASS(klass) \ + typedef struct klass ## _impl_struct * klass # define GETTER(klass, field, type, ...) \ type klass##_get_##field(klass self, ## __VA_ARGS__) # define SETTER(klass, field, type, ...) \ |