var.inline.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef AFUN_VAR_INLINE_H
  2. #define AFUN_VAR_INLINE_H
  3. #include "var.h"
  4. namespace aFuncore {
  5. inline Object *Var::getData() {
  6. return data;
  7. }
  8. inline void Var::setData(Object *data_) {
  9. data = data_;
  10. }
  11. inline size_t VarSpace::getCount() const {
  12. return count;
  13. }
  14. inline Object *VarSpace::findObject(const std::string &name) {
  15. Var *ret = findVar(name);
  16. return ret ? ret->getData() : nullptr;
  17. }
  18. inline ProtectVarSpace::ProtectVarSpace(Inter &inter) : VarSpace(inter), is_protect{false} {
  19. }
  20. inline ProtectVarSpace::ProtectVarSpace(Environment &env_) : VarSpace(env_), is_protect{false} {
  21. }
  22. inline bool ProtectVarSpace::getProtect() const {
  23. return is_protect;
  24. }
  25. inline bool ProtectVarSpace::setProtect(bool protect) {
  26. bool ret = is_protect; is_protect = protect; return ret;
  27. }
  28. inline VarList::VarList(VarSpace *varspace) {
  29. this->varspace.push_front(varspace);
  30. }
  31. inline void VarList::push(VarSpace *varspace_) {
  32. varspace.push_front(varspace_);
  33. }
  34. inline Object *VarList::findObject(const std::string &name) {
  35. Var *var = findVar(name);
  36. return var ? var->getData() : nullptr;
  37. }
  38. }
  39. #endif //AFUN_VAR_INLINE_H