EntryEnumerator* EntryEnumerator::Create(nsTHashtable<CategoryLeaf>& aTable) { EntryEnumerator* enumObj = new EntryEnumerator(); if (!enumObj) { return nullptr; } enumObj->mArray = new char const* [aTable.Count()]; if (!enumObj->mArray) { delete enumObj; return nullptr; } for (auto iter = aTable.Iter(); !iter.Done(); iter.Next()) { CategoryLeaf* leaf = iter.Get(); if (leaf->value) { enumObj->mArray[enumObj->mCount++] = leaf->GetKey(); } } enumObj->Sort(); return enumObj; }
EntryEnumerator* EntryEnumerator::Create(nsTHashtable<CategoryLeaf>& aTable) { EntryEnumerator* enumObj = new EntryEnumerator(); if (!enumObj) return nullptr; enumObj->mArray = new char const* [aTable.Count()]; if (!enumObj->mArray) { delete enumObj; return nullptr; } aTable.EnumerateEntries(enumfunc_createenumerator, enumObj); enumObj->Sort(); return enumObj; }