From eb3d76f291461cfc1bea49650a71f97e38623408 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 24 Sep 2010 14:38:01 +0000 Subject: [PATCH] From Mikhail Izmestev, "This patch fixes operator >> used with std::istream without std::ios::skipws flag. This allow using boost::lexical_cast with osg vectors types, because boost's lexical_cast disable std::ios::skipws flag of std::istream before using operator >>. " --- CMakeLists.txt | 4 ++-- include/osg/Version | 4 ++-- include/osg/io_utils | 51 +++++++++++++++++++++++++++++++------------- 3 files changed, 40 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e11005470..06ceede46 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,8 +30,8 @@ PROJECT(OpenSceneGraph) SET(OPENSCENEGRAPH_MAJOR_VERSION 2) SET(OPENSCENEGRAPH_MINOR_VERSION 9) -SET(OPENSCENEGRAPH_PATCH_VERSION 9) -SET(OPENSCENEGRAPH_SOVERSION 66) +SET(OPENSCENEGRAPH_PATCH_VERSION 10) +SET(OPENSCENEGRAPH_SOVERSION 67) # set to 0 when not a release candidate, non zero means that any generated # svn tags will be treated as release candidates of given number diff --git a/include/osg/Version b/include/osg/Version index c85dba9bd..cd827ab53 100644 --- a/include/osg/Version +++ b/include/osg/Version @@ -20,8 +20,8 @@ extern "C" { #define OPENSCENEGRAPH_MAJOR_VERSION 2 #define OPENSCENEGRAPH_MINOR_VERSION 9 -#define OPENSCENEGRAPH_PATCH_VERSION 9 -#define OPENSCENEGRAPH_SOVERSION 66 +#define OPENSCENEGRAPH_PATCH_VERSION 10 +#define OPENSCENEGRAPH_SOVERSION 67 /* Convenience macro that can be used to decide whether a feature is present or not i.e. * #if OSG_MIN_VERSION_REQUIRED(2,9,5) diff --git a/include/osg/io_utils b/include/osg/io_utils index a6d18d903..be28e79ed 100644 --- a/include/osg/io_utils +++ b/include/osg/io_utils @@ -42,7 +42,7 @@ inline std::ostream& operator << (std::ostream& output, const Vec2f& vec) inline std::istream& operator >> (std::istream& input, Vec2f& vec) { - input >> vec._v[0] >> vec._v[1]; + input >> vec._v[0] >> std::ws >> vec._v[1]; return input; } @@ -56,7 +56,7 @@ inline std::ostream& operator << (std::ostream& output, const Vec2d& vec) inline std::istream& operator >> (std::istream& input, Vec2d& vec) { - input >> vec._v[0] >> vec._v[1]; + input >> vec._v[0] >> std::ws >> vec._v[1]; return input; } @@ -72,7 +72,7 @@ inline std::ostream& operator << (std::ostream& output, const Vec3f& vec) inline std::istream& operator >> (std::istream& input, Vec3f& vec) { - input >> vec._v[0] >> vec._v[1] >> vec._v[2]; + input >> vec._v[0] >> std::ws >> vec._v[1] >> std::ws >> vec._v[2]; return input; } @@ -89,7 +89,7 @@ inline std::ostream& operator << (std::ostream& output, const Vec3d& vec) inline std::istream& operator >> (std::istream& input, Vec3d& vec) { - input >> vec._v[0] >> vec._v[1] >> vec._v[2]; + input >> vec._v[0] >> std::ws >> vec._v[1] >> std::ws >> vec._v[2]; return input; } @@ -107,7 +107,10 @@ inline std::ostream& operator << (std::ostream& output, const Vec4f& vec) inline std::istream& operator >> (std::istream& input, Vec4f& vec) { - input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3]; + input >> vec._v[0] >> std::ws + >> vec._v[1] >> std::ws + >> vec._v[2] >> std::ws + >> vec._v[3]; return input; } @@ -125,7 +128,10 @@ inline std::ostream& operator << (std::ostream& output, const Vec4d& vec) } inline std::istream& operator >> (std::istream& input, Vec4d& vec) { - input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3]; + input >> vec._v[0] >> std::ws + >> vec._v[1] >> std::ws + >> vec._v[2] >> std::ws + >> vec._v[3]; return input; } @@ -141,7 +147,7 @@ inline std::ostream& operator << (std::ostream& output, const Vec2b& vec) inline std::istream& operator >> (std::istream& input, Vec2b& vec) { - input >> vec._v[0] >> vec._v[1]; + input >> vec._v[0] >> std::ws >> vec._v[1]; return input; } @@ -157,7 +163,7 @@ inline std::ostream& operator << (std::ostream& output, const Vec3b& vec) inline std::istream& operator >> (std::istream& input, Vec3b& vec) { - input >> vec._v[0] >> vec._v[1] >> vec._v[2]; + input >> vec._v[0] >> std::ws >> vec._v[1] >> std::ws >> vec._v[2]; return input; } @@ -174,7 +180,10 @@ inline std::ostream& operator << (std::ostream& output, const Vec4b& vec) inline std::istream& operator >> (std::istream& input, Vec4b& vec) { - input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3]; + input >> vec._v[0] >> std::ws + >> vec._v[1] >> std::ws + >> vec._v[2] >> std::ws + >> vec._v[3]; return input; } @@ -190,7 +199,7 @@ inline std::ostream& operator << (std::ostream& output, const Vec2s& vec) inline std::istream& operator >> (std::istream& input, Vec2s& vec) { - input >> vec._v[0] >> vec._v[1]; + input >> vec._v[0] >> std::ws >> vec._v[1]; return input; } @@ -206,7 +215,7 @@ inline std::ostream& operator << (std::ostream& output, const Vec3s& vec) inline std::istream& operator >> (std::istream& input, Vec3s& vec) { - input >> vec._v[0] >> vec._v[1] >> vec._v[2]; + input >> vec._v[0] >> std::ws >> vec._v[1] >> std::ws >> vec._v[2]; return input; } @@ -223,7 +232,10 @@ inline std::ostream& operator << (std::ostream& output, const Vec4s& vec) inline std::istream& operator >> (std::istream& input, Vec4s& vec) { - input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3]; + input >> vec._v[0] >> std::ws + >> vec._v[1] >> std::ws + >> vec._v[2] >> std::ws + >> vec._v[3]; return input; } @@ -272,7 +284,10 @@ inline std::ostream& operator << (std::ostream& output, const Vec4ub& vec) inline std::istream& operator >> (std::istream& input, Vec4ub& vec) { - input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3]; + input >> vec._v[0] >> std::ws + >> vec._v[1] >> std::ws + >> vec._v[2] >> std::ws + >> vec._v[3]; return input; } @@ -290,7 +305,10 @@ inline std::ostream& operator << (std::ostream& output, const Quat& vec) inline std::istream& operator >> (std::istream& input, Quat& vec) { - input >> vec._v[0] >> vec._v[1] >> vec._v[2] >> vec._v[3]; + input >> vec._v[0] >> std::ws + >> vec._v[1] >> std::ws + >> vec._v[2] >> std::ws + >> vec._v[3]; return input; } @@ -309,7 +327,10 @@ inline std::ostream& operator << (std::ostream& output, const Plane& pl) inline std::istream& operator >> (std::istream& input, Plane& vec) { - input >> vec[0] >> vec[1] >> vec[2] >> vec[3]; + input >> vec[0] >> std::ws + >> vec[1] >> std::ws + >> vec[2] >> std::ws + >> vec[3]; return input; }