1. dimajix
  2. Untitled project
  3. Magnum

Commits

Kaya Kupferschmidt  committed eba1085

Interim commit

  • Participants
  • Parent commits 13121c8
  • Branches kaya_001

Comments (0)

Files changed (61)

File source/libs/magnum_core/magnum_core.files

View file
  • Ignore whitespace
 source/magnum/datetime/spi/TimeZoneProvider.cpp
 source/magnum/datetime/spi/TimeZoneImpl.cpp
 source/magnum/datetime/Exception.h
+source/magnum/container/PrefixTree.h

File source/libs/magnum_core/source/magnum/container/ArrayEnumerator.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 /*--------------------------------------------------------------------------*/
 /**
  */
-template<class L,class I = typename L::Item>
+template<class L,class I = typename L::ValueType>
 class ArrayEnumerator : public Enumerator<I> {
 public:
-    typedef typename Enumerator<I>::Value Value;
+    typedef typename Enumerator<I>::ValueType ValueType;
+    typedef typename Enumerator<I>::ReturnType ReturnType;
     
 public:
     explicit ArrayEnumerator(const L& array)
     virtual bool hasNext() const {
         return (m_Iterator != m_End);    
     }
-    virtual Value next() {
-        return Value(*m_Iterator++);
+    virtual ReturnType next() {
+        return ReturnType(*m_Iterator++);
     }
     virtual void skip() {
         ++m_Iterator;

File source/libs/magnum_core/source/magnum/container/BinaryTree.h

View file
  • Ignore whitespace
 
 /*----------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------*/
-template<class Key, class Item> class BinaryTree : public Object {
-DeclareClass(BinaryTree, Object);
+template<class Key, class Item> class BinaryTree  {
 friend class BinaryTreeEnumerator<Key, Item>;
 private:
 	typedef struct Node {
 };
 
 
-}; };
+} }
 
 #endif

File source/libs/magnum_core/source/magnum/container/Chain.h

View file
  • Ignore whitespace
 public:
 	typedef ChainIterator<T,R>	Iterator;
 	typedef ConstChainIterator<T,R> ConstIterator;
-	typedef T					Item;
+    typedef T Item;
+    typedef T ValueType;
 
 public:
 	inline	Chain();

File source/libs/magnum_core/source/magnum/container/ChainEnumerator.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 /*--------------------------------------------------------------------------*/
 /**
  */
-template<class L,class I = typename L::Item*>
+template<class L,class I = typename L::ValueType*>
 class ChainEnumerator : public Enumerator<I> {
 public:
-    typedef typename Enumerator<I>::Value Value;
+    typedef typename Enumerator<I>::ValueType ValueType;
+    typedef typename Enumerator<I>::ReturnType ReturnType;
     
 public:
     explicit ChainEnumerator(const L& chain)
     virtual bool hasNext() const {
         return (m_Iterator != m_End);    
     }
-    virtual Value next() {
-        return Value(&*m_Iterator++);
+    virtual ReturnType next() {
+        return ReturnType(&*m_Iterator++);
     }
     virtual void skip() {
         ++m_Iterator;

File source/libs/magnum_core/source/magnum/container/Enumerator.h

View file
  • Ignore whitespace
  /*
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 template<typename T>
 class Enumerator : public Object {
 public:
-    typedef T           Item;
-	typedef typename CallTraits<T>::ArgumentType Value;
+    typedef T ValueType;
+    typedef typename CallTraits<T>::ArgumentType ReturnType;
     
 public:
     virtual bool        hasNext() const = 0;
-    virtual Value       next() = 0;
+    virtual ReturnType  next() = 0;
     virtual void        skip() = 0;
     virtual void        reset() = 0;
 };
 template<typename T>
 class Enumerator<Reference<T> > : public Object {
 public:
-    typedef Reference<T> Item;
-	typedef T*          Value;
+    typedef Reference<T> ValueType;
+    typedef T* ReturnType;
     
 public:
     virtual bool        hasNext() const = 0;
-    virtual Value       next() = 0;
+    virtual ReturnType  next() = 0;
     virtual void        skip() = 0;
     virtual void        reset() = 0;
 };

File source/libs/magnum_core/source/magnum/container/ForwardChain.h

View file
  • Ignore whitespace
 public:
     typedef ForwardChainIterator<T,R>   Iterator;
     typedef ConstForwardChainIterator<T,R> ConstIterator;
-    typedef T           Item;
+    typedef T ValueType;
 
 public:
     inline  ForwardChain();

File source/libs/magnum_core/source/magnum/container/HashMap.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2010 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 	inline HashMapNode(const K& ,unsigned int ,const I& );
 	inline HashMapNode(const K& ,unsigned int );
 	
-	K				m_Key;
-	I				m_Item;
+    K m_Key;
+    I m_Item;
 	unsigned int	m_Hash;
 	HashMapNode*	m_Next;
 };
 class ConstHashMapIterator : public IteratorBase<ConstHashMapIterator<K,I,Hasher> > {
 friend class HashMap<K,I,Hasher>;
 public:
+    typedef K KeyType;
+    typedef I ValueType;
     typedef typename MemberTraits<I>::ConstMemberType MemberType;
     typedef typename MemberTraits<I>::ConstReferenceType ReferenceType;
 
 class HashMapIterator : public ConstHashMapIterator<K,I,Hasher> {
 friend class HashMap<K,I,Hasher>;
 public:
+    typedef K KeyType;
+    typedef I ValueType;
     typedef typename MemberTraits<I>::MemberType MemberType;
     typedef typename MemberTraits<I>::ReferenceType ReferenceType;
 
 public:
 	typedef HashMapIterator<K,I,Hasher>	Iterator;
 	typedef ConstHashMapIterator<K,I,Hasher> ConstIterator;
-	typedef K						Key;
-	typedef I						Item;
-	typedef typename CallTraits<K>::ArgumentType KeyArgument;
-	typedef typename CallTraits<I>::ArgumentType ItemArgument;
+    typedef K KeyType;
+    typedef I ValueType;
+    typedef typename CallTraits<K>::ArgumentType KeyArgument;
+    typedef typename CallTraits<I>::ArgumentType ValueArgument;
 
 public:
 	HashMap();
 
 	void 				clear();
 	bool		 		contains(KeyArgument key) const;
-	Iterator			insert(KeyArgument key,ItemArgument item);
+    Iterator			insert(KeyArgument key,ValueArgument item);
 	Iterator			insert(KeyArgument key);
 	bool 				remove(KeyArgument key);
 	bool				remove(const Iterator& );
 
 	const I&			get(KeyArgument key) const;
 	I&					get(KeyArgument key);
-	void				set(KeyArgument, ItemArgument elem);
+    void				set(KeyArgument, ValueArgument elem);
 
 	inline I&			operator [](KeyArgument );
 	inline const I&		operator [](KeyArgument ) const;

File source/libs/magnum_core/source/magnum/container/HashMap.inl

View file
  • Ignore whitespace
 /**
  */
 template<class K,class I,class Hasher> 
-typename HashMap<K,I,Hasher>::Iterator HashMap<K,I,Hasher>::insert(typename HashMap<K,I,Hasher>::KeyArgument key,typename HashMap<K,I,Hasher>::ItemArgument item) {
+typename HashMap<K,I,Hasher>::Iterator HashMap<K,I,Hasher>::insert(typename HashMap<K,I,Hasher>::KeyArgument key,typename HashMap<K,I,Hasher>::ValueArgument item) {
 	if (m_Size * m_LoadFactor > m_Table.getSize())
 		rehash();
 
 /**
  */
 template<class K,class I,class Hasher> 
-const I& HashMap<K,I,Hasher>::get(typename HashMap<K,I,Hasher>::KeyArgument key) const {
+const I& HashMap<K,I,Hasher>::get(typename HashMap<K,I,Hasher>::KeyArgument key) const
+{
 	unsigned int hash = m_Hasher(key) % (unsigned int)m_Table.getSize();
 	HashMapNode<K,I>* bucket = m_Table[hash];
 
-	while (bucket != NULL) {
+    while (bucket != 0) {
 		if (bucket->m_Key == key) {
 			return bucket->m_Item;
 		}
 		bucket = bucket->m_Next;
 	}
 
-	return *(Item*)NULL;
+    return *(ValueType*)0;
 }
 
 
 /**
  */
 template<class K,class I,class Hasher> 
-I& HashMap<K,I,Hasher>::get(typename HashMap<K,I,Hasher>::KeyArgument key) {
+I& HashMap<K,I,Hasher>::get(typename HashMap<K,I,Hasher>::KeyArgument key)
+{
 	unsigned int hash = m_Hasher(key) % (unsigned int)m_Table.getSize();
 	HashMapNode<K,I>* bucket = m_Table[hash];
 
-	while (bucket != NULL) {
+    while (bucket != 0) {
 		if (bucket->m_Key == key) {
 			return bucket->m_Item;
 		}
 		bucket = bucket->m_Next;
 	}
 
-	return *(Item*)NULL;
+    return *(ValueType*)0;
 }
 
 
 /**
  */
 template<class K,class I,class Hasher> 
-void HashMap<K,I,Hasher>::set(typename HashMap<K,I,Hasher>::KeyArgument key,typename HashMap<K,I,Hasher>::ItemArgument item) {
+void HashMap<K,I,Hasher>::set(typename HashMap<K,I,Hasher>::KeyArgument key,typename HashMap<K,I,Hasher>::ValueArgument item) {
 	unsigned int hash = m_Hasher(key) % (unsigned int)m_Table.getSize();
 	HashMapNode<K,I>* bucket = m_Table[hash];
 
-	while (bucket != NULL) {
+    while (bucket != 0) {
 		if (bucket->m_Key == key) {
 			bucket->m_Item = item;
 			return;

File source/libs/magnum_core/source/magnum/container/HashSet.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2010 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 friend class HashSetIterator<I,Hasher>;
 friend class MultiHashSet<I,Hasher>;
 public:
-	typedef HashSetIterator<I,Hasher>	Iterator;
-	typedef HashSetIterator<I,Hasher>	ConstIterator;
-	typedef I							Item;
-	typedef typename CallTraits<I>::ArgumentType Argument;
+    typedef HashSetIterator<I,Hasher> Iterator;
+    typedef HashSetIterator<I,Hasher> ConstIterator;
+    typedef I ValueType;
+    typedef typename CallTraits<I>::ArgumentType Argument;
 
 public:
 	HashSet();
 	float				m_LoadFactor;
 };
 
-}; };
+} }
 #endif

File source/libs/magnum_core/source/magnum/container/Heap.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2010 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 
 public:
 	inline HeapIterator() {
-	};
+    }
 	inline operator T*() {
 		return *m_Item;
-	};
+    }
 	inline operator const T*() const {
 		return *m_Item;
-	};
+    }
 	inline const T& operator*() const {
 		return **m_Item;
-	};
+    }
 	inline const T* operator->() const {
 		return *m_Item;
-	};
+    }
 	inline HeapIterator& operator++() {
 		ASSERT(m_Item != NULL);
 		m_Item++;
 		return *this;
-	};
+    }
 	inline HeapIterator operator++(int ) {
 		ASSERT(m_Item != NULL);
 		T** item = m_Item;
 		m_Item++;
 		return HeapIterator(item);
-	};
+    }
 	inline HeapIterator	operator+(int n) const {
 		ASSERT(m_Item != NULL);
 		return HeapIterator(m_Item + n);
-	};
+    }
 	inline HeapIterator& operator+=(int n) {
 		m_Item += n;
 		return *this;
-	};
+    }
 	inline HeapIterator& operator--() {
 		ASSERT(m_Item != NULL);
 		m_Item--;
 		return *this;
-	};
+    }
 	inline HeapIterator	operator--(int ) {
 		ASSERT(m_Item != NULL);
 		T** item = m_Item;
 		m_Item--;
 		return HeapIterator(item);
-	};
+    }
 	inline HeapIterator	operator-(int n) const {
 		ASSERT(m_Item != NULL);
 		return HeapIterator(m_Item - n);
-	};
+    }
 	inline HeapIterator& operator-=(int n) {
 		m_Item -= n;
 		return *this;
-	};
+    }
 	inline bool operator==(const HeapIterator& iter) const {
 		return m_Item == iter.m_Item;
-	};
+    }
 	inline bool operator!=(const HeapIterator& iter) const {
 		return m_Item != iter.m_Item;
-	};
+    }
 	inline bool	operator<(const HeapIterator& iter) const {
 		return m_Item < iter.m_Item;
-	};
+    }
 	inline bool	operator>(const HeapIterator& iter) const {
 		return m_Item > iter.m_Item;
-	};
+    }
 	inline bool	operator<=(const HeapIterator& iter) const {
 		return m_Item <= iter.m_Item;
-	};
+    }
 	inline bool	operator>=(const HeapIterator& iter) const {
 		return m_Item >= iter.m_Item;
-	};
+    }
 
 private:
 	inline HeapIterator(T** item) {
 		m_Item = item;
-	};
+    }
 
 	T**	m_Item;
 };
 class Heap {
 public:
 	typedef HeapIterator<T>	Iterator;
-	typedef T				Item;
-	typedef typename CallTraits<T>::ArgumentType Argument;
+    typedef T ValueType;
+    typedef typename CallTraits<T>::ArgumentType Argument;
 	
 public:
 	inline Heap();
 	PoolAllocator<T>	m_Allocator;
 };
 
-}; };
+} }
 
 #endif

File source/libs/magnum_core/source/magnum/container/List.h

View file
  • Ignore whitespace
 ----------------------------------------------------------------------------*/
 template<class T,class A = ListAllocator<T> > class List : public Object {
 public:
-    typedef A                   Allocator;
+    typedef A Allocator;
 	typedef ListIterator<T,A>	Iterator;
 	typedef ConstListIterator<T,A> ConstIterator;
-	typedef T					Item;
-	typedef typename CallTraits<T>::ArgumentType Argument;
+    typedef T ValueType;
+    typedef typename CallTraits<T>::ArgumentType Argument;
 
 public:
 	List();

File source/libs/magnum_core/source/magnum/container/ListEnumerator.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 /*--------------------------------------------------------------------------*/
 /**
  */
-template<class L,class I = typename L::Item>
+template<class L,class I = typename L::ValueType>
 class ListEnumerator : public Enumerator<I> {
 public:
-    typedef typename Enumerator<I>::Value Value;
+    typedef typename Enumerator<I>::ValueType ValueType;
+    typedef typename Enumerator<I>::ReturnType ReturnType;
     
 public:
     explicit ListEnumerator(const L& list)
     virtual bool hasNext() const {
         return (m_Iterator != m_End);    
     }
-    virtual Value next() {
-        return Value(*m_Iterator++);
+    virtual ReturnType next() {
+        return ReturnType(*m_Iterator++);
     }
     virtual void skip() {
         ++m_Iterator;

File source/libs/magnum_core/source/magnum/container/Map.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 #define __MAGNUM_CONTAINER_MAP_H
 
 #include "magnum/object/traits/CallTraits.h"
-#include "magnum/object/Object.h"
 #include "magnum/util/swap.h"
 #include "magnum/algorithm/Functional.h"
 #include "magnum/container/Iterator.h"
 
 
 namespace magnum { namespace container {
-using magnum::object::Object;
-using magnum::types::String;
 using magnum::types::traits::CallTraits;
 using magnum::algorithm::Less;
 
 public:
 	typedef MapIterator<K,I,Cmp> Iterator;
 	typedef ConstMapIterator<K,I,Cmp> ConstIterator;
-	typedef K					Key;
-	typedef I					Item;
-	typedef typename CallTraits<K>::ArgumentType KeyArgument;
-	typedef typename CallTraits<I>::ArgumentType ItemArgument;
+    typedef K KeyType;
+    typedef I ValueType;
+    typedef typename CallTraits<K>::ArgumentType KeyArgument;
+    typedef typename CallTraits<I>::ArgumentType ValueArgument;
 
 public:
 	inline Map();
 	inline ~Map();
 
 	bool				contains(KeyArgument k) const;
-	Iterator			insert(KeyArgument key, ItemArgument item);
+    Iterator			insert(KeyArgument key, ValueArgument item);
 	Iterator			insert(KeyArgument key);
 	bool				remove(KeyArgument key);
 	bool				remove(const Iterator& item);
 						
 	const I&			get(KeyArgument key) const;
 	I&					get(KeyArgument key);
-	void				set(KeyArgument, ItemArgument elem);
+    void				set(KeyArgument, ValueArgument elem);
 						
 	inline unsigned		int getSize() const;
 	inline bool			isEmpty() const;

File source/libs/magnum_core/source/magnum/container/Map.inl

View file
  • Ignore whitespace
 	will be substituted.
 ----------------------------------------------------------------------------------*/
 template<class K,class I,class C> 
-typename Map<K,I,C>::Iterator Map<K,I,C>::insert(typename Map<K,I,C>::KeyArgument key, typename Map<K,I,C>::ItemArgument item) 
+typename Map<K,I,C>::Iterator Map<K,I,C>::insert(typename Map<K,I,C>::KeyArgument key, typename Map<K,I,C>::ValueArgument item)
 {
 	MapNode<K,I,C> *node = m_Root;
 	

File source/libs/magnum_core/source/magnum/container/MapEnumerator.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 /*--------------------------------------------------------------------------*/
 /**
  */
-template<class M,class I = typename M::Key>
+template<class M,class I = typename M::KeyType>
 class MapKeyEnumerator : public Enumerator<I> {
 public:
-    typedef typename Enumerator<I>::Value Value;
+    typedef typename Enumerator<I>::ValueType ValueType;
+    typedef typename Enumerator<I>::ReturnType ReturnType;
     
 public:
     explicit MapKeyEnumerator(const M& map)
     virtual bool hasNext() const {
         return (m_Iterator != m_End);    
     }
-    virtual Value next() {
-        return typename Enumerator<I>::Value((m_Iterator++).key());
+    virtual ReturnType next() {
+        return ReturnType((m_Iterator++).key());
     }
     virtual void skip() {
         ++m_Iterator;
 /*--------------------------------------------------------------------------*/
 /**
  */
-template<class M,class I = typename M::Item>
+template<class M,class I = typename M::ValueType>
 class MapValueEnumerator : public Enumerator<I> {
 public:
-    typedef typename Enumerator<I>::Value Value;
+    typedef typename Enumerator<I>::ReturnType ReturnType;
     
 public:
     explicit MapValueEnumerator(const M& map)
     virtual bool hasNext() const {
         return (m_Iterator != m_End);    
     }
-    virtual Value next() {
-        return typename Enumerator<I>::Value((m_Iterator++).value());
+    virtual ReturnType next() {
+        return ReturnType((m_Iterator++).value());
     }
     virtual void skip() {
         ++m_Iterator;

File source/libs/magnum_core/source/magnum/container/MultiHashMap.h

View file
  • Ignore whitespace
 public:
 	typedef HashMapIterator<K,I,Hasher>	Iterator;
 	typedef ConstHashMapIterator<K,I,Hasher> ConstIterator;
-	typedef K						Key;
-	typedef I						Item;
-	typedef typename CallTraits<K>::ArgumentType KeyArgument;
-	typedef typename CallTraits<I>::ArgumentType ItemArgument;
+    typedef K KeyType;
+    typedef I ValueType;
+    typedef typename CallTraits<K>::ArgumentType KeyArgument;
+    typedef typename CallTraits<I>::ArgumentType ValueArgument;
 
 public:
 	MultiHashMap();
 	~MultiHashMap();
 
-	Iterator			insert(KeyArgument key,ItemArgument item);
-	Iterator			insert(KeyArgument key);
+    Iterator insert(KeyArgument key, ValueArgument item);
+    Iterator insert(KeyArgument key);
 };
 
-}; };
+} }
+
 #endif

File source/libs/magnum_core/source/magnum/container/MultiHashMap.inl

View file
  • Ignore whitespace
 /**
  */
 template<class K,class I,class Hasher> 
-typename MultiHashMap<K,I,Hasher>::Iterator MultiHashMap<K,I,Hasher>::insert(typename MultiHashMap<K,I,Hasher>::KeyArgument key,typename MultiHashMap<K,I,Hasher>::ItemArgument item) {
+typename MultiHashMap<K,I,Hasher>::Iterator MultiHashMap<K,I,Hasher>::insert(typename MultiHashMap<K,I,Hasher>::KeyArgument key,typename MultiHashMap<K,I,Hasher>::ValueArgument item) {
 	if (HashMap<K,I,Hasher>::m_Size * HashMap<K,I,Hasher>::m_LoadFactor > HashMap<K,I,Hasher>::m_Table.getSize())
 		rehash();
 

File source/libs/magnum_core/source/magnum/container/MultiHashSet.h

View file
  • Ignore whitespace
 #define __MAGNUM_CONTAINER_HASHSET_H
 
 #include "magnum/object/traits/CallTraits.h"
-#include "magnum/container/Array.h"
+#include "magnum/object/Array.h"
 #include "magnum/container/Allocator.h"
 #include "magnum/container/Hasher.h"
 
 method
 ----------------------------------------------------------------------------*/
 template<class I, class Hasher = StandardHasher<I> > 
-class HashSet : public Object {
-DeclareClass(HashSet, Object);
+class HashSet {
 friend class HashSetIterator<I,Hasher>;
 public:
-	typedef HashSetIterator<I,Hasher>	Iterator;
-	typedef I							Item;
-	typedef typename CallTraits<I>::ArgumentType Argument;
+    typedef HashSetIterator<I,Hasher> Iterator;
+    typedef I ValueType;
+    typedef typename CallTraits<I>::ArgumentType Argument;
 
 public:
 	HashSet();
 	float						m_LoadFactor;
 };
 
-}; };
+} }
 #endif

File source/libs/magnum_core/source/magnum/container/Multimap.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 public:
 	typedef typename Map<K,I,C>::Iterator	Iterator;
 	typedef typename Map<K,I,C>::ConstIterator ConstIterator;
-	typedef K			Key;
-	typedef I			Item;
-	typedef typename CallTraits<K>::ArgumentType KeyArgument;
-	typedef typename CallTraits<I>::ArgumentType ItemArgument;
+    typedef K KeyType;
+    typedef I ValueType;
+    typedef typename CallTraits<K>::ArgumentType KeyArgument;
+    typedef typename CallTraits<I>::ArgumentType ValueArgument;
 
 public:
     Multimap() 
 	    }
     }
     
-	Iterator insert(KeyArgument key, ItemArgument item);
+    Iterator insert(KeyArgument key, ValueArgument item);
 	Iterator insert(KeyArgument key);
 	int removeAll(KeyArgument key);
 

File source/libs/magnum_core/source/magnum/container/Multimap.inl

View file
  • Ignore whitespace
 /*----------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------*/
 template<class K,class I,class C> 
-typename Multimap<K,I,C>::Iterator Multimap<K,I,C>::insert(typename Multimap<K,I,C>::KeyArgument key, typename Multimap<K,I,C>::ItemArgument item) {
+typename Multimap<K,I,C>::Iterator Multimap<K,I,C>::insert(typename Multimap<K,I,C>::KeyArgument key, typename Multimap<K,I,C>::ValueArgument item) {
 	MapNode<K,I,C> *node = Map<K,I,C>::m_Root;
 	MapNode<K,I,C> *newNode;
 	

File source/libs/magnum_core/source/magnum/container/Multiset.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 public:
     typedef typename Set<T,C>::Iterator Iterator;
     typedef typename Set<T,C>::ConstIterator ConstIterator;
-    typedef T                   Item;
+    typedef T ValueType;
     typedef typename CallTraits<T>::ArgumentType Argument;
 
 public:

File source/libs/magnum_core/source/magnum/container/PrefixTree.h

View file
  • Ignore whitespace
+/*
+  Magnum
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, under the terms in LICENSE.TXT.
+
+  Kaya Kupferschmidt  (k.kupferschmidt@dimajix.de)
+*/
+
+#ifndef __MAGNUM_CONTAINER_PREFIXTREE_H
+#define __MAGNUM_CONTAINER_PREFIXTREE_H
+
+#include "magnum/object/Array.h"
+#include "magnum/object/traits/IteratorTraits.h"
+#include "magnum/util/swap.h"
+#include "magnum/algorithm/Functional.h"
+#include "magnum/container/Iterator.h"
+
+#include "magnum/object/Array.inl"
+
+
+namespace magnum { namespace container {
+using magnum::object::Array;
+using magnum::types::traits::IteratorTraits;
+
+/*--------------------------------------------------------------------------------*/
+/**
+ */
+template<class KeyT, class ValueT>
+struct PrefixTreeNode
+{
+    typedef ValueT ValueType;
+    typedef KeyT KeyType;
+
+    KeyType key;
+    ValueType value;
+    bool hasValue;
+    PrefixTreeNode* parent;
+    Array<PrefixTreeNode> children;
+};
+
+
+/*--------------------------------------------------------------------------------*/
+/**
+ */
+template<class KeyT, class ValueT>
+class ConstPrefixTreeIterator : public IteratorBase<ConstPrefixTreeIterator<KeyT,ValueT> > {
+friend class PrefixTree<KeyT, ValueT>;
+public:
+    typedef typename MemberTraits<ValueT>::ConstMemberType MemberType;
+    typedef const KeyT KeyType;
+    typedef const ValueT ValueType;
+    typedef const ValueT& ReferenceType;
+    typedef MemberType PointerType;
+
+public:
+    inline ConstPrefixTreeIterator()
+        : m_Node(0) { }
+
+    inline operator MemberType() const { return MemberTraits<I>::toConstMember(m_Node->value); };
+    inline ReferenceType operator*() const { return m_Node->value; };
+    inline MemberType operator->() const { return MemberTraits<I>::toConstMember(m_Node->value); };
+
+    inline ConstPrefixTreeIterator& operator++()
+    {
+        ASSERT(m_Node != 0);
+        m_Node = findNextValue(m_Node);
+        return *this;
+    }
+    inline ConstPrefixTreeIterator	operator++(int )
+    {
+        ASSERT(m_Node != 0);
+        PrefixTreeNode<KeyT,ValueT>* node = m_Node;
+        operator++();
+        return ConstPrefixTreeIterator(node);
+    }
+    inline ConstPrefixTreeIterator& operator--()
+    {
+        ASSERT(m_Node != 0);
+        m_Node = findPrevValue(m_Node);
+        return *this;
+    }
+    inline ConstPrefixTreeIterator	operator--(int )
+    {
+        ASSERT(m_Node != 0);
+        PrefixTreeNode<KeyT,ValueT>* node = m_Node;
+        operator--();
+        return ConstPrefixTreeIterator(node);
+    }
+    inline bool operator==(const ConstPrefixTreeIterator& iter) const
+        { return m_Node == iter.m_Node; }
+    inline bool operator!=(const ConstPrefixTreeIterator& iter) const
+        { return m_Node != iter.m_Node; }
+    inline bool operator<(const ConstPrefixTreeIterator& iter) const
+        { return m_Node < iter.m_Node; }
+
+    inline const ValueType& item() const
+        { return m_Node->value; }
+    inline const ValueType&	value() const
+        { return m_Node->value; }
+
+protected:
+    inline ConstPrefixTreeIterator(PrefixTreeNode<KeyT,ValueT>* n)
+        : m_Node(n) { }
+
+    static PrefixTreeNode<KeyT,ValueT>* findNextValue(PrefixTreeNode<KeyT,ValueT>* node)
+    {
+        // Check if we need to go up first
+        if (node->children.isEmpty())
+        {
+            for (;;) {
+                PrefixTreeNode<KeyT,ValueT>* parent = node->parent;
+                if (parent == 0)
+                    return 0;
+
+                // Get index of node in parents array
+                int idx = node - &parent->children[0];
+                ++idx;
+
+                // Check if parent has more children
+                if (idx < parent->children.getSize()) {
+                    // Get sibling of current node
+                    node = &parent->children[idx];
+
+                    // Check if new current node already has a value
+                    if (node->hasValue)
+                        return node;
+                    else
+                        break;
+                }
+                else {
+                    // Continue to go up
+                    node = parent;
+                }
+            }
+        }
+
+        // Descent to first child
+        do {
+            ASSERT(!node->children.isEmpty());
+            node = &node->children[0];
+        } while (!node->hasValue);
+
+        return node;
+    }
+
+    static PrefixTreeNode<KeyT,ValueT>* findPrevValue(PrefixTreeNode<KeyT,ValueT>* node)
+    {
+        // Go up
+        for(;;) {
+            PrefixTreeNode<KeyT,ValueT>* parent = node->parent;
+            if (parent == 0)
+                return 0;
+
+            // Get index of node in parents array
+            int idx = node - &parent->children[0];
+            --idx;
+
+            // Check if there is a sibling
+            if (idx >= 0) {
+                // Get sibling of current node
+                node = &parent->children[idx];
+                break;
+            }
+            else if (parent->hasValue) {
+                return parent;
+            }
+            else {
+                // Continue to go up
+                node = parent;
+            }
+        }
+
+        // Descend
+        while (!node->children.isEmpty()) {
+            node = &node->children[0];
+        }
+
+        ASSERT(node->hasValue);
+        return node;
+    }
+
+protected:
+    PrefixTreeNode<KeyT,ValueT>* m_Node;
+};
+
+
+/*--------------------------------------------------------------------------------*/
+/**
+ */
+template<class KeyT, class ValueT>
+class PrefixTreeIterator : public ConstPrefixTreeIterator<KeyT,ValueT> {
+friend class PrefixTree<KeyT, ValueT>;
+public:
+    typedef typename MemberTraits<ValueT>::MemberType MemberType;
+    typedef const KeyT KeyType;
+    typedef ValueT ValueType;
+    typedef ValueT& ReferenceType;
+    typedef MemberType PointerType;
+
+public:
+    inline PrefixTreeIterator() { }
+
+    inline operator MemberType() const
+        { return MemberTraits<I>::toMember(ConstPrefixTreeIterator<KeyT,ValueT>::m_Node->value); };
+    inline ReferenceType operator*() const
+        { return ConstPrefixTreeIterator<KeyT,ValueT>::m_Node->value; };
+    inline MemberType operator->() const
+        { return MemberTraits<I>::toMember(ConstPrefixTreeIterator<KeyT,ValueT>::m_Node->value); };
+
+    inline PrefixTreeIterator& operator++()
+    {
+        ConstPrefixTreeIterator<KeyT,ValueT>::operator++();
+        return *this;
+    }
+    inline PrefixTreeIterator operator++(int )
+    {
+        ASSERT(ConstPrefixTreeIterator<KeyT,ValueT>::m_Node != 0);
+        PrefixTreeNode<KeyT,ValueT>* node = ConstPrefixTreeIterator<KeyT,ValueT>::m_Node;
+        ConstPrefixTreeIterator<KeyT,ValueT>::operator++();
+        return PrefixTreeIterator(node);
+    }
+    inline PrefixTreeIterator& operator--()
+    {
+        ConstPrefixTreeIterator<KeyT,ValueT>::operator--();
+        return *this;
+    }
+    inline PrefixTreeIterator operator--(int )
+    {
+        ASSERT(ConstPrefixTreeIterator<KeyT,ValueT>::m_Node != 0);
+        PrefixTreeNode<KeyT,ValueT>* node = ConstPrefixTreeIterator<KeyT,ValueT>::m_Node;
+        ConstPrefixTreeIterator<KeyT,ValueT>::operator--();
+        return PrefixTreeIterator(node);
+    }
+
+    inline ValueType& item() const
+        { return ConstPrefixTreeIterator<KeyT,ValueT>::m_Node->value; }
+    inline ValueType& value() const
+        { return ConstPrefixTreeIterator<KeyT,ValueT>::m_Node->value; }
+
+protected:
+    inline PrefixTreeIterator(PrefixTreeNode<KeyT,ValueT>* n)
+        : ConstPrefixTreeIterator<KeyT,ValueT>(n)  { }
+};
+
+
+/*--------------------------------------------------------------------------------*/
+/**
+ */
+template<class KeyT, class ValueT>
+class PrefixTree {
+public:
+    typedef ValueT ValueType;
+    typedef KeyT KeyType;
+    typedef PrefixTreeIterator<KeyType,ValueType> Iterator;
+    typedef ConstPrefixTreeIterator<KeyType,ValueType> ConstIterator;
+    typedef typename KeyType::Iterator KeyElementIterator;
+    typedef typename KeyElementIterator::ValueType KeyElementType;
+
+public:
+    template<class MapT>
+    explicit PrefixTree(const MapT& data)
+    {
+        buildTree(data);
+    }
+
+    template<class StringT>
+    inline Iterator find(const StringT& str)
+    {
+        return find(str.begin(), str.end());
+    }
+    template<class CharT>
+    inline Iterator find(const CharT* str)
+    {
+        typename StringTraits<CharT*>::ConstIteratorType begin = StringTraits<CharT*>::begin(str);
+        typename StringTraits<CharT*>::ConstIteratorType end = StringTraits<CharT*>::end(str);
+        return find(begin, end);
+    }
+    template<class IteratorT>
+    Iterator find(IteratorT p, IteratorT pend)
+    {
+        Iterator result = findPrefix(p, pend);
+        if (p != pend)
+            return end();
+        return result;
+    }
+    template<class StringT>
+    inline ConstIterator find(const StringT& str) const
+    {
+        return find(str.begin(), str.end());
+    }
+    template<class CharT>
+    inline ConstIterator find(const CharT* str) const
+    {
+        typename StringTraits<CharT*>::ConstIteratorType begin = StringTraits<CharT*>::begin(str);
+        typename StringTraits<CharT*>::ConstIteratorType end = StringTraits<CharT*>::end(str);
+        return find(begin, end);
+    }
+    template<class IteratorT>
+    ConstIterator find(IteratorT p, const IteratorT& pend) const
+    {
+        Iterator result = findPrefix(p, pend);
+        if (p != pend)
+            return end();
+        return result;
+    }
+
+    template<class IteratorT>
+    inline Iterator findPrefix(IteratorT& p, const IteratorT& end)
+    {
+        return Iterator(findPrefixNode(p, end));
+    }
+    template<class IteratorT>
+    inline ConstIterator findPrefix(IteratorT& p, const IteratorT& end) const
+    {
+        return ConstIterator(findPrefixNode(p, end));
+    }
+
+    Iterator begin()
+    {
+        if (isEmpty())
+            return Iterator(0);
+
+        PrefixTreeNode<KeyType, ValueType>* node = &m_Root.children[0];
+        while (!node->hasValue) {
+            ASSERT(! node->children.isEmpty() );
+            node = &node->children[0];
+        }
+        return Iterator(node);
+    }
+
+    inline Iterator end()
+    {
+        return Iterator(0);
+    }
+    ConstIterator begin() const
+    {
+        if (isEmpty())
+            return ConstIterator(0);
+
+        const PrefixTreeNode<KeyType, ValueType>* node = &m_Root.children[0];
+        while (!node->hasValue) {
+            ASSERT(! node->children.isEmpty() );
+            node = &node->children[0];
+        }
+        return ConstIterator(node);
+    }
+    inline ConstIterator end() const
+    {
+        return ConstIterator(0);
+    }
+
+    inline bool isEmpty() const
+    {
+        return m_Root.children.isEmpty();
+    }
+
+    template<class MapT>
+    void buildTree(const MapT& data)
+    {
+    }
+
+private:
+    template<class IteratorT>
+    PrefixTreeNode<KeyType, ValueType>* findPrefixNode(IteratorT& p, IteratorT end) const
+    {
+        PrefixTreeNode<KeyType, ValueType>* node = &const_cast<PrefixTree<KeyT,ValueT> >(this)->m_Root;
+        while (p != end) {
+            typename IteratorTraits<IteratorT>::ValueType v = *p++;
+            node = findChildNode(node, v);
+        }
+    }
+    static PrefixTreeNode<KeyType, ValueType>* findChildNode(PrefixTreeNode<KeyType, ValueType>* node, KeyElementType v)
+    {
+        typename Array<PrefixTreeNode<KeyType, ValueType> >::Iterator lo = node->children.begin();
+        typename Array<PrefixTreeNode<KeyType, ValueType> >::Iterator hi = node->children.end();
+        while (lo < hi) {
+            typename Array<PrefixTreeNode<KeyType, ValueType> >::Iterator mid = lo + (hi - lo)/2;
+            if (mid->key > v) {
+                hi = mid;
+            }
+            else if (mid->key < v) {
+                lo = mid + 1;
+            }
+            else {
+                return &*mid;
+            }
+        }
+        return 0;
+    }
+
+private:
+    PrefixTreeNode<KeyType, ValueType> m_Root;
+};
+
+} }
+
+#endif // PREFIXTREE_H

File source/libs/magnum_core/source/magnum/container/PriorityHeap.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2010 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 #define __MAGNUM_CONTAINER_PRIORITYHEAP_H
 
 #include "magnum/object/Object.h"
+#include "magnum/object/traits/CallTraits.h"
 #include "magnum/container/PoolAllocator.h"
 
 
 using magnum::object::Object;
 using magnum::types::String;
 using magnum::types::index_t;
+using magnum::types::traits::CallTraits;
 
 
 template<class T,class P> class PriorityHeap;
 public:
 	typedef PriorityHeapIterator<T,P> Iterator;
 	typedef ConstPriorityHeapIterator<T,P> ConstIterator;
-	typedef T			Item;
-	typedef P			Priority;
+    typedef T ValueType;
+    typedef P Priority;
+    typedef typename CallTraits<ValueType>::ArgumentType ValueArgument;
 
 public:
 	PriorityHeap();
 	~PriorityHeap();
 
-	bool			    contains(const T& ) const;
-	inline Iterator		insert(const T& , const P& );
+    bool			    contains(ValueArgument ) const;
+    inline Iterator		insert(ValueArgument , const P& );
 	inline void			change(const Iterator& ,const P& );
 	void				remove(const Iterator& );
 	void				clear();
 	inline size_t       getSize() const;
 
 	inline Iterator		begin();
-	Iterator 	        find(const T& item);
+    Iterator 	        find(ValueArgument item);
 	inline Iterator 	top();
 	inline Iterator		end();
 
 	inline ConstIterator begin() const;
-	ConstIterator       find(const T& item) const;
+    ConstIterator       find(ValueArgument item) const;
 	inline ConstIterator top() const;
 	inline ConstIterator end() const;
 

File source/libs/magnum_core/source/magnum/container/PriorityHeap.inl

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2009 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 Description:
 ----------------------------------------------------------------------------------*/
 template<class T, class P> 
-inline PriorityHeap<T,P>::PriorityHeap() {
+inline PriorityHeap<T,P>::PriorityHeap()
+{
 	m_Heap.insert(&m_Terminator);
 	m_Terminator.m_Index = 0;
 }
 Description:
 ----------------------------------------------------------------------------------*/
 template<class T, class P> 
-inline PriorityHeap<T,P>::~PriorityHeap() {
+inline PriorityHeap<T,P>::~PriorityHeap()
+{
 	clear();
 }
 
 Description:
 ----------------------------------------------------------------------------------*/
 template<class T, class P> 
-inline size_t PriorityHeap<T,P>::getCapacity() const {
+inline size_t PriorityHeap<T,P>::getCapacity() const
+{
 	return m_Heap.getCapacity();
 }
 
 Description:
 ----------------------------------------------------------------------------------*/
 template<class T, class P> 
-inline typename PriorityHeap<T,P>::Iterator PriorityHeap<T,P>::insert(const T& item, const P& prio) {
+inline typename PriorityHeap<T,P>::Iterator PriorityHeap<T,P>::insert(typename PriorityHeap<T,P>::ValueArgument item, const P& prio)
+{
 	PriorityHeapItem<T,P>* nitem = m_Allocator.construct(m_Allocator.allocate(), item, prio);
 	size_t size = m_Heap.getSize() - 1;
 	m_Heap[size] = nitem;
 Description:
 ----------------------------------------------------------------------------------*/
 template<class T, class P> 
-bool PriorityHeap<T,P>::contains(const T& item) const {
+bool PriorityHeap<T,P>::contains(typename PriorityHeap<T,P>::ValueArgument item) const
+{
 	for (size_t i = 0; i < m_Heap.getSize() - 1; i++) {
 		if (m_Heap[i]->m_Item == item)
 			return true;
 /*----------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------*/
 template<class T, class P> 
-typename PriorityHeap<T,P>::ConstIterator PriorityHeap<T,P>::find(const T& item) const {
+typename PriorityHeap<T,P>::ConstIterator PriorityHeap<T,P>::find(typename PriorityHeap<T,P>::ValueArgument item) const
+{
 	for (size_t i = 0; i < m_Heap.getSize() - 1; i++) {
 		if (m_Heap[i]->m_Item == item)
 			return ConstIterator(&m_Heap, m_Heap[i]);
 /*----------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------*/
 template<class T, class P> 
-typename PriorityHeap<T,P>::Iterator PriorityHeap<T,P>::find(const T& item) {
+typename PriorityHeap<T,P>::Iterator PriorityHeap<T,P>::find(typename PriorityHeap<T,P>::ValueArgument item)
+{
 	for (size_t i = 0; i < m_Heap.getSize() - 1; i++) {
 		if (m_Heap[i]->m_Item == item)
 			return Iterator(&m_Heap, m_Heap[i]);

File source/libs/magnum_core/source/magnum/container/Queue.h

View file
  • Ignore whitespace
 template<class T> class QueueIterator : public IteratorBase<QueueIterator<T> > {
 friend class Queue<T>;
 public:
+    typedef T ValueType;
+    typedef typename MemberTraits<T>::MemberType MemberType;
+    typedef typename MemberTraits<T>::ReferenceType ReferenceType;
+
+public:
 	inline QueueIterator() {
-	};
+    }
 	inline operator T*() {
 		return (T*)m_Item;
-	};
+    }
 	inline operator const T*() const {
 		return (T*)m_Item;
-	};
+    }
 	inline T& operator*() const {
 		return *(T*)m_Item;
-	};
+    }
 	inline T* operator->() const {
 		return (T*)m_Item;
-	};
+    }
 	inline QueueIterator& operator++() {
 		ASSERT(m_Item != NULL);
 		m_Item = m_Item->m_Next;
 		return *this;
-	};
+    }
 	inline QueueIterator operator++(int ) {
 		ASSERT(m_Item != NULL);
 		Queueable<T>* item = m_Item;
 		m_Item = m_Item->m_Next;
 		return QueueIterator(item);
-	};
+    }
 	inline QueueIterator& operator--() {
 		ASSERT(m_Item != NULL);
 		m_Item = m_Item->m_Prev;
 		return *this;
-	};
+    }
 	inline QueueIterator operator--(int ) {
 		ASSERT(m_Item != NULL);
 		Queueable<T>* item = m_Item;
 		m_Item = m_Item->m_Prev;
 		return QueueIterator(item);
-	};
+    }
 	inline bool	operator==(const QueueIterator& iter) {
 		return m_Item == iter.m_Item;
-	};
+    }
 	inline bool	operator<(const QueueIterator& iter) {
 		return m_Item < iter.m_Item;
-	};
+    }
 
 private:
 	inline QueueIterator(Queueable<T>* item) {
 public:
 	typedef QueueIterator<T>	Iterator;
 	typedef QueueIterator<T>	ConstIterator;
-	typedef T					Item;
+    typedef T					ValueType;
 
 public:
 	inline Queue();

File source/libs/magnum_core/source/magnum/container/Set.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 #define __MAGNUM_CONTAINER_SET_H
 
 #include "magnum/object/Array.h"
-#include "magnum/object/Object.h"
 #include "magnum/algorithm/Functional.h"
 #include "magnum/container/Iterator.h"
 #include "magnum/container/PoolAllocator.h"
 
 
 namespace magnum { namespace container {
-using magnum::object::Object;
 using magnum::object::Array;
-using magnum::types::String;
 using magnum::types::traits::CallTraits;
 using magnum::algorithm::Less;
 
 public:
 	typedef SetIterator<T,C> Iterator;
 	typedef SetIterator<T,C> ConstIterator;
-	typedef T				Item;
-	typedef typename CallTraits<T>::ArgumentType Argument;
+    typedef T ValueType;
+    typedef typename CallTraits<T>::ArgumentType Argument;
 	
 public:
 	inline Set();

File source/libs/magnum_core/source/magnum/container/SetEnumerator.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 /*--------------------------------------------------------------------------*/
 /**
  */
-template<class L,class I = typename L::Item>
+template<class L,class I = typename L::ValueType>
 class SetEnumerator : public Enumerator<I> {
 public:
-    typedef typename Enumerator<I>::Value Value;
+    typedef typename Enumerator<I>::ValueType ValueType;
+    typedef typename Enumerator<I>::ReturnType ReturnType;
     
 public:
     explicit SetEnumerator(const L& set)
     virtual bool hasNext() const {
         return (m_Iterator != m_End);    
     }
-    virtual Value next() {
-        return Value(*m_Iterator++);
+    virtual ReturnType next() {
+        return ReturnType(*m_Iterator++);
     }
     virtual void skip() {
         ++m_Iterator;

File source/libs/magnum_core/source/magnum/container/SharedMap.h

View file
  • Ignore whitespace
 public:
 	typedef typename Map<K,I,Cmp>::Iterator Iterator;
 	typedef typename Map<K,I,Cmp>::ConstIterator ConstIterator;
-	typedef typename Map<K,I,Cmp>::Key Key;
-	typedef typename Map<K,I,Cmp>::Item Item;
-	typedef typename Map<K,I,Cmp>::KeyArgument KeyArgument;
-	typedef typename Map<K,I,Cmp>::ItemArgument ItemArgument;
+    typedef typename Map<K,I,Cmp>::KeyType KeyType;
+    typedef typename Map<K,I,Cmp>::ValueType ValueType;
+    typedef typename Map<K,I,Cmp>::KeyArgument KeyArgument;
+    typedef typename Map<K,I,Cmp>::ValueArgument ValueArgument;
 
 public:
-	SharedMap() { };
+    SharedMap() { }
 	SharedMap(const SharedMap<K,I,Cmp>& other) : m_Map(other.m_Map) { }
-	~SharedMap() { };
+    ~SharedMap() { }
 
 	bool contains(KeyArgument k) const {
         if (!m_Map)
             return false;
         return m_Map->map.contains(k);	
 	}
-	void insert(KeyArgument key, ItemArgument item) {
+    void insert(KeyArgument key, ValueArgument item) {
 	    unshare();
 	    m_Map->map.insert(key, item);
 	}
 	    unshare();
 	    return m_Map->map.get(key);
 	}
-	void set(KeyArgument key, ItemArgument elem) {
+    void set(KeyArgument key, ValueArgument elem) {
 	    unshare();
 	    m_Map->map.set(key, elem);
 	}

File source/libs/magnum_core/source/magnum/container/SharedMultimap.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 public:
 	typedef typename Multimap<K,I,Cmp>::Iterator Iterator;
 	typedef typename Multimap<K,I,Cmp>::ConstIterator ConstIterator;
-	typedef typename Multimap<K,I,Cmp>::Key Key;
-	typedef typename Multimap<K,I,Cmp>::Item Item;
+    typedef typename Multimap<K,I,Cmp>::KeyType KeyType;
+    typedef typename Multimap<K,I,Cmp>::ValueType ValueType;
 	typedef typename Multimap<K,I,Cmp>::KeyArgument KeyArgument;
-	typedef typename Multimap<K,I,Cmp>::ItemArgument ItemArgument;
+    typedef typename Multimap<K,I,Cmp>::ValueArgument ValueArgument;
 
 public:
-	SharedMultimap() { };
+    SharedMultimap() { }
 	SharedMultimap(const SharedMultimap<K,I,Cmp>& other) : m_Map(other.m_Map) { }
-	~SharedMultimap() { };
+    ~SharedMultimap() { }
 
 	bool contains(KeyArgument k) const {
         if (!m_Map)
             return false;
         return m_Map->map.contains(k);	
 	}
-	void insert(KeyArgument key, ItemArgument item) {
+    void insert(KeyArgument key, ValueArgument item) {
 	    unshare();
 	    m_Map->map.insert(key, item);
 	}
 	    unshare();
 	    return m_Map->map.get(key);
 	}
-	void set(KeyArgument key, ItemArgument elem) {
+    void set(KeyArgument key, ValueArgument elem) {
 	    unshare();
 	    m_Map->map.set(key, elem);
 	}

File source/libs/magnum_core/source/magnum/container/Stack.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2011 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 #ifndef __MAGNUM_CONTAINER_STACK_H
 #define __MAGNUM_CONTAINER_STACK_H
 
-#include "magnum/object/Object.h"
 #include "magnum/object/traits/CallTraits.h"
+#include "magnum/debug/assert.h"
 #include "magnum/container/Iterator.h"
 
 
 namespace magnum { namespace container {
-using magnum::object::Object;
 using magnum::types::index_t;
-using magnum::types::String;
 using magnum::types::traits::CallTraits;
 
 template<class T> class Stack;

File source/libs/magnum_core/source/magnum/container/Trie.h

View file
  • Ignore whitespace
 /* 
   Magnum 
-  Copyright (C) 2002-2010 Kaya Kupferschmidt. All Rights Reserved.
+  Copyright (C) 2002-2013 Kaya Kupferschmidt. All Rights Reserved.
 
   This software is provided 'as-is', without any express or implied
   warranty.  In no event will the authors be held liable for any damages
 public:
 	typedef TrieIterator<T,A>	Iterator;
 	typedef ConstTrieIterator<T,A> ConstIterator;
-	typedef String				Key;
-	typedef T					Item;
-	typedef typename CallTraits<T>::ArgumentType Argument;
+    typedef String KeyType;
+    typedef T ValueType;
+    typedef typename CallTraits<T>::ArgumentType ValueArgument;
 	
 public:
 	Trie();
 	~Trie();
 
 	bool				contains(const String& ) const;
-	Iterator			insert(const String& ,Argument );
+    Iterator			insert(const String& ,ValueArgument );
 	bool				remove(const String& );
 	bool				remove(const Iterator& iter);
 	void				clear();
 
 	inline const T&		get(const String& ) const;
 	inline T&			get(const String& );
-	void				set(const String& ,Argument );
+    void				set(const String& ,ValueArgument );
 
 	inline T&			operator [](const String& );
 	inline const T&		operator [](const String& ) const;
 	inline void			free_node(Node* );
 	inline Leaf*		alloc_leaf();
 	inline void			free_leaf(Leaf* );
-	inline T*			alloc_item(Argument );
+    inline T*			alloc_item(ValueArgument );
 	inline void			free_item(T* );
 	
 private: