瀏覽代碼

Going back to c++03 until GCC and clang implement a few c++11 features
(constexpr for clang, template aliases for GCC and other)

Panagiotis Christopoulos Charitos 14 年之前
父節點
當前提交
df10c13dc3
共有 6 個文件被更改,包括 36 次插入10 次删除
  1. 1 1
      CMakeLists.txt
  2. 28 8
      anki/collision/CollisionShape.h
  3. 1 0
      anki/util/Scanner.cpp
  4. 2 1
      anki/util/StringList.cpp
  5. 2 0
      anki/util/Variant.h
  6. 2 0
      anki/util/Visitor.h

+ 1 - 1
CMakeLists.txt

@@ -120,7 +120,7 @@ ANKI_ADD_LIB(${BOOST_INCLUDE_DIR} ${BOOST_LIBRARY_DIR} ${BOOST_INCLUDE_DIR}/boos
 #
 # Defines & flags
 #
-ADD_DEFINITIONS("-DANKI_MATH_INTEL_SIMD -DGLEW_MX -pedantic-errors -pedantic -ansi -Wall -Winline -W -Wwrite-strings -Wno-unused -Wfatal-errors -Werror -Wno-long-long -msse4 -std=c++0x")
+ADD_DEFINITIONS("-DANKI_MATH_INTEL_SIMD -DGLEW_MX -pedantic-errors -pedantic -ansi -Wall -Winline -W -Wwrite-strings -Wno-unused -Wfatal-errors -Werror -Wno-long-long -msse4")
 
 # Add a few compiler specific stuff 
 IF(${CMAKE_CXX_COMPILER} MATCHES ".*clang\\+\\+$")	

+ 28 - 8
anki/collision/CollisionShape.h

@@ -3,7 +3,6 @@
 
 #include "anki/collision/Forward.h"
 #include "anki/math/Forward.h"
-#include "anki/util/Visitor.h"
 
 
 namespace anki {
@@ -13,15 +12,9 @@ namespace anki {
 /// @{
 
 /// Abstract class for collision shapes
-class CollisionShape: public Visitable<LineSegment, Obb,
-	PerspectiveCameraShape, Plane, Ray, Sphere, Aabb>
+class CollisionShape
 {
 public:
-	typedef Visitable<LineSegment, Obb,
-		PerspectiveCameraShape, Plane, Ray, Sphere, Aabb> BaseType;
-	typedef BaseType::MutableVisitorType MutableVisitor;
-	typedef BaseType::ConstVisitorType ConstVisitor;
-
 	/// Collision shape type
 	enum CollisionShapeType
 	{
@@ -34,6 +27,33 @@ public:
 		CST_PERSPECTIVE_CAMERA_FRUSTRUM
 	};
 
+	/// Generic mutable visitor
+	class MutableVisitor
+	{
+	public:
+		virtual void visit(LineSegment&) = 0;
+		virtual void visit(Obb&) = 0;
+		virtual void visit(PerspectiveCameraShape&) = 0;
+		virtual void visit(Plane&) = 0;
+		virtual void visit(Ray&) = 0;
+		virtual void visit(Sphere&) = 0;
+		virtual void visit(Aabb&) = 0;
+	};
+
+	/// Generic const visitor
+	class ConstVisitor
+	{
+	public:
+		virtual void visit(const LineSegment&) = 0;
+		virtual void visit(const Obb&) = 0;
+		virtual void visit(const PerspectiveCameraShape&) = 0;
+		virtual void visit(const Plane&) = 0;
+		virtual void visit(const Ray&) = 0;
+		virtual void visit(const Sphere&) = 0;
+		virtual void visit(const Aabb&) = 0;
+	};
+
+
 	CollisionShape(CollisionShapeType cid_)
 		: cid(cid_)
 	{}

+ 1 - 0
anki/util/Scanner.cpp

@@ -5,6 +5,7 @@
 #include <iomanip>
 #include <cmath>
 #include <sstream>
+#include <cassert>
 
 
 namespace anki { namespace scanner {

+ 2 - 1
anki/util/StringList.cpp

@@ -1,5 +1,6 @@
 #include "anki/util/StringList.h"
 #include <boost/tokenizer.hpp>
+#include <boost/foreach.hpp>
 
 
 namespace anki {
@@ -34,7 +35,7 @@ StringList StringList::splitString(const StringType& s, const char* seperators)
 	StringList out;
 	Tok tok(s, sep);
 
-	for(auto s: tok)
+	BOOST_FOREACH(const std::string& s, tok)
 	{
 		out.push_back(s);
 	}

+ 2 - 0
anki/util/Variant.h

@@ -6,6 +6,8 @@
 #include <iosfwd>
 #include <memory>
 
+#error "The file is experimental. Dont include"
+
 
 namespace anki {
 

+ 2 - 0
anki/util/Visitor.h

@@ -4,6 +4,8 @@
 #ifndef ANKI_UTIL_VISITOR_H
 #define ANKI_UTIL_VISITOR_H
 
+#error "The file is experimental. Dont include"
+
 
 namespace anki {