From be36b1833cf07d4517532b678a002452eb3a2650 Mon Sep 17 00:00:00 2001 From: Andreas Schenk <andreas_schenk@hms.harvard.edu> Date: Fri, 15 Nov 2013 18:20:42 -0500 Subject: [PATCH] fixed string to vec converter for info module --- modules/geom/src/vec3.hh | 4 ++++ modules/info/src/item_type_cast.hh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/geom/src/vec3.hh b/modules/geom/src/vec3.hh index 1626bb2d5..47137476e 100644 --- a/modules/geom/src/vec3.hh +++ b/modules/geom/src/vec3.hh @@ -195,6 +195,10 @@ inline Vec3 operator/(Real d, const Vec3& v) return nrvo; } +// The following operator is among other things used to write vector +// data into info files. If its format is changed, the string to +// vector type cast in item_type_cast.hh has to be changed +// accordingly. inline std::ostream& operator<<(std::ostream& os, const Vec3& v) { os << "[" << v.x << ", " << v.y << ", " << v.z << "]"; diff --git a/modules/info/src/item_type_cast.hh b/modules/info/src/item_type_cast.hh index 33caf3867..0b364d575 100644 --- a/modules/info/src/item_type_cast.hh +++ b/modules/info/src/item_type_cast.hh @@ -99,7 +99,7 @@ template <> void set_new_type<IT_STRING,IT_BOOL>(EleImpl& item) template <> void set_new_type<IT_STRING,IT_VECTOR>(EleImpl& item) { static String num("[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?"); - boost::regex expression("\\(("+num+"),("+num+"),("+num+")\\)"); + boost::regex expression("\\[ *("+num+") *, *("+num+") *, *("+num+") *\\]"); boost::cmatch what; if(boost::regex_match(item.GetStringRepr().c_str(), what, expression)) { -- GitLab