Permalink
Browse files

Merge pull request #169 from dbluelle/array

implement deleting of elements in array
  • Loading branch information...
aajanki committed Jan 23, 2012
2 parents 482275c + 59ace24 commit 6d14c6085475a1edd41318eae878676c83087d84
Showing with 19 additions and 0 deletions.
  1. +18 −0 src/scripting/toplevel/Array.cpp
  2. +1 −0 src/scripting/toplevel/Array.h
@@ -870,6 +870,24 @@ void Array::setVariableByMultiname(const multiname& name, ASObject* o)
}
}
bool Array::deleteVariableByMultiname(const multiname& name)
{
assert_and_throw(implEnable);
unsigned int index=0;
if(!isValidMultiname(name,index))
return ASObject::deleteVariableByMultiname(name);
if(index>=data.capacity())
return true;
if(data[index].type==DATA_OBJECT && data[index].data)
data[index].data->decRef();
data[index].data=NULL;
data[index].type=DATA_OBJECT;
return true;
}
bool Array::isValidQName(const tiny_string& name, const tiny_string& ns, unsigned int& index)
{
if(ns!="")
@@ -128,6 +128,7 @@ CLASSBUILDABLE(Array);
_NR<ASObject> getVariableByMultiname(const multiname& name, GET_VARIABLE_OPTION opt);
int32_t getVariableByMultiname_i(const multiname& name);
void setVariableByMultiname(const multiname& name, ASObject* o);
bool deleteVariableByMultiname(const multiname& name);
void setVariableByMultiname_i(const multiname& name, int32_t value);
bool hasPropertyByMultiname(const multiname& name, bool considerDynamic);
tiny_string toString();

0 comments on commit 6d14c60

Please sign in to comment.