Browse Source

Make template Get available for modules.

ObjPtr
Michael Uleysky 9 years ago
parent
commit
b442834bdc
  1. 11
      include/builtin.h
  2. 13
      include/common.h

11
include/builtin.h

@ -7,14 +7,3 @@ ObjectBase* Arifm_Div(const ObjectList* input);
ObjectBase* Arifm_Pow(const ObjectList* input);
ObjectBase* Arifm_Neg(const ObjectList* input);
ObjectBase* Arifm_Pos(const ObjectList* input);
template<class T>
ObjectBase* Get(const ObjectList* input)
{
if(input->Size()!=2) return 0;
OBType<T> ob(input->At(0));
OBType<ObjectString> name(input->At(1));
if(!(ob && name)) return 0;
return ob->Get(name->Value());
}

13
include/common.h

@ -278,4 +278,15 @@ EXPORT void RegisterFunction(const std::string& name, Func func);
EXPORT int LoadModule(const std::string& name, const void* p, const std::string& modname="");
}
#endif
template<class T>
ObjectBase* Get(const ObjectList* input)
{
if(input->Size()!=2) return 0;
OBType<T> ob(input->At(0));
OBType<ObjectString> name(input->At(1));
if(!(ob && name)) return 0;
return ob->Get(name->Value());
}
#endif

Loading…
Cancel
Save