object.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef AFUN_OBJECT
  2. #define AFUN_OBJECT
  3. #include "aFunCoreExport.h"
  4. #include "tool.hpp"
  5. typedef uint32_t ObjAPIUint;
  6. typedef struct af_Object af_Object;
  7. typedef struct af_Inherit af_Inherit;
  8. typedef struct af_ObjectAPI af_ObjectAPI;
  9. /* 对象API函数 DLC */
  10. typedef void objectAPIFunc();
  11. DEFINE_DLC_SYMBOL(objectAPIFunc);
  12. #include "env.hpp"
  13. #include "var.hpp"
  14. /* 对象创建 */
  15. AFUN_CORE_EXPORT af_Object * makeObject(const char *id, bool free_api, af_ObjectAPI *api, bool allow_inherit,
  16. af_Object *belong, bool free_inherit, af_Inherit *inherit,
  17. af_Environment *env);
  18. /* API表 创建与释放 */
  19. AFUN_CORE_EXPORT af_ObjectAPI *makeObjectAPI();
  20. AFUN_CORE_EXPORT void freeObjectAPI(af_ObjectAPI *api);
  21. /* 对象继承表 创建与释放 */
  22. AFUN_CORE_EXPORT af_Inherit *makeInherit(af_Object *obj);
  23. AFUN_CORE_EXPORT void freeAllInherit(af_Inherit *ih);
  24. /* 对象 相关操作 */
  25. AFUN_CORE_EXPORT bool setObjectAttributes(const char *name, char p_self, char p_posterity, char p_external, af_Object *attributes,
  26. af_Object *obj, af_Object *visitor, af_Environment *env);
  27. AFUN_CORE_EXPORT void objectSetAllowInherit(af_Object *obj, bool allow);
  28. /* API表 相关操作 */
  29. AFUN_CORE_EXPORT int addAPI(DLC_SYMBOL(objectAPIFunc) func, const char *api_name, af_ObjectAPI *api);
  30. AFUN_CORE_EXPORT int addAPIToObject(DLC_SYMBOL(objectAPIFunc) func, const char *api_name, af_Object *obj);
  31. /* 对象继承表 相关操作 */
  32. AFUN_CORE_EXPORT af_Inherit **pushInherit(af_Inherit **base, af_Inherit *new_ih);
  33. /* 对象 属性访问 */
  34. AFUN_CORE_EXPORT void *getObjectData(af_Object *obj);
  35. AFUN_CORE_EXPORT af_Object *getBelongObject(af_Object *object);
  36. AFUN_CORE_EXPORT af_Object *findObjectAttributes(char *name, af_Object *visitor, af_Object *obj, af_Environment *env);
  37. AFUN_CORE_EXPORT const char *getObjectID(af_Object *obj);
  38. AFUN_CORE_EXPORT af_ObjectAPI *getObjectAPI(af_Object *obj);
  39. AFUN_CORE_EXPORT af_Inherit *getObjectInherit(af_Object *obj);
  40. AFUN_CORE_EXPORT af_VarSpace *getObjectVarSpace(af_Object *obj);
  41. AFUN_CORE_EXPORT bool isObjectAllowInherit(af_Object *obj);
  42. /* API表 属性访问 */
  43. AFUN_CORE_EXPORT objectAPIFunc *findAPI(const char *api_name, af_ObjectAPI *api);
  44. AFUN_CORE_EXPORT objectAPIFunc *findObjectAPI(const char *api_name, af_Object *obj);
  45. AFUN_CORE_EXPORT ObjAPIUint getAPICount(af_ObjectAPI *api);
  46. /* 对象继承表 属性访问 */
  47. AFUN_CORE_EXPORT bool checkPosterity(af_Object *base, af_Object *posterity);
  48. AFUN_CORE_EXPORT af_Inherit *getInheritNext(af_Inherit *ih);
  49. AFUN_CORE_EXPORT af_Object *getInheritObject(af_Inherit *ih);
  50. AFUN_CORE_EXPORT af_VarSpace *getInheritVarSpace(af_Inherit *ih);
  51. #endif //AFUN_OBJECT