[Scummvm-cvs-logs] SF.net SVN: scummvm: [31852] scummvm/trunk/common

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun May 4 01:02:05 CEST 2008


Revision: 31852
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31852&view=rev
Author:   lordhoto
Date:     2008-05-03 16:02:05 -0700 (Sat, 03 May 2008)

Log Message:
-----------
Formatting.

Modified Paths:
--------------
    scummvm/trunk/common/array.h
    scummvm/trunk/common/func.h
    scummvm/trunk/common/hashmap.h
    scummvm/trunk/common/list.h
    scummvm/trunk/common/noncopyable.h
    scummvm/trunk/common/singleton.h
    scummvm/trunk/common/stack.h

Modified: scummvm/trunk/common/array.h
===================================================================
--- scummvm/trunk/common/array.h	2008-05-03 22:10:52 UTC (rev 31851)
+++ scummvm/trunk/common/array.h	2008-05-03 23:02:05 UTC (rev 31852)
@@ -30,7 +30,7 @@
 
 namespace Common {
 
-template <class T>
+template<class T>
 class Array {
 protected:
 	uint _capacity;
@@ -45,7 +45,7 @@
 
 public:
 	Array() : _capacity(0), _size(0), _data(0) {}
-	Array(const Array<T>& array) : _capacity(0), _size(0), _data(0) {
+	Array(const Array<T> &array) : _capacity(0), _size(0), _data(0) {
 		_size = array._size;
 		_capacity = _size + 32;
 		_data = new T[_capacity];
@@ -53,21 +53,21 @@
 	}
 
 	~Array() {
-		delete [] _data;
+		delete[] _data;
 	}
 
-	void push_back(const T& element) {
+	void push_back(const T &element) {
 		ensureCapacity(_size + 1);
 		_data[_size++] = element;
 	}
 
-	void push_back(const Array<T>& array) {
+	void push_back(const Array<T> &array) {
 		ensureCapacity(_size + array._size);
 		copy(array._data, array._data + array._size, _data + _size);
 		_size += array._size;
 	}
 
-	void insert_at(int idx, const T& element) {
+	void insert_at(int idx, const T &element) {
 		assert(idx >= 0 && (uint)idx <= _size);
 		ensureCapacity(_size + 1);
 		copy_backward(_data + idx, _data + _size, _data + _size + 1);
@@ -85,17 +85,17 @@
 
 	// TODO: insert, remove, ...
 
-	T& operator [](int idx) {
+	T& operator[](int idx) {
 		assert(idx >= 0 && (uint)idx < _size);
 		return _data[idx];
 	}
 
-	const T& operator [](int idx) const {
+	const T& operator[](int idx) const {
 		assert(idx >= 0 && (uint)idx < _size);
 		return _data[idx];
 	}
 
-	Array<T>& operator  =(const Array<T>& array) {
+	Array<T>& operator=(const Array<T> &array) {
 		if (this == &array)
 			return *this;
 

Modified: scummvm/trunk/common/func.h
===================================================================
--- scummvm/trunk/common/func.h	2008-05-03 22:10:52 UTC (rev 31851)
+++ scummvm/trunk/common/func.h	2008-05-03 23:02:05 UTC (rev 31852)
@@ -279,13 +279,13 @@
  * Base template for hash functor objects, used by HashMap.
  * This needs to be specialized for every type that you need to hash.
  */
-template <typename T> struct Hash;
+template<typename T> struct Hash;
 
 
 #define GENERATE_TRIVIAL_HASH_FUNCTOR(T) \
-    template <> struct Hash<T> : public UnaryFunction<T, uint> { \
-      uint operator()(T val) const { return (uint)val; } \
-    }
+	template<> struct Hash<T> : public UnaryFunction<T, uint> { \
+		uint operator()(T val) const { return (uint)val; } \
+	}
 
 GENERATE_TRIVIAL_HASH_FUNCTOR(bool);
 GENERATE_TRIVIAL_HASH_FUNCTOR(char);

Modified: scummvm/trunk/common/hashmap.h
===================================================================
--- scummvm/trunk/common/hashmap.h	2008-05-03 22:10:52 UTC (rev 31851)
+++ scummvm/trunk/common/hashmap.h	2008-05-03 23:02:05 UTC (rev 31852)
@@ -94,7 +94,7 @@
  * triggered instead. Hence if you are not sure whether a key is contained in
  * the map, use contains() first to check for its presence.
  */
-template <class Key, class Val, class HashFunc = Hash<Key>, class EqualFunc = EqualTo<Key> >
+template<class Key, class Val, class HashFunc = Hash<Key>, class EqualFunc = EqualTo<Key> >
 class HashMap {
 private:
 #if defined (PALMOS_MODE)
@@ -113,17 +113,17 @@
 #ifdef USE_HASHMAP_MEMORY_POOL
 	MemoryPool _nodePool;
 
-	Node *allocNode(const Key& key) {
+	Node *allocNode(const Key &key) {
 		void* mem = _nodePool.malloc();
 		return new (mem) Node(key);
 	} 
 
-	void freeNode(Node* node) {
+	void freeNode(Node *node) {
 		node->~Node();
 		_nodePool.free(node);
 	}
 #else
-	Node* allocNode(const Key& key) {
+	Node* allocNode(const Key &key) {
 		return new Node(key);
 	} 
 
@@ -145,7 +145,7 @@
 	mutable int _collisions, _lookups;
 #endif
 
-	void assign(const HM_t& map);
+	void assign(const HM_t &map);
 	int lookup(const Key &key) const;
 	int lookupAndCreateIfMissing(const Key &key);
 	void expand_array(uint newsize);
@@ -181,13 +181,13 @@
 		template<class T>
 		IteratorImpl(const IteratorImpl<T> &c) : _idx(c._idx), _hashmap(c._hashmap) {}
 
-		NodeType &operator *() const { return *deref(); }
+		NodeType &operator*() const { return *deref(); }
 		NodeType *operator->() const { return deref(); }
 
-		bool operator ==(const IteratorImpl &iter) const { return _idx == iter._idx && _hashmap == iter._hashmap; }
-		bool operator !=(const IteratorImpl &iter) const { return !(*this == iter); }
+		bool operator==(const IteratorImpl &iter) const { return _idx == iter._idx && _hashmap == iter._hashmap; }
+		bool operator!=(const IteratorImpl &iter) const { return !(*this == iter); }
 
-		IteratorImpl &operator ++() {
+		IteratorImpl &operator++() {
 			assert(_hashmap);
 			do {
 				_idx++;
@@ -198,7 +198,7 @@
 			return *this;
 		}
 
-		IteratorImpl operator ++(int) {
+		IteratorImpl operator++(int) {
 			IteratorImpl old = *this;
 			operator ++();
 			return old;
@@ -210,10 +210,10 @@
 	typedef IteratorImpl<const Node> const_iterator;
 
 	HashMap();
-	HashMap(const HM_t& map);
+	HashMap(const HM_t &map);
 	~HashMap();
 
-	HM_t &operator =(const HM_t &map) {
+	HM_t &operator=(const HM_t &map) {
 		if (this == &map)
 			return *this;
 
@@ -227,8 +227,8 @@
 
 	bool contains(const Key &key) const;
 
-	Val &operator [](const Key &key);
-	const Val &operator [](const Key &key) const;
+	Val &operator[](const Key &key);
+	const Val &operator[](const Key &key) const;
 
 	Val &getVal(const Key &key);
 	const Val &getVal(const Key &key) const;
@@ -291,7 +291,7 @@
 /**
  * Base constructor, creates an empty hashmap.
  */
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 HashMap<Key, Val, HashFunc, EqualFunc>::HashMap() :
 #ifdef USE_HASHMAP_MEMORY_POOL
 	_nodePool(sizeof(Node)),
@@ -315,8 +315,8 @@
  * We must provide a custom copy constructor as we use pointers
  * to heap buffers for the internal storage.
  */
-template <class Key, class Val, class HashFunc, class EqualFunc>
-HashMap<Key, Val, HashFunc, EqualFunc>::HashMap(const HM_t& map) : 
+template<class Key, class Val, class HashFunc, class EqualFunc>
+HashMap<Key, Val, HashFunc, EqualFunc>::HashMap(const HM_t &map) : 
 #ifdef USE_HASHMAP_MEMORY_POOL
 	_nodePool(sizeof(Node)),
 #endif
@@ -327,7 +327,7 @@
 /**
  * Destructor, frees all used memory.
  */
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 HashMap<Key, Val, HashFunc, EqualFunc>::~HashMap() {
 	for (uint ctr = 0; ctr < _arrsize; ++ctr)
 		if (_arr[ctr] != NULL)
@@ -343,8 +343,8 @@
  * @note We do *not* deallocate the previous storage here -- the caller is
  *       responsible for doing that!
  */
-template <class Key, class Val, class HashFunc, class EqualFunc>
-void HashMap<Key, Val, HashFunc, EqualFunc>::assign(const HM_t& map) {
+template<class Key, class Val, class HashFunc, class EqualFunc>
+void HashMap<Key, Val, HashFunc, EqualFunc>::assign(const HM_t &map) {
 	_arrsize = map._arrsize;
 	_arr = new Node *[_arrsize];
 	assert(_arr != NULL);
@@ -364,7 +364,7 @@
 }
 
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 void HashMap<Key, Val, HashFunc, EqualFunc>::clear(bool shrinkArray) {
 	for (uint ctr = 0; ctr < _arrsize; ++ctr) {
 		if (_arr[ctr] != NULL) {
@@ -385,7 +385,7 @@
 	_nele = 0;
 }
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 void HashMap<Key, Val, HashFunc, EqualFunc>::expand_array(uint newsize) {
 	assert(newsize > _arrsize);
 	uint ctr, dex;
@@ -428,7 +428,7 @@
 	return;
 }
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 int HashMap<Key, Val, HashFunc, EqualFunc>::lookup(const Key &key) const {
 	uint ctr = _hash(key) % _arrsize;
 
@@ -450,7 +450,7 @@
 	return ctr;
 }
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 int HashMap<Key, Val, HashFunc, EqualFunc>::lookupAndCreateIfMissing(const Key &key) {
 	uint ctr = lookup(key);
 
@@ -469,30 +469,30 @@
 }
 
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 bool HashMap<Key, Val, HashFunc, EqualFunc>::contains(const Key &key) const {
 	uint ctr = lookup(key);
 	return (_arr[ctr] != NULL);
 }
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
-Val &HashMap<Key, Val, HashFunc, EqualFunc>::operator [](const Key &key) {
+template<class Key, class Val, class HashFunc, class EqualFunc>
+Val &HashMap<Key, Val, HashFunc, EqualFunc>::operator[](const Key &key) {
 	return getVal(key);
 }
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
-const Val &HashMap<Key, Val, HashFunc, EqualFunc>::operator [](const Key &key) const {
+template<class Key, class Val, class HashFunc, class EqualFunc>
+const Val &HashMap<Key, Val, HashFunc, EqualFunc>::operator[](const Key &key) const {
 	return getVal(key);
 }
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key) {
 	uint ctr = lookupAndCreateIfMissing(key);
 	assert(_arr[ctr] != NULL);
 	return _arr[ctr]->_value;
 }
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 const Val &HashMap<Key, Val, HashFunc, EqualFunc>::getVal(const Key &key) const {
 	uint ctr = lookup(key);
 	if (_arr[ctr] != NULL)
@@ -501,14 +501,14 @@
 		return _defaultVal;
 }
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 void HashMap<Key, Val, HashFunc, EqualFunc>::setVal(const Key &key, const Val &val) {
 	uint ctr = lookupAndCreateIfMissing(key);
 	assert(_arr[ctr] != NULL);
 	_arr[ctr]->_value = val;
 }
 
-template <class Key, class Val, class HashFunc, class EqualFunc>
+template<class Key, class Val, class HashFunc, class EqualFunc>
 void HashMap<Key, Val, HashFunc, EqualFunc>::erase(const Key &key) {
 	// This is based on code in the Wikipedia article on Hash tables.
 	uint i = lookup(key);

Modified: scummvm/trunk/common/list.h
===================================================================
--- scummvm/trunk/common/list.h	2008-05-03 22:10:52 UTC (rev 31851)
+++ scummvm/trunk/common/list.h	2008-05-03 23:02:05 UTC (rev 31852)
@@ -33,7 +33,7 @@
  * Simple double linked list, modeled after the list template of the standard
  * C++ library.
  */
-template <class t_T>
+template<class t_T>
 class List {
 protected:
 #if defined (_WIN32_WCE) || defined (_MSC_VER)
@@ -52,7 +52,7 @@
 		Node(const t_T2 &x) : _data(x) {}
 	};
 
-	template <class t_T2>
+	template<class t_T2>
 	class Iterator {
 		template<class T> friend class Iterator;
 		friend class List<t_T>;
@@ -70,7 +70,7 @@
 		Iterator(const Iterator<T> &c) : _node(c._node) {}
 
 		template<class T>
-		Iterator<t_T2> &operator =(const Iterator<T> &c) {
+		Iterator<t_T2> &operator=(const Iterator<T> &c) {
 			_node = c._node;
 			return *this;
 		}
@@ -104,7 +104,7 @@
 #if (__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)
 			return static_cast<List<t_T>::Node<t_T2> *>(_node)->_data;
 #else
-			return static_cast<Node<t_T2>*>(_node)->_data;
+			return static_cast<Node<t_T2> *>(_node)->_data;
 #endif
 		}
 		t_T2 *operator->() const {
@@ -135,7 +135,7 @@
 		_anchor._prev = &_anchor;
 		_anchor._next = &_anchor;
 	}
-	List(const List<t_T>& list) {
+	List(const List<t_T> &list) {
 		_anchor._prev = &_anchor;
 		_anchor._next = &_anchor;
 
@@ -146,15 +146,15 @@
 		clear();
 	}
 
-	void push_front(const t_T& element) {
+	void push_front(const t_T &element) {
 		insert(begin(), element);
 	}
 
-	void push_back(const t_T& element) {
+	void push_back(const t_T &element) {
 		insert(end(), element);
 	}
 
-	void insert(iterator pos, const t_T& element) {
+	void insert(iterator pos, const t_T &element) {
 		NodeBase *newNode = new Node<t_T>(element);
 
 		newNode->_next = pos._node;
@@ -163,7 +163,7 @@
 		newNode->_next->_prev = newNode;
 	}
 
-	template <typename iterator2>
+	template<typename iterator2>
 	void insert(iterator pos, iterator2 first, iterator2 last) {
 		for (; first != last; ++first)
 			insert(pos, *first);
@@ -210,7 +210,7 @@
 	}
 
 
-	List<t_T>& operator  =(const List<t_T>& list) {
+	List<t_T> &operator=(const List<t_T> &list) {
 		if (this != &list) {
 			iterator i;
 			const_iterator j;

Modified: scummvm/trunk/common/noncopyable.h
===================================================================
--- scummvm/trunk/common/noncopyable.h	2008-05-03 22:10:52 UTC (rev 31851)
+++ scummvm/trunk/common/noncopyable.h	2008-05-03 23:02:05 UTC (rev 31852)
@@ -38,7 +38,7 @@
 private:
 	// Prevent copying instances by accident
 	NonCopyable(const NonCopyable&);
-	NonCopyable& operator= (const NonCopyable&);
+	NonCopyable& operator=(const NonCopyable&);
 };
 
 } // End of namespace Common

Modified: scummvm/trunk/common/singleton.h
===================================================================
--- scummvm/trunk/common/singleton.h	2008-05-03 22:10:52 UTC (rev 31851)
+++ scummvm/trunk/common/singleton.h	2008-05-03 23:02:05 UTC (rev 31852)
@@ -33,13 +33,13 @@
 /**
  * Generic template base class for implementing the singleton design pattern.
  */
-template <class T>
+template<class T>
 class Singleton : NonCopyable {
 private:
-	Singleton<T>(const Singleton<T>&);
-	Singleton<T>& operator= (const Singleton<T>&);
+	Singleton<T>(const Singleton<T> &);
+	Singleton<T> &operator=(const Singleton<T> &);
 
-	static T* _singleton;
+	static T *_singleton;
 
 	/**
 	 * The default object factory used by the template class Singleton.
@@ -53,7 +53,7 @@
 //FIXME evc4 and msvc7 doesn't like it as private member
 public:
 #endif
-	static T* makeInstance() {
+	static T *makeInstance() {
 		return new T();
 	}
 
@@ -91,7 +91,7 @@
 	typedef T	SingletonBaseType;
 };
 
-#define DECLARE_SINGLETON(T) template<> T* Common::Singleton<T>::_singleton=0
+#define DECLARE_SINGLETON(T) template<> T *Common::Singleton<T>::_singleton = 0
 
 }	// End of namespace Common
 

Modified: scummvm/trunk/common/stack.h
===================================================================
--- scummvm/trunk/common/stack.h	2008-05-03 22:10:52 UTC (rev 31851)
+++ scummvm/trunk/common/stack.h	2008-05-03 23:02:05 UTC (rev 31852)
@@ -33,7 +33,7 @@
 /**
  * Extremly simple fixed size stack class.
  */
-template <class T, int MAX_SIZE = 10>
+template<class T, int MAX_SIZE = 10>
 class FixedStack {
 protected:
 	T	_stack[MAX_SIZE];
@@ -47,15 +47,15 @@
 	void clear() {
 		_size = 0;
 	}
-	void push(const T& x) {
+	void push(const T &x) {
 		assert(_size < MAX_SIZE);
 		_stack[_size++] = x;
 	}
-	const T& top() const {
+	const T &top() const {
 		assert(_size > 0);
 		return _stack[_size - 1];
 	}
-	T& top() {
+	T &top() {
 		assert(_size > 0);
 		return _stack[_size - 1];
 	}
@@ -67,11 +67,11 @@
 	int size() const {
 		return _size;
 	}
-	T& operator [](int i) {
+	T &operator[](int i) {
 		assert(0 <= i && i < MAX_SIZE);
 		return _stack[i];
 	}
-	const T& operator [](int i) const {
+	const T &operator[](int i) const {
 		assert(0 <= i && i < MAX_SIZE);
 		return _stack[i];
 	}
@@ -81,7 +81,7 @@
 /**
  * Variable size stack class, implemented using our Array class.
  */
-template <class T>
+template<class T>
 class Stack {
 protected:
 	Array<T>	_stack;
@@ -95,7 +95,7 @@
 	void clear() {
 		_stack.clear();
 	}
-	void push(const T& x) {
+	void push(const T &x) {
 		_stack.push_back(x);
 	}
 	T top() const {
@@ -110,7 +110,7 @@
 	int size() const {
 		return _stack.size();
 	}
-	T operator [](int i) {
+	T operator[](int i) {
 		return _stack[i];
 	}
 };


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list