summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-12 09:44:12 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-13 08:30:00 +0100
commit07f40bd25442f25c0af948ae1b0dac7fdff1688c (patch)
tree3fca13d92b02bc3712d98c3c43f9612ae4c56cf1 /include
parent8fbc8579f2481dc3eeb962e99522047291e16fbe (diff)
downloadqpdf-07f40bd25442f25c0af948ae1b0dac7fdff1688c.tar.zst
QUtil::double_to_string: trim trailing zeroes with option to disable
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/QPDFObjectHandle.hh5
-rw-r--r--include/qpdf/QUtil.hh9
2 files changed, 13 insertions, 1 deletions
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index 4c986af7..41646b79 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -476,6 +476,11 @@ class QPDFObjectHandle
static QPDFObjectHandle newReal(std::string const& value);
QPDF_DLL
static QPDFObjectHandle newReal(double value, int decimal_places = 0);
+ // ABI: combine with other newReal by adding trim_trailing_zeroes
+ // above as an optional parameter with a default of true.
+ QPDF_DLL
+ static QPDFObjectHandle newReal(double value, int decimal_places,
+ bool trim_trailing_zeroes);
QPDF_DLL
static QPDFObjectHandle newName(std::string const& name);
QPDF_DLL
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
index 5b1f8aae..769c5fd7 100644
--- a/include/qpdf/QUtil.hh
+++ b/include/qpdf/QUtil.hh
@@ -47,9 +47,16 @@ namespace QUtil
QPDF_DLL
std::string int_to_string_base(long long, int base, int length = 0);
QPDF_DLL
- std::string uint_to_string_base(unsigned long long, int base, int length = 0);
+ std::string uint_to_string_base(unsigned long long, int base,
+ int length = 0);
QPDF_DLL
std::string double_to_string(double, int decimal_places = 0);
+ // ABI: combine with other double_to_string by adding
+ // trim_trailing_zeroes above as an optional parameter with a
+ // default of true.
+ QPDF_DLL
+ std::string double_to_string(double, int decimal_places,
+ bool trim_trailing_zeroes);
// These string to number methods throw std::runtime_error on
// underflow/overflow.