2
0

value.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 &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. inline Function(const std::string &type_, Inter &inter_);
  20. virtual CallFunction *getCallFunction(Code *code, Inter &inter) = 0;
  21. virtual inline bool isInfix();
  22. };
  23. class AFUN_CORE_EXPORT Function::CallFunction {
  24. public:
  25. struct ArgCodeList;
  26. CallFunction() = default;
  27. virtual ~CallFunction() = default;
  28. CallFunction(const CallFunction &)=delete;
  29. CallFunction &operator=(const CallFunction &)=delete;
  30. virtual std::list<ArgCodeList> *getArgCodeList() = 0;
  31. virtual void runFunction() = 0;
  32. };
  33. struct Function::CallFunction::ArgCodeList {
  34. Code *code = nullptr;
  35. Object *ret = nullptr;
  36. };
  37. class AFUN_CORE_EXPORT Literaler : public Object {
  38. public:
  39. inline Literaler(const std::string &type_, Inter &inter_);
  40. virtual void getObject(const std::string &literal, char prefix) = 0;
  41. };
  42. class AFUN_CORE_EXPORT CallBackVar : public Object {
  43. public:
  44. inline CallBackVar(const std::string &type_, Inter &inter_);
  45. virtual inline bool isCallBack();
  46. virtual void callBack() = 0;
  47. };
  48. };
  49. #include "value.inline.h"
  50. #endif //AFUN_VALUE_H