summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-11-12 08:13:40 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-11-12 16:53:30 +0100
commitf34ac579fac16fff37bf00fe85d43ad6b938eca7 (patch)
tree0747c4d86bbf40a5093fb7a3215dd52a8e8586b2 /forms
parentc45753847dfc2b4645dc2f7500a18ec2c5d438df (diff)
New loplugin:stringviewparam
...to "Find functions that take rtl::O[U]String parameters that can be generalized to take std::[u16]string_view instead." (Which in turn can avoid costly O[U]String constructions, see e.g. loplugin:stringview and subView.) Some of those functions' call sites, passing plain char string literals, needed to be adapted when converting them. Change-Id: I644ab546d7a0ce9e470ab9b3196e3e60d1e812bc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105622 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'forms')
-rw-r--r--forms/source/xforms/resourcehelper.cxx12
-rw-r--r--forms/source/xforms/resourcehelper.hxx16
2 files changed, 16 insertions, 12 deletions
diff --git a/forms/source/xforms/resourcehelper.cxx b/forms/source/xforms/resourcehelper.cxx
index 371b707f8c85..2fbfe06f1258 100644
--- a/forms/source/xforms/resourcehelper.cxx
+++ b/forms/source/xforms/resourcehelper.cxx
@@ -34,22 +34,22 @@ OUString getResource(const char* pResourceId)
}
OUString getResource(const char* pResourceId,
- const OUString& rInfo1)
+ std::u16string_view rInfo1)
{
return getResource(pResourceId, rInfo1, OUString(), OUString());
}
OUString getResource(const char* pResourceId,
- const OUString& rInfo1,
- const OUString& rInfo2)
+ std::u16string_view rInfo1,
+ std::u16string_view rInfo2)
{
return getResource(pResourceId, rInfo1, rInfo2, OUString());
}
OUString getResource(const char* pResourceId,
- const OUString& rInfo1,
- const OUString& rInfo2,
- const OUString& rInfo3)
+ std::u16string_view rInfo1,
+ std::u16string_view rInfo2,
+ std::u16string_view rInfo3)
{
OUString sResource = frm::ResourceManager::loadString(pResourceId);
OSL_ENSURE( !sResource.isEmpty(), "resource not found?" );
diff --git a/forms/source/xforms/resourcehelper.hxx b/forms/source/xforms/resourcehelper.hxx
index c41e6521d271..6741ec10764e 100644
--- a/forms/source/xforms/resourcehelper.hxx
+++ b/forms/source/xforms/resourcehelper.hxx
@@ -19,6 +19,10 @@
#ifndef INCLUDED_FORMS_SOURCE_XFORMS_RESOURCEHELPER_HXX
#define INCLUDED_FORMS_SOURCE_XFORMS_RESOURCEHELPER_HXX
+#include <sal/config.h>
+
+#include <string_view>
+
#include <rtl/ustring.hxx>
namespace xforms
@@ -27,12 +31,12 @@ namespace xforms
OUString getResource(const char*);
// overloaded: get a resource string, and substitute parameters
- OUString getResource(const char*, const OUString&);
- OUString getResource(const char*, const OUString&,
- const OUString&);
- OUString getResource(const char*, const OUString&,
- const OUString&,
- const OUString&);
+ OUString getResource(const char*, std::u16string_view);
+ OUString getResource(const char*, std::u16string_view,
+ std::u16string_view);
+ OUString getResource(const char*, std::u16string_view,
+ std::u16string_view,
+ std::u16string_view);
} // namespace