diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-03-21 08:54:05 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-03-21 08:54:05 +0100 |
commit | e6ce64b1d7d7a0e451af567360cdaf27079258c9 (patch) | |
tree | c3c8eb60780fbcdb6c8ba0d54cfcbf304e36b53f /include/rtl/math.hxx | |
parent | 5a5889d1e1bd17c16930b2132d8c2674fb7fa05a (diff) |
Only need an OStringBuffer in number2PolyPolygon
...so that later passing the OStringBuffer's aNum[i] to
createSevenSegmentPolyPolygon (taking a first parameter of type char) doesn't
need to implicitly convert from sal_Unicode to char.
Requires addition of some missing OStringBuffer-related function variants in
rtl/math.hxx and rtl/strbuf.hxx.
Change-Id: I79e6b2a791abc62b6556a6668e4411cced490c11
Diffstat (limited to 'include/rtl/math.hxx')
-rw-r--r-- | include/rtl/math.hxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/rtl/math.hxx b/include/rtl/math.hxx index fed674fdd210..7572c972a91f 100644 --- a/include/rtl/math.hxx +++ b/include/rtl/math.hxx @@ -21,6 +21,7 @@ #define INCLUDED_RTL_MATH_HXX #include <rtl/math.h> +#include <rtl/strbuf.hxx> #include <rtl/string.hxx> #include <rtl/ustring.hxx> #include <rtl/ustrbuf.hxx> @@ -63,6 +64,42 @@ inline rtl::OString doubleToString(double fValue, rtl_math_StringFormat eFormat, return aResult; } +/** A wrapper around rtl_math_doubleToString that appends to an + rtl::OStringBuffer. + + @since LibreOffice 5.4 +*/ +inline void doubleToStringBuffer( + rtl::OStringBuffer& rBuffer, double fValue, rtl_math_StringFormat eFormat, + sal_Int32 nDecPlaces, sal_Char cDecSeparator, sal_Int32 const * pGroups, + sal_Char cGroupSeparator, bool bEraseTrailingDecZeros = false) +{ + rtl_String ** pData; + sal_Int32 * pCapacity; + rBuffer.accessInternals(&pData, &pCapacity); + rtl_math_doubleToString( + pData, pCapacity, rBuffer.getLength(), fValue, eFormat, nDecPlaces, + cDecSeparator, pGroups, cGroupSeparator, bEraseTrailingDecZeros); +} + +/** A wrapper around rtl_math_doubleToString that appends to an + rtl::OStringBuffer, with no grouping. + + @since LibreOffice 5.4 +*/ +inline void doubleToStringBuffer( + rtl::OStringBuffer& rBuffer, double fValue, rtl_math_StringFormat eFormat, + sal_Int32 nDecPlaces, sal_Char cDecSeparator, + bool bEraseTrailingDecZeros = false) +{ + rtl_String ** pData; + sal_Int32 * pCapacity; + rBuffer.accessInternals(&pData, &pCapacity); + rtl_math_doubleToString( + pData, pCapacity, rBuffer.getLength(), fValue, eFormat, nDecPlaces, + cDecSeparator, NULL, 0, bEraseTrailingDecZeros); +} + /** A wrapper around rtl_math_doubleToUString. */ inline rtl::OUString doubleToUString(double fValue, |