value.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef AFUN_VALUE_H
  2. #define AFUN_VALUE_H
  3. #include "aFuntool.h"
  4. #include "aFunCoreExport.h"
  5. #include "list"
  6. #include "core.h"
  7. #include "gc.h"
  8. namespace aFuncore {
  9. class AFUN_CORE_EXPORT Object : public GcObject<class Object> {
  10. public:
  11. Inter *const inter;
  12. const std::string type; // 标识 Object 的字符串
  13. explicit Object(const std::string &type_, Inter *inter_);
  14. ~Object() override =default;
  15. };
  16. class AFUN_CORE_EXPORT Function : public Object {
  17. public:
  18. class AFUN_CORE_EXPORT CallFunction {
  19. public:
  20. struct ArgCodeList {
  21. Code *code = nullptr;
  22. Object *ret = nullptr;
  23. };
  24. CallFunction() = default;
  25. virtual ~CallFunction() = default;
  26. CallFunction(const CallFunction &)=delete;
  27. CallFunction &operator=(const CallFunction &)=delete;
  28. virtual std::list<ArgCodeList> *getArgCodeList() = 0;
  29. virtual void runFunction() = 0;
  30. };
  31. Function(const std::string &type_, Inter *inter_);
  32. virtual CallFunction *getCallFunction(Code *code, Inter *inter) = 0;
  33. virtual bool isInfix();
  34. };
  35. class AFUN_CORE_EXPORT Literaler : public Object {
  36. public:
  37. Literaler(const std::string &type_, Inter *inter_);
  38. virtual void getObject(const std::string &literal, char prefix) = 0;
  39. };
  40. class AFUN_CORE_EXPORT CallBackVar : public Object {
  41. public:
  42. CallBackVar(const std::string &type_, Inter *inter_);
  43. virtual bool isCallBack();
  44. virtual void callBack() = 0;
  45. };
  46. };
  47. #include "value.inline.h"
  48. #endif //AFUN_VALUE_H