diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/o3tl/string_view.hxx | 21 | ||||
-rw-r--r-- | include/oox/ole/vbahelper.hxx | 2 | ||||
-rw-r--r-- | include/oox/vml/vmlformatting.hxx | 2 | ||||
-rw-r--r-- | include/oox/vml/vmlshapecontext.hxx | 2 |
4 files changed, 24 insertions, 3 deletions
diff --git a/include/o3tl/string_view.hxx b/include/o3tl/string_view.hxx index 5d3c7fcc43e2..dec21bd70338 100644 --- a/include/o3tl/string_view.hxx +++ b/include/o3tl/string_view.hxx @@ -17,6 +17,7 @@ #include <string_view> #include <rtl/ustring.h> +#include <rtl/math.h> namespace o3tl { @@ -31,6 +32,16 @@ inline bool equalsIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2 == 0; }; +inline bool equalsIgnoreAsciiCase(std::string_view s1, std::string_view s2) +{ + if (s1.size() != s2.size()) + return false; + if (s1.data() == s2.data()) + return true; + return rtl_str_compareIgnoreAsciiCase_WithLength(s1.data(), s1.size(), s2.data(), s2.size()) + == 0; +}; + // Like OUString::compareToIgnoreAsciiCase, but for two std::u16string_view: inline int compareToIgnoreAsciiCase(std::u16string_view s1, std::u16string_view s2) { @@ -404,6 +415,16 @@ inline sal_Int64 toInt64(std::string_view str, sal_Int16 radix = 10) { return rtl_str_toInt64_WithLength(str.data(), radix, str.size()); } + +// Like OString::toDouble, but for std::string_view: +inline double toDouble(std::u16string_view str) +{ + return rtl_math_uStringToDouble(str.data(), str.data() + str.size(), '.', 0, nullptr, nullptr); +} +inline double toDouble(std::string_view str) +{ + return rtl_math_stringToDouble(str.data(), str.data() + str.size(), '.', 0, nullptr, nullptr); +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/oox/ole/vbahelper.hxx b/include/oox/ole/vbahelper.hxx index 89a513d510cf..248d09810d3e 100644 --- a/include/oox/ole/vbahelper.hxx +++ b/include/oox/ole/vbahelper.hxx @@ -80,7 +80,7 @@ namespace VbaHelper bool extractKeyValue( OUString& rKey, OUString& rValue, - const OUString& rKeyValue ); + std::u16string_view rKeyValue ); } diff --git a/include/oox/vml/vmlformatting.hxx b/include/oox/vml/vmlformatting.hxx index 78a2b7f27578..29d726a2bdba 100644 --- a/include/oox/vml/vmlformatting.hxx +++ b/include/oox/vml/vmlformatting.hxx @@ -58,7 +58,7 @@ namespace ConversionHelper */ OOX_DLLPUBLIC bool separatePair( OUString& orValue1, OUString& orValue2, - const OUString& rValue, sal_Unicode cSep ); + std::u16string_view rValue, sal_Unicode cSep ); /** Returns the boolean value from the passed string of a VML attribute. Supported values: 'f', 't', 'false', 'true'. False for anything else. diff --git a/include/oox/vml/vmlshapecontext.hxx b/include/oox/vml/vmlshapecontext.hxx index 49fc6826ae5a..5d7004ef59e0 100644 --- a/include/oox/vml/vmlshapecontext.hxx +++ b/include/oox/vml/vmlshapecontext.hxx @@ -106,7 +106,7 @@ public: private: /** Processes the 'style' attribute. */ - void setStyle( const OUString& rStyle ); + void setStyle( std::u16string_view rStyle ); /** Resolve a relation identifier to a fragment path. */ OptValue< OUString > decodeFragmentPath( const AttributeList& rAttribs, sal_Int32 nToken ) const; |