diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-11-12 08:13:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-11-12 16:53:30 +0100 |
commit | f34ac579fac16fff37bf00fe85d43ad6b938eca7 (patch) | |
tree | 0747c4d86bbf40a5093fb7a3215dd52a8e8586b2 /include | |
parent | c45753847dfc2b4645dc2f7500a18ec2c5d438df (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 'include')
-rw-r--r-- | include/connectivity/dbtools.hxx | 10 | ||||
-rw-r--r-- | include/oox/drawingml/drawingmltypes.hxx | 9 | ||||
-rw-r--r-- | include/sfx2/QuerySaveDocument.hxx | 6 | ||||
-rw-r--r-- | include/vcl/builder.hxx | 3 | ||||
-rw-r--r-- | include/vcl/stdtext.hxx | 6 |
5 files changed, 24 insertions, 10 deletions
diff --git a/include/connectivity/dbtools.hxx b/include/connectivity/dbtools.hxx index 27d965d4b2bb..0aa999ae729a 100644 --- a/include/connectivity/dbtools.hxx +++ b/include/connectivity/dbtools.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_CONNECTIVITY_DBTOOLS_HXX #define INCLUDED_CONNECTIVITY_DBTOOLS_HXX +#include <sal/config.h> + +#include <string_view> + #include <connectivity/dbexception.hxx> #include <comphelper/stl_types.hxx> #include <unotools/sharedunocomponent.hxx> @@ -619,7 +623,7 @@ namespace dbtools OUString createStandardCreateStatement( const css::uno::Reference< css::beans::XPropertySet >& descriptor, const css::uno::Reference< css::sdbc::XConnection>& _xConnection, ISQLStatementHelper* _pHelper, - const OUString& _sCreatePattern); + std::u16string_view _sCreatePattern); /** creates the standard sql statement for the key part of a create table statement. @param descriptor @@ -642,7 +646,7 @@ namespace dbtools OOO_DLLPUBLIC_DBTOOLS OUString createStandardTypePart( const css::uno::Reference< css::beans::XPropertySet >& descriptor ,const css::uno::Reference< css::sdbc::XConnection>& _xConnection - ,const OUString& _sCreatePattern = OUString()); + ,std::u16string_view _sCreatePattern = {}); /** creates the standard sql statement for the column part of a create table statement. @param _pHelper @@ -658,7 +662,7 @@ namespace dbtools OUString createStandardColumnPart( const css::uno::Reference< css::beans::XPropertySet >& descriptor ,const css::uno::Reference< css::sdbc::XConnection>& _xConnection ,ISQLStatementHelper* _pHelper = nullptr - ,const OUString& _sCreatePattern = OUString()); + ,std::u16string_view _sCreatePattern = {}); /** creates a SQL CREATE TABLE statement diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx index 5f95471bc9ab..b8693c00fdeb 100644 --- a/include/oox/drawingml/drawingmltypes.hxx +++ b/include/oox/drawingml/drawingmltypes.hxx @@ -21,6 +21,7 @@ #define INCLUDED_OOX_DRAWINGML_DRAWINGMLTYPES_HXX #include <memory> +#include <string_view> #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> @@ -103,22 +104,22 @@ css::geometry::IntegerRectangle2D GetRelativeRect( const css::uno::Reference< cs sal_Int32 GetCoordinate( sal_Int32 nValue ); /** converts an emu string into 1/100th mmm */ -sal_Int32 GetCoordinate( const OUString& sValue ); +sal_Int32 GetCoordinate( std::u16string_view sValue ); /** converts 1/100mm to EMU */ sal_Int32 GetPointFromCoordinate( sal_Int32 nValue ); /** converts a ST_Percentage % string into 1/1000th of % */ -sal_Int32 GetPercent( const OUString& sValue ); +sal_Int32 GetPercent( std::u16string_view sValue ); /** Converts a ST_PositiveFixedPercentage to a float. 1.0 == 100% */ double GetPositiveFixedPercentage( const OUString& sValue ); /** converts the ST_TextFontSize to point */ -float GetTextSize( const OUString& rValue ); +float GetTextSize( std::u16string_view rValue ); /** converts the ST_TextSpacingPoint to 1/100mm */ -sal_Int32 GetTextSpacingPoint( const OUString& sValue ); +sal_Int32 GetTextSpacingPoint( std::u16string_view sValue ); sal_Int32 GetTextSpacingPoint( const sal_Int32 nValue ); /** */ diff --git a/include/sfx2/QuerySaveDocument.hxx b/include/sfx2/QuerySaveDocument.hxx index 00aecfeaea99..b006074b4efa 100644 --- a/include/sfx2/QuerySaveDocument.hxx +++ b/include/sfx2/QuerySaveDocument.hxx @@ -19,6 +19,10 @@ #ifndef INCLUDED_SFX2_QUERYSAVEDOCUMENT_HXX #define INCLUDED_SFX2_QUERYSAVEDOCUMENT_HXX +#include <sal/config.h> + +#include <string_view> + #include <rtl/ustring.hxx> #include <sfx2/dllapi.h> @@ -31,7 +35,7 @@ namespace weld { class Widget; } The title of the document. */ SFX2_DLLPUBLIC short ExecuteQuerySaveDocument( - weld::Widget* _pParent, const OUString& _rTitle); + weld::Widget* _pParent, std::u16string_view _rTitle); #endif // INCLUDED_SFX2_QUERYSAVEDOCUMENT_HXX diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 58397cea2c05..6e9c9505fde9 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -22,6 +22,7 @@ #include <memory> #include <map> +#include <string_view> #include <vector> #ifdef check # //some problem with MacOSX and a check define @@ -492,7 +493,7 @@ protected: /* * @return true if rValue is "True", "true", "1", etc. */ -bool toBool(const OUString &rValue); +bool toBool(std::u16string_view rValue); #endif diff --git a/include/vcl/stdtext.hxx b/include/vcl/stdtext.hxx index c98e4c4c7779..c77e5ebfca42 100644 --- a/include/vcl/stdtext.hxx +++ b/include/vcl/stdtext.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_VCL_STDTEXT_HXX #define INCLUDED_VCL_STDTEXT_HXX +#include <sal/config.h> + +#include <string_view> + #include <rtl/ustring.hxx> #include <tools/wintypes.hxx> #include <vcl/dllapi.h> @@ -27,7 +31,7 @@ class Image; namespace weld { class Widget; } -void VCL_DLLPUBLIC ShowServiceNotAvailableError(weld::Widget* pParent, const OUString& rServiceName, bool bError); +void VCL_DLLPUBLIC ShowServiceNotAvailableError(weld::Widget* pParent, std::u16string_view rServiceName, bool bError); OUString VCL_DLLPUBLIC GetStandardText(StandardButtonType eButton); |