chore: improved mirror macro isolation
This commit is contained in:
		
							parent
							
								
									eab5961989
								
							
						
					
					
						commit
						172d1ee10e
					
				
							
								
								
									
										10
									
								
								mirror.h
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								mirror.h
									
									
									
									
									
								
							|  | @ -56,17 +56,17 @@ extern void* mirror_get_function(void* data, IMirror const* tc, const char* type | |||
| // example:
 | ||||
| // TC_CAST(physics_entity, BehaviourEntity)
 | ||||
| #define TC_CAST(From_, To_)\ | ||||
| MIRROR_GET_WRAP_FUNC(From_.data, From_.mirror, To_)(From_.data) | ||||
| (MIRROR_GET_WRAP_FUNC(From_.data, From_.mirror, To_)(From_.data)) | ||||
| 
 | ||||
| #define TC_MIRRORS(From_, To_)\ | ||||
| MIRROR_GET_WRAP_FUNC(From_.data, From_.mirror, To_) != NULL | ||||
| (MIRROR_GET_WRAP_FUNC(From_.data, From_.mirror, To_) != NULL) | ||||
| 
 | ||||
| #define MIRROR_TRY_WRAP(Into_, Mirror_, Typeclass_){\ | ||||
| #define MIRROR_TRY_WRAP(Into_, Mirror_, Typeclass_)do{\ | ||||
|     MirroredTypeclassWrapFunc fn_ = mirror_get_typeclass(Mirror_, #Typeclass_);\ | ||||
|     if(fn_ != NULL) {\ | ||||
|         Into_ = (TypeClass_)fn(Mirror_->data);\ | ||||
|         Into_ = (TypeClass_)fn_(Mirror_->data);\ | ||||
|     }\ | ||||
| } | ||||
| } while(0) | ||||
| 
 | ||||
| #define impl_Mirror_for(T, get_typestring_f, get_typeid_f, get_typeclasses_f)\ | ||||
| Mirror T##_as_Mirror(T* x) {\ | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Sara
						Sara