From 47c0a7456c1890468cf1db2e8d5dd998a0987329 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 11 Dec 2012 10:58:23 +0100 Subject: [PATCH] Adapted to Corrade changes. Removing of another <*stream> #include leads to more compilation time saving, now from ~5:12 to ~4:55. Another compilation time improvements will now be possible only by using Clang's modules, I don't know where to optimize further (except for getting rid of in tests). --- src/Math/RectangularMatrix.h | 18 +++++++++++------- src/Math/Test/Matrix3Test.cpp | 1 + src/Math/Test/Matrix4Test.cpp | 1 + src/Math/Test/MatrixTest.cpp | 1 + src/Math/Test/Point2DTest.cpp | 1 + src/Math/Test/Point3DTest.cpp | 1 + src/Math/Test/RectangularMatrixTest.cpp | 1 + src/Math/Test/Vector2Test.cpp | 1 + src/Math/Test/Vector3Test.cpp | 1 + src/Math/Test/Vector4Test.cpp | 1 + src/Math/Test/VectorTest.cpp | 1 + src/SceneGraph/Test/AnimableTest.cpp | 2 ++ src/Test/ColorTest.cpp | 1 + src/Test/MeshTest.cpp | 1 + src/Test/TypeTraitsTest.cpp | 1 + 15 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/Math/RectangularMatrix.h b/src/Math/RectangularMatrix.h index 42e43559c..014eebbf3 100644 --- a/src/Math/RectangularMatrix.h +++ b/src/Math/RectangularMatrix.h @@ -534,15 +534,19 @@ template struct ConfigurationValue< /** @brief Reads elements separated with whitespace */ static Magnum::Math::RectangularMatrix fromString(const std::string& stringValue, ConfigurationValueFlags flags) { Magnum::Math::RectangularMatrix result; - std::istringstream in(stringValue); - for(std::size_t row = 0; row != rows; ++row) { - for(std::size_t col = 0; col != cols; ++col) { - std::string num; - in >> num; - result(col, row) = ConfigurationValue::fromString(num, flags); + std::size_t oldpos = 0, pos = std::string::npos, i = 0; + do { + pos = stringValue.find(' ', oldpos); + std::string part = stringValue.substr(oldpos, pos-oldpos); + + if(!part.empty()) { + result(i%cols, i/cols) = ConfigurationValue::fromString(part, flags); + ++i; } - } + + oldpos = pos+1; + } while(pos != std::string::npos); return result; } diff --git a/src/Math/Test/Matrix3Test.cpp b/src/Math/Test/Matrix3Test.cpp index 107d61494..0e7adb44b 100644 --- a/src/Math/Test/Matrix3Test.cpp +++ b/src/Math/Test/Matrix3Test.cpp @@ -15,6 +15,7 @@ #include "Matrix3Test.h" +#include #include #include "Constants.h" diff --git a/src/Math/Test/Matrix4Test.cpp b/src/Math/Test/Matrix4Test.cpp index 5b2ed7a1b..7761bd8b7 100644 --- a/src/Math/Test/Matrix4Test.cpp +++ b/src/Math/Test/Matrix4Test.cpp @@ -15,6 +15,7 @@ #include "Matrix4Test.h" +#include #include #include "Constants.h" diff --git a/src/Math/Test/MatrixTest.cpp b/src/Math/Test/MatrixTest.cpp index 924ac0afe..28432709d 100644 --- a/src/Math/Test/MatrixTest.cpp +++ b/src/Math/Test/MatrixTest.cpp @@ -15,6 +15,7 @@ #include "MatrixTest.h" +#include #include #include "Matrix.h" diff --git a/src/Math/Test/Point2DTest.cpp b/src/Math/Test/Point2DTest.cpp index 0ad2c4dae..70093d026 100644 --- a/src/Math/Test/Point2DTest.cpp +++ b/src/Math/Test/Point2DTest.cpp @@ -15,6 +15,7 @@ #include "Point2DTest.h" +#include #include #include "Point2D.h" diff --git a/src/Math/Test/Point3DTest.cpp b/src/Math/Test/Point3DTest.cpp index 9293b7881..dc77ab420 100644 --- a/src/Math/Test/Point3DTest.cpp +++ b/src/Math/Test/Point3DTest.cpp @@ -15,6 +15,7 @@ #include "Point3DTest.h" +#include #include #include "Point3D.h" diff --git a/src/Math/Test/RectangularMatrixTest.cpp b/src/Math/Test/RectangularMatrixTest.cpp index adb989de0..a2fbd0af8 100644 --- a/src/Math/Test/RectangularMatrixTest.cpp +++ b/src/Math/Test/RectangularMatrixTest.cpp @@ -15,6 +15,7 @@ #include "RectangularMatrixTest.h" +#include #include #include "RectangularMatrix.h" diff --git a/src/Math/Test/Vector2Test.cpp b/src/Math/Test/Vector2Test.cpp index 316094de0..7b427650a 100644 --- a/src/Math/Test/Vector2Test.cpp +++ b/src/Math/Test/Vector2Test.cpp @@ -15,6 +15,7 @@ #include "Vector2Test.h" +#include #include #include "Vector2.h" diff --git a/src/Math/Test/Vector3Test.cpp b/src/Math/Test/Vector3Test.cpp index 51b31437f..6a97a5f87 100644 --- a/src/Math/Test/Vector3Test.cpp +++ b/src/Math/Test/Vector3Test.cpp @@ -15,6 +15,7 @@ #include "Vector3Test.h" +#include #include #include "Vector3.h" diff --git a/src/Math/Test/Vector4Test.cpp b/src/Math/Test/Vector4Test.cpp index e8f40f4ae..9d4b1e959 100644 --- a/src/Math/Test/Vector4Test.cpp +++ b/src/Math/Test/Vector4Test.cpp @@ -15,6 +15,7 @@ #include "Vector4Test.h" +#include #include #include "Vector4.h" diff --git a/src/Math/Test/VectorTest.cpp b/src/Math/Test/VectorTest.cpp index 99486230f..74f2960bd 100644 --- a/src/Math/Test/VectorTest.cpp +++ b/src/Math/Test/VectorTest.cpp @@ -15,6 +15,7 @@ #include "VectorTest.h" +#include #include #include "Constants.h" diff --git a/src/SceneGraph/Test/AnimableTest.cpp b/src/SceneGraph/Test/AnimableTest.cpp index ad5c5ed5d..9b6505589 100644 --- a/src/SceneGraph/Test/AnimableTest.cpp +++ b/src/SceneGraph/Test/AnimableTest.cpp @@ -15,6 +15,8 @@ #include "AnimableTest.h" +#include + #include "SceneGraph/Animable.h" #include "SceneGraph/AnimableGroup.h" #include "SceneGraph/MatrixTransformation3D.h" diff --git a/src/Test/ColorTest.cpp b/src/Test/ColorTest.cpp index 403c38668..6d77f5555 100644 --- a/src/Test/ColorTest.cpp +++ b/src/Test/ColorTest.cpp @@ -15,6 +15,7 @@ #include "ColorTest.h" +#include #include #include "Color.h" diff --git a/src/Test/MeshTest.cpp b/src/Test/MeshTest.cpp index 0e1a9d949..36b3248d8 100644 --- a/src/Test/MeshTest.cpp +++ b/src/Test/MeshTest.cpp @@ -15,6 +15,7 @@ #include "MeshTest.h" +#include #include #include "Mesh.h" diff --git a/src/Test/TypeTraitsTest.cpp b/src/Test/TypeTraitsTest.cpp index 521e16019..6da0f265f 100644 --- a/src/Test/TypeTraitsTest.cpp +++ b/src/Test/TypeTraitsTest.cpp @@ -15,6 +15,7 @@ #include "TypeTraitsTest.h" +#include #include #include "TypeTraits.h"