Reviewed by Darin.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Sep 2007 05:01:03 +0000 (05:01 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 5 Sep 2007 05:01:03 +0000 (05:01 +0000)
commit08d3ce232bf79b061a2b655203a106ea5b21dde3
tree0a8def9da706bba6301db46ff081bf390b55230d
parentf7051c2ed32d5cc5a4d390e7c47e0f7caea9bd21
    Reviewed by Darin.

        - Added Vector::appendRange(), which appends to a vector based on a given start and end iterator
        - Added keys() and values() functions to HashMap iterators, which give keys-only and values-only iterators

        Together, these allow easy copying of a set, or the keys or values of a map, into a Vector. Examples:

        HashMap<int, int> map;
        HashSet<int> set;
        Vector<int> vec;
        // ...
        vec.appendRange(set.begin(), set.end());
        vec.appendRange(map.begin().keys(), map.end().keys());
        vec.appendRange(map.begin().values(), map.end().values());

        This also allows for a slightly nicer syntax when iterating a map. Instead of saying
        (*it)->first, you can say *it.values(). Similarly for keys. Example:

        HashMap<int, int>::const_iterator end = map.end();
        for (HashMap<int, int>::const_iterator it = map.begin(); it != end; ++it)
        printf(" [%d => %d]", *it.keys(), *it.values());

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * wtf/HashIterators.h: Added.
        (WTF::):
        (WTF::HashTableConstKeysIterator::HashTableConstKeysIterator):
        (WTF::HashTableConstKeysIterator::get):
        (WTF::HashTableConstKeysIterator::operator*):
        (WTF::HashTableConstKeysIterator::operator->):
        (WTF::HashTableConstKeysIterator::operator++):
        (WTF::HashTableConstValuesIterator::HashTableConstValuesIterator):
        (WTF::HashTableConstValuesIterator::get):
        (WTF::HashTableConstValuesIterator::operator*):
        (WTF::HashTableConstValuesIterator::operator->):
        (WTF::HashTableConstValuesIterator::operator++):
        (WTF::HashTableKeysIterator::HashTableKeysIterator):
        (WTF::HashTableKeysIterator::get):
        (WTF::HashTableKeysIterator::operator*):
        (WTF::HashTableKeysIterator::operator->):
        (WTF::HashTableKeysIterator::operator++):
        (WTF::HashTableKeysIterator::operator HashTableConstKeysIterator<HashTableType, KeyType, MappedType>):
        (WTF::HashTableValuesIterator::HashTableValuesIterator):
        (WTF::HashTableValuesIterator::get):
        (WTF::HashTableValuesIterator::operator*):
        (WTF::HashTableValuesIterator::operator->):
        (WTF::HashTableValuesIterator::operator++):
        (WTF::HashTableValuesIterator::operator HashTableConstValuesIterator<HashTableType, KeyType, MappedType>):
        (WTF::operator==):
        (WTF::operator!=):
        * wtf/HashTable.h:
        * wtf/Vector.h:
        (WTF::::appendRange):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25365 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/kjs/collector.cpp
JavaScriptCore/wtf/FastMalloc.cpp
JavaScriptCore/wtf/FastMallocInternal.h [deleted file]
JavaScriptCore/wtf/HashIterators.h [new file with mode: 0644]
JavaScriptCore/wtf/HashMap.h
JavaScriptCore/wtf/HashSet.h
JavaScriptCore/wtf/HashTable.h
JavaScriptCore/wtf/Vector.h