Browse Source

Fix possible compile error (closes #12)

Michael Ragazzon 6 năm trước cách đây
mục cha
commit
87e89c630b

+ 4 - 4
Include/Rocket/Core/Transform.h

@@ -29,12 +29,11 @@
 #define ROCKETCORETRANSFORM_H
 
 #include "Header.h"
-#include "ReferenceCountable.h"
+#include "TransformPrimitive.h"
 
 namespace Rocket {
 namespace Core {
 
-namespace Transforms { struct Primitive; }
 class Property;
 
 /**
@@ -77,12 +76,13 @@ public:
 	Primitives& GetPrimitives() noexcept { return primitives; }
 	const Primitives& GetPrimitives() const noexcept { return primitives; }
 
-	String ToString() const;
-
 private:
 	Primitives primitives;
 };
 
+
+String ToString(const Transform& transform);
+
 }
 }
 

+ 4 - 1
Include/Rocket/Core/TypeConverter.inl

@@ -353,13 +353,16 @@ public:
 	}
 };
 
+
+String ToString(const Transform& transform);
+
 template<>
 class TypeConverter< TransformRef, String >
 {
 public:
 	static bool Convert(const TransformRef& src, String& dest)
 	{
-		if (src) dest = src->ToString();
+		if (src) dest = ToString(*src);
 		else dest = "none";
 		return true;
 	}

+ 1 - 1
Include/Rocket/Core/Types.h

@@ -72,7 +72,6 @@ typedef unsigned __int64 uint64_t;
 #include "Vector4.h"
 #include "Matrix4.h"
 #include "String.h"
-#include "Transform.h"
 
 namespace Rocket {
 namespace Core {
@@ -95,6 +94,7 @@ class Element;
 class Dictionary;
 class ElementAnimation;
 class Property;
+class Transform;
 
 // Types for external interfaces.
 typedef uintptr_t FileHandle;

+ 2 - 1
Source/Core/Transform.cpp

@@ -72,9 +72,10 @@ const Transforms::Primitive & Transform::GetPrimitive(int i) const noexcept
 	return primitives[i];
 }
 
-String Transform::ToString() const
+String ToString(const Transform& transform)
 {
 	String result;
+	auto& primitives = transform.GetPrimitives();
 	for (size_t i = 0; i < primitives.size(); i++)
 	{
 		result += primitives[i].ToString();