svgio/inc/svgnode.hxx | 3 +- svgio/source/svgreader/svgnode.cxx | 41 ++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 21 deletions(-)
New commits: commit 8f2f2a8d131eef60164c0586fb73b69fd950f15d Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Sep 22 20:01:06 2021 +0200 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Wed Sep 22 21:13:42 2021 +0200 Extend loplugin:stringviewparam to starts/endsWith: svgio Change-Id: Ia48465b86e6b2e5362b95a2b228414bfc6ac6490 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122481 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx index 93c303fa2df7..63c6b2318406 100644 --- a/svgio/inc/svgnode.hxx +++ b/svgio/inc/svgnode.hxx @@ -24,6 +24,7 @@ #include <com/sun/star/xml/sax/XAttributeList.hpp> #include <drawinglayer/primitive2d/Primitive2DContainer.hxx> #include <memory> +#include <string_view> #include <vector> #include <optional> @@ -72,7 +73,7 @@ namespace svgio::svgreader // helper to convert a string associated with a token of type SVGTokenDisplay // to the enum Display. Empty strings return the default 'Display_inline' with // which members should be initialized - Display getDisplayFromContent(const OUString& aContent); + Display getDisplayFromContent(std::u16string_view aContent); class Visitor; diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index c01539ba389a..3bc3fb76baca 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -21,6 +21,7 @@ #include <svgnode.hxx> #include <svgstyleattributes.hxx> #include <drawinglayer/primitive2d/objectinfoprimitive2d.hxx> +#include <o3tl/string_view.hxx> #include <tools/urlobj.hxx> @@ -333,79 +334,79 @@ namespace svgio::svgreader } } - Display getDisplayFromContent(const OUString& aContent) + Display getDisplayFromContent(std::u16string_view aContent) { - if(!aContent.isEmpty()) + if(!aContent.empty()) { - if(aContent.startsWith("inline")) + if(o3tl::starts_with(aContent, u"inline")) { return Display::Inline; } - else if(aContent.startsWith("none")) + else if(o3tl::starts_with(aContent, u"none")) { return Display::None; } - else if(aContent.startsWith("inherit")) + else if(o3tl::starts_with(aContent, u"inherit")) { return Display::Inherit; } - else if(aContent.startsWith("block")) + else if(o3tl::starts_with(aContent, u"block")) { return Display::Block; } - else if(aContent.startsWith("list-item")) + else if(o3tl::starts_with(aContent, u"list-item")) { return Display::ListItem; } - else if(aContent.startsWith("run-in")) + else if(o3tl::starts_with(aContent, u"run-in")) { return Display::RunIn; } - else if(aContent.startsWith("compact")) + else if(o3tl::starts_with(aContent, u"compact")) { return Display::Compact; } - else if(aContent.startsWith("marker")) + else if(o3tl::starts_with(aContent, u"marker")) { return Display::Marker; } - else if(aContent.startsWith("table")) + else if(o3tl::starts_with(aContent, u"table")) { return Display::Table; } - else if(aContent.startsWith("inline-table")) + else if(o3tl::starts_with(aContent, u"inline-table")) { return Display::InlineTable; } - else if(aContent.startsWith("table-row-group")) + else if(o3tl::starts_with(aContent, u"table-row-group")) { return Display::TableRowGroup; } - else if(aContent.startsWith("table-header-group")) + else if(o3tl::starts_with(aContent, u"table-header-group")) { return Display::TableHeaderGroup; } - else if(aContent.startsWith("table-footer-group")) + else if(o3tl::starts_with(aContent, u"table-footer-group")) { return Display::TableFooterGroup; } - else if(aContent.startsWith("table-row")) + else if(o3tl::starts_with(aContent, u"table-row")) { return Display::TableRow; } - else if(aContent.startsWith("table-column-group")) + else if(o3tl::starts_with(aContent, u"table-column-group")) { return Display::TableColumnGroup; } - else if(aContent.startsWith("table-column")) + else if(o3tl::starts_with(aContent, u"table-column")) { return Display::TableColumn; } - else if(aContent.startsWith("table-cell")) + else if(o3tl::starts_with(aContent, u"table-cell")) { return Display::TableCell; } - else if(aContent.startsWith("table-caption")) + else if(o3tl::starts_with(aContent, u"table-caption")) { return Display::TableCaption; }