From 4149201b099487c5b46d7015b0c174dfff1841ec Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 28 Apr 2022 11:41:48 +0200 Subject: use more string_view in tools::Color Change-Id: I0203aff3af19d3994af5325538520469ab2900ce Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133541 Tested-by: Jenkins Reviewed-by: Noel Grandin --- tools/source/generic/color.cxx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/source/generic/color.cxx b/tools/source/generic/color.cxx index 0493b5250f62..1c740f03df03 100644 --- a/tools/source/generic/color.cxx +++ b/tools/source/generic/color.cxx @@ -159,30 +159,30 @@ Color Color::HSBtoRGB( sal_uInt16 nHue, sal_uInt16 nSat, sal_uInt16 nBri ) return Color( cR, cG, cB ); } -Color Color::STRtoRGB(const OUString& colorname) +Color Color::STRtoRGB(std::u16string_view colorname) { Color col; - if(colorname.isEmpty()) return col; + if(colorname.empty()) return col; - switch(colorname.getLength()){ + switch(colorname.size()){ case 7: - col.mValue = o3tl::toUInt32(colorname.subView(1,6), 16); + col.mValue = o3tl::toUInt32(colorname.substr(1,6), 16); break; case 6: - col.mValue = colorname.toUInt32(16); + col.mValue = o3tl::toUInt32(colorname, 16); break; case 4: { sal_Unicode data[6] = { colorname[1], colorname[1], colorname[2], colorname[2], colorname[3], colorname[3] }; - col.mValue = OUString(data,6).toUInt32(16); + col.mValue = o3tl::toUInt32(std::u16string_view(data,6), 16); break; } case 3: { sal_Unicode data[6] = { colorname[0], colorname[0], colorname[1], colorname[1], colorname[2], colorname[2] }; - col.mValue = OUString(data,6).toUInt32(16); + col.mValue = o3tl::toUInt32(std::u16string_view(data,6), 16); break; } default: -- cgit