1
0

object.hpp 2.7 KB

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