summaryrefslogtreecommitdiff
path: root/xmloff/source/draw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-04-13 16:14:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-04-13 20:36:16 +0200
commit0d55188fbf7b0399f01bae521f1a34d22ad8ba18 (patch)
tree7094b0fe13c8d6d7a288d160ae595acaac23e83c /xmloff/source/draw
parent902e81b1b0c62993270846962d44aea6774e9687 (diff)
use more string_view in xmloff
Change-Id: I0d860fa6e3d3261f3393e912b27930066dd93f7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132972 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/draw')
-rw-r--r--xmloff/source/draw/shapeexport.cxx23
1 files changed, 12 insertions, 11 deletions
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index bc642d344e68..55de243f07aa 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -90,6 +90,7 @@
#include <o3tl/any.hxx>
#include <o3tl/typed_flags_set.hxx>
+#include <o3tl/string_view.hxx>
#include <rtl/math.hxx>
#include <rtl/ustrbuf.hxx>
@@ -2408,22 +2409,22 @@ void XMLShapeExport::ImpExportPolygonShape(
namespace
{
-OUString getNameFromStreamURL(OUString const & rURL)
+OUString getNameFromStreamURL(std::u16string_view rURL)
{
- static const OUStringLiteral sPackageURL(u"vnd.sun.star.Package:");
+ static constexpr std::u16string_view sPackageURL(u"vnd.sun.star.Package:");
OUString sResult;
- if (rURL.match(sPackageURL))
+ if (o3tl::starts_with(rURL, sPackageURL))
{
- OUString sRequestedName = rURL.copy(sPackageURL.getLength());
- sal_Int32 nLastIndex = sRequestedName.lastIndexOf('/') + 1;
- if ((nLastIndex > 0) && (nLastIndex < sRequestedName.getLength()))
- sRequestedName = sRequestedName.copy(nLastIndex);
- nLastIndex = sRequestedName.lastIndexOf('.');
- if (nLastIndex >= 0)
- sRequestedName = sRequestedName.copy(0, nLastIndex);
- if (!sRequestedName.isEmpty())
+ std::u16string_view sRequestedName = rURL.substr(sPackageURL.size());
+ size_t nLastIndex = sRequestedName.rfind('/') + 1;
+ if ((nLastIndex > 0) && (nLastIndex < sRequestedName.size()))
+ sRequestedName = sRequestedName.substr(nLastIndex);
+ nLastIndex = sRequestedName.rfind('.');
+ if (nLastIndex != std::u16string_view::npos)
+ sRequestedName = sRequestedName.substr(0, nLastIndex);
+ if (!sRequestedName.empty())
sResult = sRequestedName;
}