- class DocumentOrderedMap {
- public:
- void add(AtomicStringImpl*, Element*);
- void remove(AtomicStringImpl*, Element*);
- void clear();
-
- bool contains(AtomicStringImpl*) const;
- bool containsMultiple(AtomicStringImpl*) const;
- template<bool keyMatches(AtomicStringImpl*, Element*)> Element* get(AtomicStringImpl*, const Document*) const;
-
- void checkConsistency() const;
-
- private:
- typedef HashMap<AtomicStringImpl*, Element*> Map;
-
- // We maintain the invariant that m_duplicateCounts is the count of all elements with a given key
- // excluding the one referenced in m_map, if any. This means it one less than the total count
- // when the first node with a given key is cached, otherwise the same as the total count.
- mutable Map m_map;
- mutable HashCountedSet<AtomicStringImpl*> m_duplicateCounts;
- };
-