예제 #1
0
void
nsCOMArray_base::RemoveElementsAt(uint32_t aIndex, uint32_t aCount)
{
    nsTArray<nsISupports*> elementsToDestroy(aCount);
    elementsToDestroy.AppendElements(mArray.Elements() + aIndex, aCount);
    mArray.RemoveElementsAt(aIndex, aCount);
    ReleaseObjects(elementsToDestroy);
}
예제 #2
0
bool
nsCOMArray_base::RemoveObjectsAt(int32_t aIndex, int32_t aCount)
{
    if (uint32_t(aIndex) + uint32_t(aCount) <= mArray.Length()) {
        nsTArray<nsISupports*> elementsToDestroy(aCount);
        elementsToDestroy.AppendElements(mArray.Elements() + aIndex, aCount);
        mArray.RemoveElementsAt(aIndex, aCount);
        ReleaseObjects(elementsToDestroy);
        return true;
    }

    return false;
}
예제 #3
0
bool
nsCOMArray_base::RemoveObjectsAt(PRInt32 aIndex, PRInt32 aCount)
{
    if (PRUint32(aIndex) + PRUint32(aCount) <= PRUint32(Count())) {
        nsVoidArray elementsToDestroy(aCount);
        for (PRInt32 i = 0; i < aCount; ++i) {
            elementsToDestroy.InsertElementAt(mArray.FastElementAt(aIndex + i), i);
        }
        bool result = mArray.RemoveElementsAt(aIndex, aCount);
        for (PRInt32 i = 0; i < aCount; ++i) {
            nsISupports* element = static_cast<nsISupports*> (elementsToDestroy.FastElementAt(i));
            NS_IF_RELEASE(element);
        }
        return result;
    }

    return false;
}