Browse Source

Moving files to better dirs

Panagiotis Christopoulos Charitos 15 years ago
parent
commit
375e7dcd69

File diff suppressed because it is too large
+ 352 - 366
build/debug/Makefile


+ 1 - 1
build/debug/gen.cfg.py

@@ -1,4 +1,4 @@
-sourcePaths = ["../../src/Scripting/", "../../src/Math/", "../../src/Util/Tokenizer/", "../../src/Misc/", "../../src/", "../../src/Renderer/", "../../src/Scene/", "../../src/Ui/", "../../src/Resources/", "../../src/Util/", "../../src/Scene/Controllers/", "../../src/Physics/", "../../src/Renderer/BufferObjects/", "../../src/Resources/Helpers/", "../../src/Resources/Core/", "../../src/Core/", "../../src/Scripting/Math", "../../src/Scripting/Util", "../../src/Scripting/Core", "../../src/Scripting/Scene", "../../src/Scripting/Renderer"]
+sourcePaths = ["../../src/Scripting/", "../../src/Math/", "../../src/Util/Tokenizer/", "../../src/Misc/", "../../src/", "../../src/Renderer/", "../../src/Scene/", "../../src/Ui/", "../../src/Resources/", "../../src/Util/", "../../src/Scene/Controllers/", "../../src/Physics/", "../../src/Renderer/BufferObjects/", "../../src/Resources/Helpers/", "../../src/Resources/Core/", "../../src/Core/", "../../src/Scripting/Math", "../../src/Scripting/Util", "../../src/Scripting/Core", "../../src/Scripting/Scene", "../../src/Scripting/Renderer", "../../src/Input"]
 
 includePaths = []
 includePaths.append("./")

+ 0 - 0
src/Util/Object.cpp → src/Core/Object.cpp


+ 0 - 0
src/Util/Object.h → src/Core/Object.h


+ 0 - 0
src/Util/Input.cpp → src/Input/Input.cpp


+ 0 - 0
src/Util/Input.h → src/Input/Input.h


+ 2 - 0
src/Main.cpp

@@ -364,6 +364,8 @@ void mainLoop()
 	INFO("Exiting main loop (" << App::getTicks()-ticks << ")");
 }
 
+#include "Exception.h"
+
 
 //======================================================================================================================
 // main                                                                                                                =

+ 8 - 9
src/Util/Arr.h

@@ -2,14 +2,12 @@
 #define ARR_H
 
 #include <boost/array.hpp>
-#include "Common.h"
+#include "Exception.h"
 
 
-/**
- * This is a wrapper of array that adds new functionality
- */
+/// This is a wrapper of array that adds new functionality
 template<typename Type, size_t nn>
-class Arr: public array<Type, nn>
+class Arr: public boost::array<Type, nn>
 {
 	public:
 		Type& operator[](size_t n);
@@ -23,8 +21,8 @@ class Arr: public array<Type, nn>
 template<typename Type, size_t nn>
 Type& Arr<Type, nn>::operator[](size_t n)
 {
-	DEBUG_ERR(n >= nn);
-	return array<Type, nn>::operator [](n);
+	RASSERT_THROW_EXCEPTION(n >= nn);
+	return boost::array<Type, nn>::operator [](n);
 }
 
 
@@ -34,8 +32,9 @@ Type& Arr<Type, nn>::operator[](size_t n)
 template<typename Type, size_t nn>
 const Type& Arr<Type, nn>::operator[](size_t n) const
 {
-	DEBUG_ERR(n >= nn);
-	return array<Type, nn>::operator [](n);
+	RASSERT_THROW_EXCEPTION(n >= nn);
+	return boost::array<Type, nn>::operator [](n);
 }
 
+
 #endif

+ 1 - 1
src/Util/BinaryStream.cpp

@@ -68,7 +68,7 @@ string BinaryStream::readString()
 	}
 	catch(Exception& e)
 	{
-		THROW_EXCEPTION("Failed to read size")
+		THROW_EXCEPTION("Failed to read size");
 	}
 
 	const uint buffSize = 1024;

+ 0 - 1
src/Util/CharPtrHashMap.h

@@ -3,7 +3,6 @@
 
 #include <boost/unordered_map.hpp>
 #include <cstring>
-#include "Common.h"
 
 
 /// The hash function

+ 10 - 1
src/Core/Exception.h → src/Util/Exception.h

@@ -27,7 +27,16 @@ inline Exception::Exception(const char* err_, const char* file, int line, const
 }
 
 
-#define THROW_EXCEPTION(x) throw Exception((x), __FILE__, __LINE__, __func__);
+#define THROW_EXCEPTION(x) throw Exception((x), __FILE__, __LINE__, __func__)
+
+#if DEBUG_ENABLED == 1
+	#define RASSERT_THROW_EXCEPTION(x) \
+		if(x) \
+			THROW_EXCEPTION("Reverse assertion failed: " #x)
+#else
+	#define RASSERT_THROW_EXCEPTION(x)
+#endif
+
 
 
 #endif

+ 0 - 0
src/Core/StdTypes.h → src/Util/StdTypes.h


+ 0 - 82
src/Util/Util.cpp

@@ -81,86 +81,4 @@ float randFloat(float max)
 }
 
 
-//======================================================================================================================
-// readStringFromBinaryStream                                                                                          =
-//======================================================================================================================
-bool readStringFromBinaryStream(istream& s, string& out, ByteOrder byteOrder)
-{
-	uchar c[4];
-	s.read((char*)c, sizeof(c));
-	if(s.fail())
-	{
-		ERROR("Failed to read string size");
-		return false;
-	}
-	uint size;
-	if(byteOrder == BO_LITTLE_ENDIAN)
-	{
-		size = (c[0] | (c[1]<<8) | (c[2]<<16) | (c[3]<<24));
-	}
-	else
-	{
-		size = ((c[0]<<24) | (c[1]<<16) | (c[2]<< 8) | c[3]);
-	}
-
-	const uint buffSize = 1024;
-	if((size + 1) > buffSize)
-	{
-		ERROR("String bugger than " << (buffSize + 1));
-		return false;
-	}
-	char buff[buffSize];
-	s.read(buff, size);
-	if(s.fail())
-	{
-		ERROR("Failed to read " << size << " bytes");
-		return false;
-	}
-	buff[size] = '\0';
-
-	out =  buff;
-	return true;
-}
-
-
-//======================================================================================================================
-// readUintFromBinaryStream                                                                                            =
-//======================================================================================================================
-bool readUintFromBinaryStream(istream& s, uint& out, ByteOrder byteOrder)
-{
-	uchar c[4];
-	s.read((char*)c, sizeof(c));
-	if(s.fail())
-	{
-		ERROR("Failed to read uint");
-		return false;
-	}
-
-	if(byteOrder == BO_LITTLE_ENDIAN)
-	{
-		out = (c[0] | (c[1]<<8) | (c[2]<<16) | (c[3]<<24));
-	}
-	else
-	{
-		out = ((c[0]<<24) | (c[1]<<16) | (c[2]<< 8) | c[3]);
-	}
-	return true;
-}
-
-
-//======================================================================================================================
-// readFloatFromBinaryStream                                                                                           =
-//======================================================================================================================
-bool readFloatFromBinaryStream(istream& s, float& out)
-{
-	s.read((char*)&out, sizeof(float));
-	if(s.fail())
-	{
-		ERROR("Failed to read float");
-		return false;
-	}
-	return true;
-}
-
-
 } // end namesapce

+ 0 - 16
src/Util/Util.h

@@ -16,22 +16,6 @@ extern float randFloat(float max);
 extern string      readFile(const char* filename); ///< Open a text file and return its contents into a string
 extern Vec<string> getFileLines(const char* filename); ///< Open a text file and return its lines into a string vector
 
-
-/// @name Binary file reading
-/// @{
-
-/// Byte order for reading binary files
-enum ByteOrder
-{
-	BO_LITTLE_ENDIAN, ///< The default
-	BO_BIG_ENDIAN
-};
-
-extern bool readStringFromBinaryStream(istream& s, string& out, ByteOrder byteOrder = BO_LITTLE_ENDIAN);
-extern bool readUintFromBinaryStream(istream& s, uint& out, ByteOrder byteOrder = BO_LITTLE_ENDIAN);
-extern bool readFloatFromBinaryStream(istream& s, float& out);
-/// @}
-
 }
 
 #endif

+ 12 - 13
src/Util/Vec.h

@@ -2,14 +2,12 @@
 #define VEC_H
 
 #include <vector>
-#include "Common.h"
+#include "Exception.h"
 
 
-/**
- * This is a wrapper of std::vector that adds new functionality
- */
+/// This is a wrapper of std::std::vector that adds new functionality
 template<typename Type>
-class Vec: public vector<Type>
+class Vec: public std::vector<Type>
 {
 	public:
 		Vec();
@@ -26,7 +24,7 @@ class Vec: public vector<Type>
 //======================================================================================================================
 template<typename Type>
 Vec<Type>::Vec():
-	vector<Type>()
+	std::vector<Type>()
 {}
 
 
@@ -35,7 +33,7 @@ Vec<Type>::Vec():
 //======================================================================================================================
 template<typename Type>
 Vec<Type>::Vec(size_t size):
-	vector<Type>(size)
+	std::vector<Type>(size)
 {}
 
 
@@ -44,7 +42,7 @@ Vec<Type>::Vec(size_t size):
 //======================================================================================================================
 template<typename Type>
 Vec<Type>::Vec(size_t size, Type val):
-	vector<Type>(size,val)
+	std::vector<Type>(size,val)
 {}
 
 
@@ -54,8 +52,8 @@ Vec<Type>::Vec(size_t size, Type val):
 template<typename Type>
 Type& Vec<Type>::operator[](size_t n)
 {
-	DEBUG_ERR(n >= vector<Type>::size());
-	return vector<Type>::operator [](n);
+	RASSERT_THROW_EXCEPTION(n >= std::vector<Type>::size());
+	return std::vector<Type>::operator [](n);
 }
 
 
@@ -65,8 +63,8 @@ Type& Vec<Type>::operator[](size_t n)
 template<typename Type>
 const Type& Vec<Type>::operator[](size_t n) const
 {
-	DEBUG_ERR(n >= vector<Type>::size());
-	return vector<Type>::operator [](n);
+	RASSERT_THROW_EXCEPTION(n >= std::vector<Type>::size());
+	return std::vector<Type>::operator [](n);
 }
 
 
@@ -76,7 +74,8 @@ const Type& Vec<Type>::operator[](size_t n) const
 template<typename Type>
 size_t Vec<Type>::getSizeInBytes() const
 {
-	return vector<Type>::size() * sizeof(Type);
+	return std::vector<Type>::size() * sizeof(Type);
 }
 
+
 #endif

Some files were not shown because too many files changed in this diff