Browse Source

Move namespace to inside the .inl files

Michael Ragazzon 6 years ago
parent
commit
6a91e678bb

+ 0 - 4
Include/Rocket/Core/Colour.h

@@ -112,12 +112,8 @@ public:
 }
 }
 
-namespace Rocket {
-namespace Core {
 
 #include "Colour.inl"
 
-}
-}
 
 #endif

+ 6 - 0
Include/Rocket/Core/Colour.inl

@@ -25,6 +25,9 @@
  *
  */
 
+namespace Rocket {
+namespace Core {
+
 // Lightweight, non-initialising constructor.
 template < typename ColourType, int AlphaDefault >
 Colour< ColourType, AlphaDefault >::Colour()
@@ -117,3 +120,6 @@ void ROCKETCORE_API Colour< float, 1 >::operator*=(const Colour& rhs);
 
 template < >
 void ROCKETCORE_API Colour< byte, 255 >::operator*=(const Colour& rhs);
+
+}
+}

+ 2 - 2
Include/Rocket/Core/Dictionary.h

@@ -143,9 +143,9 @@ private:
 	void Copy(const Dictionary &dict);
 };
 
-#include "Dictionary.inl"
-
 }
 }
 
+#include "Dictionary.inl"
+
 #endif

+ 9 - 3
Include/Rocket/Core/Dictionary.inl

@@ -25,6 +25,9 @@
  *
  */
 
+namespace Rocket {
+namespace Core {
+
 template< typename T >
 inline void Dictionary::Set(const String& key, const T& value)
 {
@@ -48,12 +51,12 @@ inline bool Dictionary::GetInto(const String& key, T& value) const
 	Variant* variant = Get(key);
 	if (!variant)
 		return false;
-		
-	return variant->GetInto<T>(value);	
+
+	return variant->GetInto<T>(value);
 }
 
 template <typename T>
-inline bool Dictionary::Iterate(int &pos, String& key, T& value) const
+inline bool Dictionary::Iterate(int& pos, String& key, T& value) const
 {
 	Variant* variant;
 	bool iterate = Iterate(pos, key, variant);
@@ -61,3 +64,6 @@ inline bool Dictionary::Iterate(int &pos, String& key, T& value) const
 		variant->GetInto(value);
 	return iterate;
 }
+
+}
+}

+ 2 - 2
Include/Rocket/Core/Element.h

@@ -798,9 +798,9 @@ private:
 	friend class LayoutInlineBox;
 };
 
-#include "Element.inl"
-
 }
 }
 
+#include "Element.inl"
+
 #endif

+ 7 - 1
Include/Rocket/Core/Element.inl

@@ -25,6 +25,9 @@
  *
  */
 
+namespace Rocket {
+namespace Core {
+
 // Returns the values of one of this element's properties.
 // We can assume the property will exist based on the RCSS inheritance.
 template < typename T >
@@ -49,7 +52,7 @@ void Element::SetAttribute(const String& name, const T& value)
 // Gets the specified attribute, with default value.
 template< typename T >
 T Element::GetAttribute(const String& name, const T& default_value) const
-{			
+{
 	return attributes.Get(name, default_value);
 }
 
@@ -59,3 +62,6 @@ bool Element::IterateAttributes(int& index, String& name, T& value) const
 {
 	return attributes.Iterate(index, name, value);
 }
+
+}
+}

+ 2 - 2
Include/Rocket/Core/ElementInstancerGeneric.h

@@ -61,9 +61,9 @@ public:
 	virtual void Release();
 };
 
-#include "ElementInstancerGeneric.inl"
-
 }
 }
 
+#include "ElementInstancerGeneric.inl"
+
 #endif

+ 7 - 1
Include/Rocket/Core/ElementInstancerGeneric.inl

@@ -25,11 +25,14 @@
  *
  */
 
+namespace Rocket {
+namespace Core {
+
 template <typename T>
 ElementInstancerGeneric<T>::~ElementInstancerGeneric()
 {
 }
-	
+
 // Instances an element given the tag name and attributes
 template <typename T>
 Element* ElementInstancerGeneric<T>::InstanceElement(Element* /*parent*/, const String& tag, const XMLAttributes& /*attributes*/)
@@ -54,3 +57,6 @@ void ElementInstancerGeneric<T>::Release()
 {
 	delete this;
 }
+
+}
+}

+ 2 - 2
Include/Rocket/Core/StringBase.h

@@ -210,10 +210,10 @@ protected:
 	inline StringBase<T>& _Assign(const T* assign, size_type assign_length, size_type count = StringBase<T>::npos);
 	inline void _Insert(size_type index, const T* insert, size_type insert_length, size_type count = StringBase<T>::npos);
 };
-	
-#include "StringBase.inl"
 
 }
 }
 
+#include "StringBase.inl"
+
 #endif

+ 105 - 99
Include/Rocket/Core/StringBase.inl

@@ -25,6 +25,9 @@
  *
  */
 
+namespace Rocket {
+namespace Core {
+
 template< typename T >
 StringBase< T >::StringBase() : value((T*)local_buffer), buffer_size(LOCAL_BUFFER_SIZE), length(0), hash(0)
 {
@@ -54,7 +57,7 @@ StringBase< T >::StringBase(const T* string_start, const T* string_end) : value(
 	if (length > 0)
 	{
 		Reserve(length);
-		Copy(value, string_start, length, true);		
+		Copy(value, string_start, length, true);
 	}
 }
 
@@ -74,7 +77,7 @@ StringBase< T >::StringBase(size_type count, const T character) : value((T*)loca
 }
 
 template< typename T >
-StringBase< T >::StringBase(size_type ROCKET_UNUSED_PARAMETER(max_length), const T* ROCKET_UNUSED_PARAMETER(fmt), ...) : value((T*)local_buffer), buffer_size(LOCAL_BUFFER_SIZE), length(0), hash(0)
+StringBase< T >::StringBase(size_type ROCKET_UNUSED_PARAMETER(max_length), const T * ROCKET_UNUSED_PARAMETER(fmt), ...) : value((T*)local_buffer), buffer_size(LOCAL_BUFFER_SIZE), length(0), hash(0)
 {
 	ROCKET_UNUSED(max_length);
 	ROCKET_UNUSED(fmt);
@@ -122,29 +125,29 @@ unsigned int StringBase< T >::Hash() const
 	if (hash == 0 && length > 0)
 	{
 		// FNV-1 hash algorithm
-		unsigned char* bp = (unsigned char *)value;	// start of buffer
-		unsigned char* be = (unsigned char *)value + (length * sizeof(T));
-		
+		unsigned char* bp = (unsigned char*)value;	// start of buffer
+		unsigned char* be = (unsigned char*)value + (length * sizeof(T));
+
 		// FNV-1a hash each octet in the buffer
-		while (bp < be) 
+		while (bp < be)
 		{
 			// xor the bottom with the current octet
 			hash ^= *bp++;
-			
+
 			/* multiply by the 32 bit FNV magic prime mod 2^32 */
-			#if !defined(__GNUC__)
-				const unsigned int FNV_32_PRIME = ((unsigned int)16777619);
-				hash *= FNV_32_PRIME;
-			#else
-				hash += (hash<<1) + (hash<<4) + (hash<<7) + (hash<<8) + (hash<<24);
-			#endif
+#if !defined(__GNUC__)
+			const unsigned int FNV_32_PRIME = ((unsigned int)16777619);
+			hash *= FNV_32_PRIME;
+#else
+			hash += (hash << 1) + (hash << 4) + (hash << 7) + (hash << 8) + (hash << 24);
+#endif
 		}
 	}
 	return hash;
 }
 
 template< typename T >
-const T* StringBase< T >::CString() const
+const T * StringBase< T >::CString() const
 {
 	return value;
 }
@@ -153,19 +156,19 @@ template< typename T >
 void StringBase< T >::Reserve(size_type size)
 {
 	size_type new_size = (size + 1) * sizeof(T);
-	
+
 	if (buffer_size >= new_size)
 		return;
-	
+
 	// Pad out to a block of 16 bytes
 	const int BLOCK_SIZE = 16;
-	new_size = (new_size+BLOCK_SIZE-1)&(~(BLOCK_SIZE-1));
-	
+	new_size = (new_size + BLOCK_SIZE - 1) & (~(BLOCK_SIZE - 1));
+
 	if (value == (T*)local_buffer)
 	{
 		T* new_value = (T*)realloc(NULL, new_size);
 		ROCKET_ASSERTMSG(new_value, "Could not reserve memory for String, realloc failed.");
-		if(new_value != NULL)
+		if (new_value != NULL)
 		{
 			buffer_size = new_size;
 			Copy(new_value, (T*)local_buffer, LOCAL_BUFFER_SIZE / sizeof(T));
@@ -176,7 +179,7 @@ void StringBase< T >::Reserve(size_type size)
 	{
 		T* new_value = (T*)realloc(value, new_size);
 		ROCKET_ASSERTMSG(new_value, "Could not reserve memory for String, realloc failed.");
-		if(new_value != NULL)
+		if (new_value != NULL)
 		{
 			buffer_size = new_size;
 			value = new_value;
@@ -185,44 +188,44 @@ void StringBase< T >::Reserve(size_type size)
 }
 
 template< typename T >
-typename StringBase< T >::size_type StringBase< T >::Find(const T* find, size_type offset) const
+typename StringBase< T >::size_type StringBase< T >::Find(const T * find, size_type offset) const
 {
-	return _Find(find, GetLength(find), offset);	
+	return _Find(find, GetLength(find), offset);
 }
 
 template< typename T >
-typename StringBase< T >::size_type StringBase< T >::Find(const StringBase< T >& find, size_type offset) const
+typename StringBase< T >::size_type StringBase< T >::Find(const StringBase< T > & find, size_type offset) const
 {
 	return _Find(find.CString(), find.Length(), offset);
 }
 
 template< typename T >
-typename StringBase< T >::size_type StringBase< T >::RFind(const T* find, size_type offset) const
+typename StringBase< T >::size_type StringBase< T >::RFind(const T * find, size_type offset) const
 {
-	return _RFind(find, GetLength(find), offset);	
+	return _RFind(find, GetLength(find), offset);
 }
 
 template< typename T >
-typename StringBase< T >::size_type StringBase< T >::RFind(const StringBase< T >& find, size_type offset) const
+typename StringBase< T >::size_type StringBase< T >::RFind(const StringBase< T > & find, size_type offset) const
 {
 	return _RFind(find.CString(), find.Length(), offset);
 }
 
 template< typename T >
-StringBase< T > StringBase< T >::Replace(const T* find, const T* replace) const
+StringBase< T > StringBase< T >::Replace(const T * find, const T * replace) const
 {
 	return _Replace(find, GetLength(find), replace, GetLength(replace));
 }
 
 template< typename T >
-StringBase< T > StringBase< T >::Replace(const StringBase< T >& find, const StringBase< T >& replace) const
+StringBase< T > StringBase< T >::Replace(const StringBase< T > & find, const StringBase< T > & replace) const
 {
 	return _Replace(find.CString(), find.Length(), replace.CString(), replace.Length());
 }
 
 template< typename T >
 StringBase< T > StringBase< T >::Substring(size_type start, size_type count) const
-{	
+{
 	// Ensure we're not going of bounds
 	if (count > length - start)
 		count = length - start;
@@ -234,60 +237,60 @@ StringBase< T > StringBase< T >::Substring(size_type start, size_type count) con
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::Append(const T* append, size_type count)
+StringBase< T > & StringBase< T >::Append(const T * append, size_type count)
 {
 	return _Append(append, GetLength(append), count);
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::Append(const StringBase< T >& append, size_type count)
+StringBase< T >& StringBase< T >::Append(const StringBase< T > & append, size_type count)
 {
 	return _Append(append.CString(), append.Length(), count);
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::Append(const T& append)
+StringBase< T >& StringBase< T >::Append(const T & append)
 {
 	T buffer[2] = { append, 0 };
 	return (*this += buffer);
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::Assign(const T* assign, size_type count)
+StringBase< T >& StringBase< T >::Assign(const T * assign, size_type count)
 {
 	size_type assign_length = GetLength(assign);
 	return _Assign(assign, count > assign_length ? assign_length : count);
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::Assign(const T* assign, const T* end)
-{	
+StringBase< T >& StringBase< T >::Assign(const T * assign, const T * end)
+{
 	return _Assign(assign, end - assign);
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::Assign(const StringBase< T >& assign, size_type count)
+StringBase< T >& StringBase< T >::Assign(const StringBase< T > & assign, size_type count)
 {
 	return _Assign(assign.CString(), assign.length, count);
 }
 
 // Insert a string into this string
 template< typename T >
-void StringBase< T >::Insert(size_type index, const T* insert, size_type count)
+void StringBase< T >::Insert(size_type index, const T * insert, size_type count)
 {
 	return _Insert(index, insert, GetLength(insert), count);
 }
 
 // Insert a string into this string
 template< typename T >
-void StringBase< T >::Insert(size_type index, const StringBase< T >& insert, size_type count)
+void StringBase< T >::Insert(size_type index, const StringBase< T > & insert, size_type count)
 {
 	return _Insert(index, insert.value, insert.length, count);
 }
 
 // Insert a character into this string
 template< typename T >
-void StringBase< T >::Insert(size_type index, const T& insert)
+void StringBase< T >::Insert(size_type index, const T & insert)
 {
 	return _Insert(index, &insert, 1, 1);
 }
@@ -306,8 +309,8 @@ void StringBase< T >::Erase(size_type index, size_type count)
 	else
 	{
 		size_type erase_amount = count < length - index ? count : length - index;
-			
-		Copy(&value[index], &value[index + erase_amount], length - index - erase_amount, true);		
+
+		Copy(&value[index], &value[index + erase_amount], length - index - erase_amount, true);
 
 		length -= erase_amount;
 
@@ -317,7 +320,7 @@ void StringBase< T >::Erase(size_type index, size_type count)
 }
 
 template< typename T >
-int StringBase< T >::FormatString(size_type ROCKET_UNUSED_PARAMETER(max_length), const T* ROCKET_UNUSED_PARAMETER(fmt), ...)
+int StringBase< T >::FormatString(size_type ROCKET_UNUSED_PARAMETER(max_length), const T * ROCKET_UNUSED_PARAMETER(fmt), ...)
 {
 	ROCKET_UNUSED(max_length);
 	ROCKET_UNUSED(fmt);
@@ -402,42 +405,42 @@ StringBase< T > StringBase< T >::ToUpper() const
 }
 
 template< typename T >
-bool StringBase< T >::operator==(const T* compare) const
+bool StringBase< T >::operator==(const T * compare) const
 {
 	size_type index = 0;
-	
+
 	while (index < length && compare[index] == value[index])
 		index++;
 
-	return index == length && compare[index] == '\0';	
+	return index == length && compare[index] == '\0';
 }
 
 template< typename T >
-bool StringBase< T >::operator==(const StringBase< T >& compare) const
+bool StringBase< T >::operator==(const StringBase< T > & compare) const
 {
 	if (length != compare.length)
 		return false;
-	
+
 	if (Hash() != compare.Hash())
 		return false;
-		
+
 	return (*this) == compare.value;
 }
 
 template< typename T >
-bool StringBase< T >::operator!=(const T* compare) const
+bool StringBase< T >::operator!=(const T * compare) const
 {
 	return !(*this == compare);
 }
 
 template< typename T >
-bool StringBase< T >::operator!=(const StringBase< T >& compare) const
+bool StringBase< T >::operator!=(const StringBase< T > & compare) const
 {
 	return !(*this == compare);
 }
 
 template< typename T >
-bool StringBase< T >::operator<(const T* compare) const
+bool StringBase< T >::operator<(const T * compare) const
 {
 	size_type index = 0;
 	while (index < length && compare[index] == value[index])
@@ -461,65 +464,65 @@ bool StringBase< T >::operator<(const T* compare) const
 		// if the string we're comparing with still
 		// has data, then we're smaller
 		if (compare[index] != 0)
-			return true;		
+			return true;
 	}
 
 	return false;
 }
 
 template< typename T >
-bool StringBase< T >::operator<(const StringBase< T >& compare) const
+bool StringBase< T >::operator<(const StringBase< T > & compare) const
 {
 	return *this < compare.CString();
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::operator=(const T* assign)
+StringBase< T >& StringBase< T >::operator=(const T * assign)
 {
 	return Assign(assign);
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::operator=(const StringBase< T >& assign)
-{	
-	StringBase< T >&out = Assign(assign);
+StringBase< T >& StringBase< T >::operator=(const StringBase< T > & assign)
+{
+	StringBase< T >& out = Assign(assign);
 	out.hash = assign.hash;
 	return out;
 }
 
 template< typename T >
-StringBase< T > StringBase< T >::operator+(const T* add) const
-{	
+StringBase< T > StringBase< T >::operator+(const T * add) const
+{
 	StringBase< T > combined(*this);
-	combined.Append(add);	
-	
+	combined.Append(add);
+
 	return combined;
 }
 
 template< typename T >
-StringBase< T > StringBase< T >::operator+(const StringBase< T >& add) const
-{	
+StringBase< T > StringBase< T >::operator+(const StringBase< T > & add) const
+{
 	StringBase< T > combined(*this);
-	combined.Append(add);	
-	
+	combined.Append(add);
+
 	return combined;
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::operator+=(const T* add)
-{	
+StringBase< T >& StringBase< T >::operator+=(const T * add)
+{
 	return Append(add);
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::operator+=(const StringBase< T >& add)
-{	
+StringBase< T >& StringBase< T >::operator+=(const StringBase< T > & add)
+{
 	return _Append(add.CString(), add.length);
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::operator+=(const T& add)
-{	
+StringBase< T >& StringBase< T >::operator+=(const T & add)
+{
 	return Append(add);
 }
 
@@ -538,37 +541,37 @@ T& StringBase< T >::operator[](size_type index)
 }
 
 template< typename T >
-typename StringBase< T >::size_type StringBase< T >::GetLength(const T* string) const
-{	
+typename StringBase< T >::size_type StringBase< T >::GetLength(const T * string) const
+{
 	const T* ptr = string;
 
 	while (*ptr)
 	{
-		ptr++;		
+		ptr++;
 	}
 
 	return ptr - string;
 }
 
 template< typename T >
-void StringBase< T >::Copy(T* target, const T* src, size_type length, bool terminate)
+void StringBase< T >::Copy(T * target, const T * src, size_type length, bool terminate)
 {
 	// Copy values
 	for (size_type i = 0; i < length; i++)
 	{
 		*target++ = *src++;
 	}
-	
+
 	if (terminate)
-	{		
-		*target++ = 0;		
+	{
+		*target++ = 0;
 	}
 }
 
 template< typename T >
-typename StringBase< T >::size_type StringBase< T >::_Find(const T* find, size_type find_length, size_type offset) const
+typename StringBase< T >::size_type StringBase< T >::_Find(const T * find, size_type find_length, size_type offset) const
 {
-	size_type needle_index = 0;	
+	size_type needle_index = 0;
 	size_type haystack_index = offset;
 
 	// If the find length is greater than the string we have, it can't be here
@@ -588,7 +591,7 @@ typename StringBase< T >::size_type StringBase< T >::_Find(const T* find, size_t
 			if (needle_index == find_length)
 				return haystack_index;
 		}
-		else		
+		else
 		{
 			// Advance haystack index by one and reset needle index.
 			haystack_index++;
@@ -600,11 +603,11 @@ typename StringBase< T >::size_type StringBase< T >::_Find(const T* find, size_t
 }
 
 template< typename T >
-typename StringBase< T >::size_type StringBase< T >::_RFind(const T* find, size_type find_length, size_type offset) const
+typename StringBase< T >::size_type StringBase< T >::_RFind(const T * find, size_type find_length, size_type offset) const
 {
 	ROCKET_ASSERT(find_length > 0);
 
-	size_type needle_index = 0;	
+	size_type needle_index = 0;
 	size_type haystack_index = (offset < length ? offset : length) - find_length;
 
 	// If the find length is greater than the string we have, it can't be here
@@ -624,7 +627,7 @@ typename StringBase< T >::size_type StringBase< T >::_RFind(const T* find, size_
 			if (find[needle_index] == 0)
 				return haystack_index;
 		}
-		else		
+		else
 		{
 			if (haystack_index == 0)
 				return npos;
@@ -637,11 +640,11 @@ typename StringBase< T >::size_type StringBase< T >::_RFind(const T* find, size_
 }
 
 template< typename T >
-StringBase< T > StringBase< T >::_Replace(const T* find, size_type find_length, const T* replace, size_type replace_length) const
+StringBase< T > StringBase< T >::_Replace(const T * find, size_type find_length, const T * replace, size_type replace_length) const
 {
 	StringBase< T > result;
 
-	size_type offset = 0;	
+	size_type offset = 0;
 	// Loop until we reach the end of the string
 	while (offset < Length())
 	{
@@ -659,15 +662,15 @@ StringBase< T > StringBase< T >::_Replace(const T* find, size_type find_length,
 		// Advance the find position
 		offset = pos + find_length;
 	}
-	
+
 	hash = 0;
 
 	return result;
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::_Append(const T* append, size_type append_length, size_type count)
-{	
+StringBase< T >& StringBase< T >::_Append(const T * append, size_type append_length, size_type count)
+{
 	size_type add_length = count < append_length ? count : append_length;
 
 	if (add_length == 0)
@@ -676,15 +679,15 @@ StringBase< T >& StringBase< T >::_Append(const T* append, size_type append_leng
 	Reserve(length + add_length);
 	Copy(&value[length], append, add_length, true);
 	length += add_length;
-	
+
 	hash = 0;
-	
+
 	return *this;
 }
 
 template< typename T >
-StringBase< T >& StringBase< T >::_Assign(const T* assign, size_type assign_length, size_type count)
-{		
+StringBase< T > & StringBase< T >::_Assign(const T * assign, size_type assign_length, size_type count)
+{
 	size_type new_length = count < assign_length ? count : assign_length;
 
 	if (new_length == 0)
@@ -698,30 +701,33 @@ StringBase< T >& StringBase< T >::_Assign(const T* assign, size_type assign_leng
 	}
 
 	length = new_length;
-	
+
 	hash = 0;
-	
+
 	return *this;
 }
 
 template< typename T >
-void StringBase< T >::_Insert(size_type index, const T* insert, size_type insert_length, size_type count)
+void StringBase< T >::_Insert(size_type index, const T * insert, size_type insert_length, size_type count)
 {
 	if (index >= length)
 	{
 		Append(insert, count);
 		return;
 	}
-	
+
 	size_type add_length = count < insert_length ? count : insert_length;
 
 	Reserve(length + add_length);
-	
+
 	for (size_type i = length + 1; i > index; i--)
 		value[i + add_length - 1] = value[i - 1];
 
 	Copy(&value[index], insert, add_length);
 	length += add_length;
-	
+
 	hash = 0;
 }
+
+}
+}

+ 2 - 2
Include/Rocket/Core/Variant.h

@@ -146,9 +146,9 @@ private:
 	char data[LOCAL_DATA_SIZE];
 };
 
-#include "Variant.inl"
-
 }
 }
 
+#include "Variant.inl"
+
 #endif

+ 8 - 3
Include/Rocket/Core/Variant.inl

@@ -25,6 +25,8 @@
  *
  */
 
+namespace Rocket {
+namespace Core {
 
 inline Variant::Type Variant::GetType() const
 {
@@ -35,7 +37,7 @@ inline Variant::Type Variant::GetType() const
 template< typename T >
 Variant::Variant(const T& t) : type(NONE)
 {
-	Set( t );
+	Set(t);
 }
 
 // Clear and set new value
@@ -49,7 +51,7 @@ void Variant::Reset(const T& t)
 // Templatised data accessor.
 template< typename T >
 bool Variant::GetInto(T& value) const
-{	
+{
 	switch (type)
 	{
 	case BYTE:
@@ -109,7 +111,7 @@ bool Variant::GetInto(T& value) const
 		break;
 
 	case SCRIPTINTERFACE:
-		return TypeConverter< ScriptInterface*, T >::Convert(*(ScriptInterface**)data, value);
+		return TypeConverter< ScriptInterface*, T >::Convert(*(ScriptInterface * *)data, value);
 		break;
 
 	case VOIDPTR:
@@ -131,3 +133,6 @@ T Variant::Get() const
 	GetInto(value);
 	return value;
 }
+
+}
+}

+ 2 - 2
Include/Rocket/Core/Vector2.h

@@ -132,9 +132,9 @@ class Vector2
 		Type y;
 };
 
-#include "Vector2.inl"
-
 }
 }
 
+#include "Vector2.inl"
+
 #endif

+ 20 - 14
Include/Rocket/Core/Vector2.inl

@@ -25,6 +25,9 @@
  *
  */
 
+namespace Rocket {
+namespace Core {
+
 // Default constructor.
 template < typename Type >
 Vector2< Type >::Vector2()
@@ -43,7 +46,7 @@ Vector2< Type >::Vector2(Type _x, Type _y)
 template < typename Type >
 float Vector2< Type >::Magnitude() const
 {
-	float squared_magnitude = (float) SquaredMagnitude();
+	float squared_magnitude = (float)SquaredMagnitude();
 	if (Math::IsZero(squared_magnitude))
 		return 0;
 
@@ -55,7 +58,7 @@ template < typename Type >
 Type Vector2< Type >::SquaredMagnitude() const
 {
 	return x * x +
-		   y * y;
+		y * y;
 }
 
 // Generates a normalised vector from this vector.
@@ -91,7 +94,7 @@ template < typename Type >
 Type Vector2< Type >::DotProduct(const Vector2< Type >& rhs) const
 {
 	return x * rhs.x +
-		   y * rhs.y;
+		y * rhs.y;
 }
 
 // Returns this vector rotated around the origin.
@@ -102,7 +105,7 @@ Vector2< Type > Vector2< Type >::Rotate(float theta) const
 	float sin_theta = Math::Sin(theta);
 
 	return Vector2< Type >(((Type)(cos_theta * x - sin_theta * y)),
-							((Type)(sin_theta * x + cos_theta * y)));
+		((Type)(sin_theta * x + cos_theta * y)));
 }
 
 // Returns the negation of this vector.
@@ -114,14 +117,14 @@ Vector2< Type > Vector2< Type >::operator-() const
 
 // Returns the sum of this vector and another.
 template < typename Type >
-Vector2< Type > Vector2< Type >::operator+(const Vector2< Type >& rhs) const
+Vector2< Type > Vector2< Type >::operator+(const Vector2< Type > & rhs) const
 {
 	return Vector2< Type >(x + rhs.x, y + rhs.y);
 }
 
 // Returns the result of subtracting another vector from this vector.
 template < typename Type >
-Vector2< Type > Vector2< Type >::operator-(const Vector2< Type >& rhs) const
+Vector2< Type > Vector2< Type >::operator-(const Vector2< Type > & rhs) const
 {
 	return Vector2(x - rhs.x, y - rhs.y);
 }
@@ -142,7 +145,7 @@ Vector2< Type > Vector2< Type >::operator/(Type rhs) const
 
 // Adds another vector to this in-place.
 template < typename Type >
-Vector2< Type >& Vector2< Type >::operator+=(const Vector2& rhs)
+Vector2< Type >& Vector2< Type >::operator+=(const Vector2 & rhs)
 {
 	x += rhs.x;
 	y += rhs.y;
@@ -152,7 +155,7 @@ Vector2< Type >& Vector2< Type >::operator+=(const Vector2& rhs)
 
 // Subtracts another vector from this in-place.
 template < typename Type >
-Vector2< Type >& Vector2< Type >::operator-=(const Vector2& rhs)
+Vector2< Type >& Vector2< Type >::operator-=(const Vector2 & rhs)
 {
 	x -= rhs.x;
 	y -= rhs.y;
@@ -162,7 +165,7 @@ Vector2< Type >& Vector2< Type >::operator-=(const Vector2& rhs)
 
 // Scales this vector in-place.
 template < typename Type >
-Vector2< Type >& Vector2< Type >::operator*=(const Type& rhs)
+Vector2< Type >& Vector2< Type >::operator*=(const Type & rhs)
 {
 	x *= rhs;
 	y *= rhs;
@@ -172,7 +175,7 @@ Vector2< Type >& Vector2< Type >::operator*=(const Type& rhs)
 
 // Scales this vector in-place by the inverse of a value.
 template < typename Type >
-Vector2< Type >& Vector2< Type >::operator/=(const Type& rhs)
+Vector2< Type >& Vector2< Type >::operator/=(const Type & rhs)
 {
 	x /= rhs;
 	y /= rhs;
@@ -182,28 +185,31 @@ Vector2< Type >& Vector2< Type >::operator/=(const Type& rhs)
 
 // Equality operator.
 template < typename Type >
-bool Vector2< Type >::operator==(const Vector2& rhs) const
+bool Vector2< Type >::operator==(const Vector2 & rhs) const
 {
 	return (x == rhs.x && y == rhs.y);
 }
 
 // Inequality operator.
 template < typename Type >
-bool Vector2< Type >::operator!=(const Vector2& rhs) const
+bool Vector2< Type >::operator!=(const Vector2 & rhs) const
 {
 	return (x != rhs.x || y != rhs.y);
 }
 
 // Auto-cast operator.
 template < typename Type >
-Vector2< Type >::operator const Type*() const
+Vector2< Type >::operator const Type* () const
 {
 	return &x;
 }
 
 // Constant auto-cast operator.
 template < typename Type >
-Vector2< Type >::operator Type*()
+Vector2< Type >::operator Type* ()
 {
 	return &x;
 }
+
+}
+}

+ 2 - 2
Include/Rocket/Core/Vector3.h

@@ -131,9 +131,9 @@ class Vector3
 		Type z;
 };
 
-#include "Vector3.inl"
-
 }
 }
 
+#include "Vector3.inl"
+
 #endif

+ 19 - 13
Include/Rocket/Core/Vector3.inl

@@ -25,6 +25,9 @@
  *
  */
 
+namespace Rocket {
+namespace Core {
+
 // Default constructor.
 template < typename Type >
 Vector3< Type >::Vector3()
@@ -44,7 +47,7 @@ Vector3< Type >::Vector3(Type _x, Type _y, Type _z)
 template < typename Type >
 float Vector3< Type >::Magnitude() const
 {
-	float squared_magnitude = (float) SquaredMagnitude();
+	float squared_magnitude = (float)SquaredMagnitude();
 	if (Math::IsZero(squared_magnitude))
 		return 0;
 
@@ -87,11 +90,11 @@ Type Vector3< Type >::DotProduct(const Vector3< Type >& rhs) const
 template < typename Type >
 Vector3< Type> Vector3< Type >::CrossProduct(const Vector3< Type >& rhs) const
 {
-	return Vector3< Type > (
+	return Vector3< Type >(
 		y * rhs.z - z * rhs.y,
 		z * rhs.x - x * rhs.z,
 		x * rhs.y - y * rhs.x
-	);
+		);
 }
 
 // Returns the negation of this vector.
@@ -103,14 +106,14 @@ Vector3< Type > Vector3< Type >::operator-() const
 
 // Returns the sum of this vector and another.
 template < typename Type >
-Vector3< Type > Vector3< Type >::operator+(const Vector3< Type >& rhs) const
+Vector3< Type > Vector3< Type >::operator+(const Vector3< Type > & rhs) const
 {
 	return Vector3< Type >(x + rhs.x, y + rhs.y, z + rhs.z);
 }
 
 // Returns the result of subtracting another vector from this vector.
 template < typename Type >
-Vector3< Type > Vector3< Type >::operator-(const Vector3< Type >& rhs) const
+Vector3< Type > Vector3< Type >::operator-(const Vector3< Type > & rhs) const
 {
 	return Vector3(x - rhs.x, y - rhs.y, z - rhs.z);
 }
@@ -131,7 +134,7 @@ Vector3< Type > Vector3< Type >::operator/(Type rhs) const
 
 // Adds another vector to this in-place.
 template < typename Type >
-Vector3< Type >& Vector3< Type >::operator+=(const Vector3& rhs)
+Vector3< Type >& Vector3< Type >::operator+=(const Vector3 & rhs)
 {
 	x += rhs.x;
 	y += rhs.y;
@@ -142,7 +145,7 @@ Vector3< Type >& Vector3< Type >::operator+=(const Vector3& rhs)
 
 // Subtracts another vector from this in-place.
 template < typename Type >
-Vector3< Type >& Vector3< Type >::operator-=(const Vector3& rhs)
+Vector3< Type >& Vector3< Type >::operator-=(const Vector3 & rhs)
 {
 	x -= rhs.x;
 	y -= rhs.y;
@@ -153,7 +156,7 @@ Vector3< Type >& Vector3< Type >::operator-=(const Vector3& rhs)
 
 // Scales this vector in-place.
 template < typename Type >
-Vector3< Type >& Vector3< Type >::operator*=(const Type& rhs)
+Vector3< Type >& Vector3< Type >::operator*=(const Type & rhs)
 {
 	x *= rhs;
 	y *= rhs;
@@ -164,7 +167,7 @@ Vector3< Type >& Vector3< Type >::operator*=(const Type& rhs)
 
 // Scales this vector in-place by the inverse of a value.
 template < typename Type >
-Vector3< Type >& Vector3< Type >::operator/=(const Type& rhs)
+Vector3< Type >& Vector3< Type >::operator/=(const Type & rhs)
 {
 	x /= rhs;
 	y /= rhs;
@@ -175,28 +178,31 @@ Vector3< Type >& Vector3< Type >::operator/=(const Type& rhs)
 
 // Equality operator.
 template < typename Type >
-bool Vector3< Type >::operator==(const Vector3& rhs) const
+bool Vector3< Type >::operator==(const Vector3 & rhs) const
 {
 	return (x == rhs.x && y == rhs.y && z == rhs.z);
 }
 
 // Inequality operator.
 template < typename Type >
-bool Vector3< Type >::operator!=(const Vector3& rhs) const
+bool Vector3< Type >::operator!=(const Vector3 & rhs) const
 {
 	return (x != rhs.x || y != rhs.y || z != rhs.z);
 }
 
 // Constant auto-cast operator.
 template < typename Type >
-Vector3< Type >::operator const Type*() const
+Vector3< Type >::operator const Type* () const
 {
 	return &x;
 }
 
 // Auto-cast operator.
 template < typename Type >
-Vector3< Type >::operator Type*()
+Vector3< Type >::operator Type* ()
 {
 	return &x;
 }
+
+}
+}

+ 2 - 2
Include/Rocket/Core/Vector4.h

@@ -135,9 +135,9 @@ class Vector4
 		Type w;
 };
 
-#include "Vector4.inl"
-
 }
 }
 
+#include "Vector4.inl"
+
 #endif

+ 21 - 15
Include/Rocket/Core/Vector4.inl

@@ -25,6 +25,9 @@
  *
  */
 
+namespace Rocket {
+namespace Core {
+
 // Default constructor.
 template < typename Type >
 Vector4< Type >::Vector4()
@@ -34,14 +37,14 @@ Vector4< Type >::Vector4()
 // Initialising constructor.
 template < typename Type >
 Vector4< Type >::Vector4(Type _x, Type _y, Type _z, Type _w)
-	: x (_x), y (_y), z (_z), w (_w)
+	: x(_x), y(_y), z(_z), w(_w)
 {
 }
 
 // Implicit conversion from a 3D Vector.
 template < typename Type >
-Vector4< Type >::Vector4(Vector3< Type > const &v, Type w)
-	: x (v.x), y (v.y), z (v.z), w (w)
+Vector4< Type >::Vector4(Vector3< Type > const& v, Type w)
+	: x(v.x), y(v.y), z(v.z), w(w)
 {
 }
 
@@ -49,7 +52,7 @@ Vector4< Type >::Vector4(Vector3< Type > const &v, Type w)
 template < typename Type >
 float Vector4< Type >::Magnitude() const
 {
-	float squared_magnitude = (float) SquaredMagnitude();
+	float squared_magnitude = (float)SquaredMagnitude();
 	if (Math::IsZero(squared_magnitude))
 		return 0;
 
@@ -90,14 +93,14 @@ Vector4< Type > Vector4< Type >::operator-() const
 
 // Returns the sum of this vector and another.
 template < typename Type >
-Vector4< Type > Vector4< Type >::operator+(const Vector4< Type >& rhs) const
+Vector4< Type > Vector4< Type >::operator+(const Vector4< Type > & rhs) const
 {
 	return Vector4< Type >(x + rhs.x, y + rhs.y, z + rhs.z, w + rhs.w);
 }
 
 // Returns the result of subtracting another vector from this vector.
 template < typename Type >
-Vector4< Type > Vector4< Type >::operator-(const Vector4< Type >& rhs) const
+Vector4< Type > Vector4< Type >::operator-(const Vector4< Type > & rhs) const
 {
 	return Vector4(x - rhs.x, y - rhs.y, z - rhs.z, w - rhs.w);
 }
@@ -118,7 +121,7 @@ Vector4< Type > Vector4< Type >::operator/(Type rhs) const
 
 // Adds another vector to this in-place.
 template < typename Type >
-Vector4< Type >& Vector4< Type >::operator+=(const Vector4& rhs)
+Vector4< Type >& Vector4< Type >::operator+=(const Vector4 & rhs)
 {
 	x += rhs.x;
 	y += rhs.y;
@@ -130,7 +133,7 @@ Vector4< Type >& Vector4< Type >::operator+=(const Vector4& rhs)
 
 // Subtracts another vector from this in-place.
 template < typename Type >
-Vector4< Type >& Vector4< Type >::operator-=(const Vector4& rhs)
+Vector4< Type >& Vector4< Type >::operator-=(const Vector4 & rhs)
 {
 	x -= rhs.x;
 	y -= rhs.y;
@@ -142,7 +145,7 @@ Vector4< Type >& Vector4< Type >::operator-=(const Vector4& rhs)
 
 // Scales this vector in-place.
 template < typename Type >
-Vector4< Type >& Vector4< Type >::operator*=(const Type& rhs)
+Vector4< Type >& Vector4< Type >::operator*=(const Type & rhs)
 {
 	x *= rhs;
 	y *= rhs;
@@ -154,7 +157,7 @@ Vector4< Type >& Vector4< Type >::operator*=(const Type& rhs)
 
 // Scales this vector in-place by the inverse of a value.
 template < typename Type >
-Vector4< Type >& Vector4< Type >::operator/=(const Type& rhs)
+Vector4< Type >& Vector4< Type >::operator/=(const Type & rhs)
 {
 	x /= rhs;
 	y /= rhs;
@@ -166,28 +169,28 @@ Vector4< Type >& Vector4< Type >::operator/=(const Type& rhs)
 
 // Equality operator.
 template < typename Type >
-bool Vector4< Type >::operator==(const Vector4& rhs) const
+bool Vector4< Type >::operator==(const Vector4 & rhs) const
 {
 	return (x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w);
 }
 
 // Inequality operator.
 template < typename Type >
-bool Vector4< Type >::operator!=(const Vector4& rhs) const
+bool Vector4< Type >::operator!=(const Vector4 & rhs) const
 {
 	return (x != rhs.x || y != rhs.y || z != rhs.z || w != rhs.w);
 }
 
 // Auto-cast operator.
 template < typename Type >
-Vector4< Type >::operator const Type*() const
+Vector4< Type >::operator const Type* () const
 {
 	return &x;
 }
 
 // Constant auto-cast operator.
 template < typename Type >
-Vector4< Type >::operator Type*()
+Vector4< Type >::operator Type* ()
 {
 	return &x;
 }
@@ -197,5 +200,8 @@ Vector4< Type >::operator Type*()
 template < typename Type >
 Vector4< Type >::operator Vector3< Type >() const
 {
-	return Vector3< Type > (x/w, y/w, z/w);
+	return Vector3< Type >(x / w, y / w, z / w);
+}
+
+}
 }