diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-10-01 09:09:45 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-10-11 14:22:22 +0200 |
commit | 4f5b3e4bd53d6d61df1f65f496f7bc8dc525c8a1 (patch) | |
tree | e0ac44b8f22f944f3303bac8e494da41d6c7b164 /include/vcl | |
parent | 5f84c44e3d5ff19b800b6358e61228546e318d4f (diff) |
In O[U]StringBuffer, make string_view params replacements for OUString ones
...for LIBO_INTERNAL_ONLY, instead of having them as additional overloads. That
way, loplugin:bufferadd and loplugin:stringviewparam found many further
opportunities for simplification (all addressed here). Some notes:
* There is no longer an implicit conversion from O[U]String to O[U]StringBuffer
(as that goes via user-defined conversions through string_view now), which was
most noticeable in copy initializations like
OStringBuffer buf = someStr;
that had to be changed to direct initialization,
OStringBuffer buf(someStr);
But then again, it wasn't too many places that were affected and I think we can
live with that.
* I made the O[U]StringBuffer ctors taking string_view non-explicit, mainly to
get them in line with their counterparts taking O[U]String.
* I added an OUStringBuffer::lastIndexOf string_view overload that was missing
(relative to OUStringBuffer::indexOf).
* loplugin:stringconstant needed some addition to keep the
compilerplugins/clang/test/stringconstant.cxx checks related to
OStringBuffer::append and OStringBuffer::insert working.
* loplugin:stringviewparam no longer needs the special O[U]StringBuffer-related
code that had been introduced in 1250aecd71fabde4dba990bfceb61bbe8e06b8ea
"loplugin:stringviewparam extend to new.."
Change-Id: Ib1bb8c4632d99b744e742605a9fef6eae959fd72
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122904
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/vcl')
-rw-r--r-- | include/vcl/builder.hxx | 2 | ||||
-rw-r--r-- | include/vcl/outdev.hxx | 3 | ||||
-rw-r--r-- | include/vcl/toolkit/field.hxx | 8 | ||||
-rw-r--r-- | include/vcl/uitest/logger.hxx | 2 |
4 files changed, 10 insertions, 5 deletions
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 504438bdab40..4aeca1459f25 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -398,7 +398,7 @@ namespace BuilderUtils VCL_DLLPUBLIC void set_properties(vcl::Window *pWindow, const VclBuilder::stringmap &rProps); //Convert _ gtk markup to ~ vcl markup - VCL_DLLPUBLIC OUString convertMnemonicMarkup(const OUString &rIn); + VCL_DLLPUBLIC OUString convertMnemonicMarkup(std::u16string_view rIn); VCL_DLLPUBLIC OUString extractCustomProperty(VclBuilder::stringmap &rMap); diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 50ee0324af3d..6f85e0d51fef 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -63,6 +63,7 @@ #include <com/sun/star/awt/DeviceInfo.hpp> #include <memory> +#include <string_view> #include <vector> struct ImplOutDevData; @@ -1111,7 +1112,7 @@ public: FontMetric GetFontMetricFromCollection( int nDevFontIndex ) const; int GetFontFaceCollectionCount() const; - bool IsFontAvailable( const OUString& rFontName ) const; + bool IsFontAvailable( std::u16string_view rFontName ) const; bool AddTempDevFont( const OUString& rFileURL, const OUString& rFontName ); void RefreshFontData( const bool bNewFontLists ); diff --git a/include/vcl/toolkit/field.hxx b/include/vcl/toolkit/field.hxx index 9ac458f0dc00..2efab32bad2c 100644 --- a/include/vcl/toolkit/field.hxx +++ b/include/vcl/toolkit/field.hxx @@ -23,6 +23,10 @@ #error "don't use this in new code" #endif +#include <sal/config.h> + +#include <string_view> + #include <config_options.h> #include <tools/date.hxx> #include <tools/fldunit.hxx> @@ -303,14 +307,14 @@ protected: TimeFormatter(Edit* pEdit); - SAL_DLLPRIVATE void ImplTimeReformat( const OUString& rStr, OUString& rOutStr ); + SAL_DLLPRIVATE void ImplTimeReformat( std::u16string_view rStr, OUString& rOutStr ); SAL_DLLPRIVATE void ImplNewFieldValue( const tools::Time& rTime ); SAL_DLLPRIVATE void ImplSetUserTime( const tools::Time& rNewTime, Selection const * pNewSelection = nullptr ); SAL_DLLPRIVATE bool ImplAllowMalformedInput() const; public: static OUString FormatTime(const tools::Time& rNewTime, TimeFieldFormat eFormat, TimeFormat eHourFormat, bool bDuration, const LocaleDataWrapper& rLocaleData); - static bool TextToTime(const OUString& rStr, tools::Time& rTime, TimeFieldFormat eFormat, bool bDuration, const LocaleDataWrapper& rLocaleDataWrapper, bool _bSkipInvalidCharacters = true); + static bool TextToTime(std::u16string_view rStr, tools::Time& rTime, TimeFieldFormat eFormat, bool bDuration, const LocaleDataWrapper& rLocaleDataWrapper, bool _bSkipInvalidCharacters = true); static int GetTimeArea(TimeFieldFormat eFormat, const OUString& rText, int nCursor, const LocaleDataWrapper& rLocaleDataWrapper); static tools::Time SpinTime(bool bUp, const tools::Time& rTime, TimeFieldFormat eFormat, diff --git a/include/vcl/uitest/logger.hxx b/include/vcl/uitest/logger.hxx index 2500c0d6f58e..c810b7eb7de7 100644 --- a/include/vcl/uitest/logger.hxx +++ b/include/vcl/uitest/logger.hxx @@ -43,7 +43,7 @@ private: public: UITestLogger(); - void logCommand(const OUString& rAction, + void logCommand(std::u16string_view rAction, const css::uno::Sequence<css::beans::PropertyValue>& rArgs); void logAction(VclPtr<Control> const& xUIElement, VclEventId nEvent); |