diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-28 15:00:44 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-09-28 16:04:46 +0200 |
commit | a63fcd0916ebe51d866ed1113babd1a521c175c6 (patch) | |
tree | 71f61ac4915081d55fa3dbc419f939c5aad41d56 /svgio | |
parent | aa770d615ec5722411cc4ab1f88de89d4cad5809 (diff) |
use more string_view in svgio
Change-Id: I30d2f02941673ce33febc4e0f563e77b80a585fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140707
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/inc/svgcharacternode.hxx | 2 | ||||
-rw-r--r-- | svgio/inc/svgnode.hxx | 2 | ||||
-rw-r--r-- | svgio/inc/svgstyleattributes.hxx | 2 | ||||
-rw-r--r-- | svgio/inc/svgstylenode.hxx | 6 | ||||
-rw-r--r-- | svgio/inc/svgtools.hxx | 14 | ||||
-rw-r--r-- | svgio/source/svgreader/svgcharacternode.cxx | 14 | ||||
-rw-r--r-- | svgio/source/svgreader/svgnode.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstyleattributes.cxx | 4 | ||||
-rw-r--r-- | svgio/source/svgreader/svgstylenode.cxx | 16 | ||||
-rw-r--r-- | svgio/source/svgreader/svgtools.cxx | 66 |
10 files changed, 64 insertions, 64 deletions
diff --git a/svgio/inc/svgcharacternode.hxx b/svgio/inc/svgcharacternode.hxx index 9558e7b752b9..50ecda7e3a89 100644 --- a/svgio/inc/svgcharacternode.hxx +++ b/svgio/inc/svgcharacternode.hxx @@ -45,7 +45,7 @@ namespace svgio::svgreader public: SvgTextPositions(); - void parseTextPositionAttributes(SVGToken aSVGToken, const OUString& aContent); + void parseTextPositionAttributes(SVGToken aSVGToken, std::u16string_view aContent); /// X content const SvgNumberVector& getX() const { return maX; } diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx index 54016aa34e99..4bdbd3046d75 100644 --- a/svgio/inc/svgnode.hxx +++ b/svgio/inc/svgnode.hxx @@ -137,7 +137,7 @@ namespace svgio::svgreader void accept(Visitor& rVisitor); /// scan helper to read and interpret a local CssStyle to mpLocalCssStyle - void readLocalCssStyle(const OUString& aContent); + void readLocalCssStyle(std::u16string_view aContent); /// style helpers void parseAttributes(const css::uno::Reference< css::xml::sax::XAttributeList >& xAttribs); diff --git a/svgio/inc/svgstyleattributes.hxx b/svgio/inc/svgstyleattributes.hxx index 529e91b75b8e..4455f2311b69 100644 --- a/svgio/inc/svgstyleattributes.hxx +++ b/svgio/inc/svgstyleattributes.hxx @@ -297,7 +297,7 @@ namespace svgio::svgreader const SvgStyleAttributes* getCssStyleParent() const { return mpCssStyleParent; } /// scan helpers - void readCssStyle(const OUString& rCandidate); + void readCssStyle(std::u16string_view rCandidate); const SvgStyleAttributes* getParentStyle() const; SvgStyleAttributes(SvgNode& rOwner); diff --git a/svgio/inc/svgstylenode.hxx b/svgio/inc/svgstylenode.hxx index 1a5a43ca858c..8a70d0ec4767 100644 --- a/svgio/inc/svgstylenode.hxx +++ b/svgio/inc/svgstylenode.hxx @@ -44,9 +44,9 @@ namespace svgio::svgreader virtual void parseAttribute(const OUString& rTokenName, SVGToken aSVGToken, const OUString& aContent) override; /// CssStyleSheet add helpers - void addCssStyleSheet(const OUString& aSelectors, const SvgStyleAttributes& rNewStyle); - void addCssStyleSheet(const OUString& aSelectors, const OUString& aContent); - void addCssStyleSheet(const OUString& aSelectorsAndContent); + void addCssStyleSheet(std::u16string_view aSelectors, const SvgStyleAttributes& rNewStyle); + void addCssStyleSheet(std::u16string_view aSelectors, std::u16string_view aContent); + void addCssStyleSheet(std::u16string_view aSelectorsAndContent); /// textCss access bool isTextCss() const { return mbTextCss; } diff --git a/svgio/inc/svgtools.hxx b/svgio/inc/svgtools.hxx index 4147344b4640..fd9bdd396d9d 100644 --- a/svgio/inc/svgtools.hxx +++ b/svgio/inc/svgtools.hxx @@ -108,20 +108,20 @@ namespace svgio::svgreader sal_Int32 read_hex(sal_Unicode aChar); bool match_colorKeyword(basegfx::BColor& rColor, const OUString& rName); bool read_color(const OUString& rCandidate, basegfx::BColor& rColor, SvgNumber& rOpacity); - basegfx::B2DRange readViewBox(const OUString& rCandidate, InfoProvider const & rInfoProvider); - basegfx::B2DHomMatrix readTransform(const OUString& rCandidate, InfoProvider const & rInfoProvider); - bool readSingleNumber(const OUString& rCandidate, SvgNumber& aNum); - bool readLocalLink(const OUString& rCandidate, OUString& rURL); + basegfx::B2DRange readViewBox(std::u16string_view rCandidate, InfoProvider const & rInfoProvider); + basegfx::B2DHomMatrix readTransform(std::u16string_view rCandidate, InfoProvider const & rInfoProvider); + bool readSingleNumber(std::u16string_view rCandidate, SvgNumber& aNum); + bool readLocalLink(std::u16string_view rCandidate, OUString& rURL); bool readLocalUrl(const OUString& rCandidate, OUString& rURL); bool readSvgPaint(const OUString& rCandidate, SvgPaint& rSvgPaint, OUString& rURL, SvgNumber& rOpacity); - bool readSvgNumberVector(const OUString& rCandidate, SvgNumberVector& rSvgNumberVector); + bool readSvgNumberVector(std::u16string_view rCandidate, SvgNumberVector& rSvgNumberVector); ::std::vector< double > solveSvgNumberVector(const SvgNumberVector& rInput, const InfoProvider& rInfoProvider); - SvgAspectRatio readSvgAspectRatio(const OUString& rCandidate); + SvgAspectRatio readSvgAspectRatio(std::u16string_view rCandidate); typedef ::std::vector< OUString > SvgStringVector; - bool readSvgStringVector(const OUString& rCandidate, SvgStringVector& rSvgStringVector); + bool readSvgStringVector(std::u16string_view rCandidate, SvgStringVector& rSvgStringVector); void readImageLink(const OUString& rCandidate, OUString& rXLink, OUString& rUrl, OUString& rMimeType, OUString& rData); diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index 9e6f91aa9dd2..d2949d5a0630 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -37,14 +37,14 @@ namespace svgio::svgreader { } - void SvgTextPositions::parseTextPositionAttributes(SVGToken aSVGToken, const OUString& aContent) + void SvgTextPositions::parseTextPositionAttributes(SVGToken aSVGToken, std::u16string_view aContent) { // parse own switch(aSVGToken) { case SVGToken::X: { - if(!aContent.isEmpty()) + if(!aContent.empty()) { SvgNumberVector aVector; @@ -57,7 +57,7 @@ namespace svgio::svgreader } case SVGToken::Y: { - if(!aContent.isEmpty()) + if(!aContent.empty()) { SvgNumberVector aVector; @@ -70,7 +70,7 @@ namespace svgio::svgreader } case SVGToken::Dx: { - if(!aContent.isEmpty()) + if(!aContent.empty()) { SvgNumberVector aVector; @@ -83,7 +83,7 @@ namespace svgio::svgreader } case SVGToken::Dy: { - if(!aContent.isEmpty()) + if(!aContent.empty()) { SvgNumberVector aVector; @@ -96,7 +96,7 @@ namespace svgio::svgreader } case SVGToken::Rotate: { - if(!aContent.isEmpty()) + if(!aContent.empty()) { SvgNumberVector aVector; @@ -122,7 +122,7 @@ namespace svgio::svgreader } case SVGToken::LengthAdjust: { - if(!aContent.isEmpty()) + if(!aContent.empty()) { if(o3tl::equalsIgnoreAsciiCase(o3tl::trim(aContent), u"spacing")) { diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index 02954f986d96..d45624d3edc6 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -296,7 +296,7 @@ namespace svgio::svgreader { } - void SvgNode::readLocalCssStyle(const OUString& aContent) + void SvgNode::readLocalCssStyle(std::u16string_view aContent) { if(!mpLocalCssStyle) { diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx index 32fed8b8daff..ffdebc2f36a4 100644 --- a/svgio/source/svgreader/svgstyleattributes.cxx +++ b/svgio/source/svgreader/svgstyleattributes.cxx @@ -176,9 +176,9 @@ namespace svgio::svgreader return nRetval; } - void SvgStyleAttributes::readCssStyle(const OUString& rCandidate) + void SvgStyleAttributes::readCssStyle(std::u16string_view rCandidate) { - const sal_Int32 nLen(rCandidate.getLength()); + const sal_Int32 nLen(rCandidate.size()); sal_Int32 nPos(0); while(nPos < nLen) diff --git a/svgio/source/svgreader/svgstylenode.cxx b/svgio/source/svgreader/svgstylenode.cxx index ac4c86d13ccc..ef25e6a83b47 100644 --- a/svgio/source/svgreader/svgstylenode.cxx +++ b/svgio/source/svgreader/svgstylenode.cxx @@ -71,15 +71,15 @@ namespace svgio::svgreader } } - void SvgStyleNode::addCssStyleSheet(const OUString& aSelectors, const SvgStyleAttributes& rNewStyle) + void SvgStyleNode::addCssStyleSheet(std::u16string_view aSelectors, const SvgStyleAttributes& rNewStyle) { // aSelectors: CssStyle selectors, any combination, no comma separations, no spaces at start/end // rNewStyle: the already prepared style to register on that name - if(aSelectors.isEmpty()) + if(aSelectors.empty()) return; std::vector< OUString > aSelectorParts; - const sal_Int32 nLen(aSelectors.getLength()); + const sal_Int32 nLen(aSelectors.size()); sal_Int32 nPos(0); OUStringBuffer aToken; @@ -134,15 +134,15 @@ namespace svgio::svgreader const_cast< SvgDocument& >(getDocument()).addSvgStyleAttributesToMapper(aConcatenatedSelector.makeStringAndClear(), rNewStyle); } - void SvgStyleNode::addCssStyleSheet(const OUString& aSelectors, const OUString& aContent) + void SvgStyleNode::addCssStyleSheet(std::u16string_view aSelectors, std::u16string_view aContent) { // aSelectors: possible comma-separated list of CssStyle definitions, no spaces at start/end // aContent: the svg style definitions as string - if(aSelectors.isEmpty() || aContent.isEmpty()) + if(aSelectors.empty() || aContent.empty()) return; // comma-separated split (Css abbreviation for same style for multiple selectors) - const sal_Int32 nLen(aSelectors.getLength()); + const sal_Int32 nLen(aSelectors.size()); sal_Int32 nPos(0); OUStringBuffer aToken; @@ -181,9 +181,9 @@ namespace svgio::svgreader } } - void SvgStyleNode::addCssStyleSheet(const OUString& aSelectorsAndContent) + void SvgStyleNode::addCssStyleSheet(std::u16string_view aSelectorsAndContent) { - const sal_Int32 nLen(aSelectorsAndContent.getLength()); + const sal_Int32 nLen(aSelectorsAndContent.size()); if(!nLen) return; diff --git a/svgio/source/svgreader/svgtools.cxx b/svgio/source/svgreader/svgtools.cxx index c0bee33995a0..af10626af3ad 100644 --- a/svgio/source/svgreader/svgtools.cxx +++ b/svgio/source/svgreader/svgtools.cxx @@ -803,9 +803,9 @@ namespace svgio::svgreader return false; } - basegfx::B2DRange readViewBox(const OUString& rCandidate, InfoProvider const & rInfoProvider) + basegfx::B2DRange readViewBox(std::u16string_view rCandidate, InfoProvider const & rInfoProvider) { - const sal_Int32 nLen(rCandidate.getLength()); + const sal_Int32 nLen(rCandidate.size()); if(nLen) { @@ -844,10 +844,10 @@ namespace svgio::svgreader return basegfx::B2DRange(); } - basegfx::B2DHomMatrix readTransform(const OUString& rCandidate, InfoProvider const & rInfoProvider) + basegfx::B2DHomMatrix readTransform(std::u16string_view rCandidate, InfoProvider const & rInfoProvider) { basegfx::B2DHomMatrix aMatrix; - const sal_Int32 nLen(rCandidate.getLength()); + const sal_Int32 nLen(rCandidate.size()); if(nLen) { @@ -858,21 +858,21 @@ namespace svgio::svgreader { const sal_Unicode aChar(rCandidate[nPos]); const sal_Int32 nInitPos(nPos); - static const char aStrMatrix[] = "matrix"; - static const char aStrTranslate[] = "translate"; - static const char aStrScale[] = "scale"; - static const char aStrRotate[] = "rotate"; - static const char aStrSkewX[] = "skewX"; - static const char aStrSkewY[] = "skewY"; + static constexpr std::u16string_view aStrMatrix = u"matrix"; + static constexpr std::u16string_view aStrTranslate = u"translate"; + static constexpr std::u16string_view aStrScale = u"scale"; + static constexpr std::u16string_view aStrRotate = u"rotate"; + static constexpr std::u16string_view aStrSkewX = u"skewX"; + static constexpr std::u16string_view aStrSkewY = u"skewY"; switch(aChar) { case u'm' : { - if(rCandidate.matchIgnoreAsciiCase(aStrMatrix, nPos)) + if(o3tl::matchIgnoreAsciiCase(rCandidate, aStrMatrix, nPos)) { // matrix element - nPos += strlen(aStrMatrix); + nPos += aStrMatrix.size(); skip_char(rCandidate, ' ', '(', nPos, nLen); SvgNumber aVal; basegfx::B2DHomMatrix aNew; @@ -923,10 +923,10 @@ namespace svgio::svgreader } case u't' : { - if(rCandidate.matchIgnoreAsciiCase(aStrTranslate, nPos)) + if(o3tl::matchIgnoreAsciiCase(rCandidate, aStrTranslate, nPos)) { // translate element - nPos += strlen(aStrTranslate); + nPos += aStrTranslate.size(); skip_char(rCandidate, ' ', '(', nPos, nLen); SvgNumber aTransX; @@ -947,10 +947,10 @@ namespace svgio::svgreader } case u's' : { - if(rCandidate.matchIgnoreAsciiCase(aStrScale, nPos)) + if(o3tl::matchIgnoreAsciiCase(rCandidate, aStrScale, nPos)) { // scale element - nPos += strlen(aStrScale); + nPos += aStrScale.size(); skip_char(rCandidate, ' ', '(', nPos, nLen); SvgNumber aScaleX; @@ -967,10 +967,10 @@ namespace svgio::svgreader aScaleY.solve(rInfoProvider)); } } - else if(rCandidate.matchIgnoreAsciiCase(aStrSkewX, nPos)) + else if(o3tl::matchIgnoreAsciiCase(rCandidate, aStrSkewX, nPos)) { // skewx element - nPos += strlen(aStrSkewX); + nPos += aStrSkewX.size(); skip_char(rCandidate, ' ', '(', nPos, nLen); double fSkewX(0.0); @@ -982,10 +982,10 @@ namespace svgio::svgreader aMatrix = aMatrix * basegfx::utils::createShearXB2DHomMatrix(tan(fSkewX)); } } - else if(rCandidate.matchIgnoreAsciiCase(aStrSkewY, nPos)) + else if(o3tl::matchIgnoreAsciiCase(rCandidate, aStrSkewY, nPos)) { // skewy element - nPos += strlen(aStrSkewY); + nPos += aStrSkewY.size(); skip_char(rCandidate, ' ', '(', nPos, nLen); double fSkewY(0.0); @@ -1001,10 +1001,10 @@ namespace svgio::svgreader } case u'r' : { - if(rCandidate.matchIgnoreAsciiCase(aStrRotate, nPos)) + if(o3tl::matchIgnoreAsciiCase(rCandidate, aStrRotate, nPos)) { // rotate element - nPos += strlen(aStrRotate); + nPos += aStrRotate.size(); skip_char(rCandidate, ' ', '(', nPos, nLen); double fAngle(0.0); @@ -1049,25 +1049,25 @@ namespace svgio::svgreader return aMatrix; } - bool readSingleNumber(const OUString& rCandidate, SvgNumber& aNum) + bool readSingleNumber(std::u16string_view rCandidate, SvgNumber& aNum) { - const sal_Int32 nLen(rCandidate.getLength()); + const sal_Int32 nLen(rCandidate.size()); sal_Int32 nPos(0); return readNumberAndUnit(rCandidate, nPos, aNum, nLen); } - bool readLocalLink(const OUString& rCandidate, OUString& rURL) + bool readLocalLink(std::u16string_view rCandidate, OUString& rURL) { sal_Int32 nPos(0); - const sal_Int32 nLen(rCandidate.getLength()); + const sal_Int32 nLen(rCandidate.size()); skip_char(rCandidate, ' ', nPos, nLen); if (nLen && nPos < nLen && '#' == rCandidate[nPos]) { ++nPos; - rURL = rCandidate.copy(nPos); + rURL = rCandidate.substr(nPos); return true; } @@ -1147,9 +1147,9 @@ namespace svgio::svgreader return false; } - bool readSvgNumberVector(const OUString& rCandidate, SvgNumberVector& rSvgNumberVector) + bool readSvgNumberVector(std::u16string_view rCandidate, SvgNumberVector& rSvgNumberVector) { - const sal_Int32 nLen(rCandidate.getLength()); + const sal_Int32 nLen(rCandidate.size()); rSvgNumberVector.clear(); if(nLen) @@ -1170,9 +1170,9 @@ namespace svgio::svgreader return false; } - SvgAspectRatio readSvgAspectRatio(const OUString& rCandidate) + SvgAspectRatio readSvgAspectRatio(std::u16string_view rCandidate) { - const sal_Int32 nLen(rCandidate.getLength()); + const sal_Int32 nLen(rCandidate.size()); if(nLen) { @@ -1292,10 +1292,10 @@ namespace svgio::svgreader return SvgAspectRatio(); } - bool readSvgStringVector(const OUString& rCandidate, SvgStringVector& rSvgStringVector) + bool readSvgStringVector(std::u16string_view rCandidate, SvgStringVector& rSvgStringVector) { rSvgStringVector.clear(); - const sal_Int32 nLen(rCandidate.getLength()); + const sal_Int32 nLen(rCandidate.size()); if(nLen) { |