forked from 0ad/0ad
Expose JS_HasProperty
This was SVN commit r7449.
This commit is contained in:
parent
1fa8052cbe
commit
cf48ff0588
@ -370,6 +370,18 @@ bool ScriptInterface::GetProperty_(jsval obj, const char* name, jsval& out)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScriptInterface::HasProperty(jsval obj, const char* name)
|
||||
{
|
||||
if (! JSVAL_IS_OBJECT(obj))
|
||||
return false;
|
||||
JSObject* object = JSVAL_TO_OBJECT(obj);
|
||||
|
||||
JSBool found;
|
||||
if (!JS_HasProperty(m->m_cx, object, name, &found))
|
||||
return false;
|
||||
return (found != JS_FALSE);
|
||||
}
|
||||
|
||||
bool ScriptInterface::EnumeratePropertyNamesWithPrefix(jsval obj, const char* prefix, std::vector<std::string>& out)
|
||||
{
|
||||
LOCAL_ROOT_SCOPE;
|
||||
|
@ -130,6 +130,8 @@ public:
|
||||
template<typename T>
|
||||
bool GetProperty(jsval obj, const char* name, T& out);
|
||||
|
||||
bool HasProperty(jsval obj, const char* name);
|
||||
|
||||
bool EnumeratePropertyNamesWithPrefix(jsval obj, const char* prefix, std::vector<std::string>& out);
|
||||
|
||||
bool SetPrototype(jsval obj, jsval proto);
|
||||
|
Loading…
Reference in New Issue
Block a user