From 114ef1c5d1a5de4c0596b8c692f4d2a18648bb99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9gory=20Soutad=C3=A9?= Date: Sat, 12 Mar 2022 21:12:07 +0100 Subject: [PATCH] Fix location bug for real values (',' can be used instead of '.') --- src/uPDFTypes.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/uPDFTypes.cpp b/src/uPDFTypes.cpp index a4b6835..acefc1e 100644 --- a/src/uPDFTypes.cpp +++ b/src/uPDFTypes.cpp @@ -18,6 +18,7 @@ */ #include +#include #include "uPDFTypes.h" #include "uPDFParser_common.h" @@ -54,11 +55,15 @@ namespace uPDFParser std::string Real::str() { + std::string res; std::string sign(""); if (_signed && _value >= 0) sign = "+"; - return " " + sign + std::to_string(_value); + res = " " + sign + std::to_string(_value); + std::replace( res.begin(), res.end(), ',', '.'); + + return res; } std::string Array::str() @@ -85,7 +90,7 @@ namespace uPDFParser { std::string res("<<"); std::map::iterator it; - + for(it = _value.begin(); it!=_value.end(); it++) { res += std::string("/") + it->first;