reportdesign/source/ui/inc/metadata.hxx | 4 ++-- reportdesign/source/ui/inspection/metadata.cxx | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-)
New commits: commit e4cf301a6b20ffeb9610053a9582e12365fecdb2 Author: Mike Kaganski <[email protected]> AuthorDate: Mon Dec 8 07:00:09 2025 +0100 Commit: Mike Kaganski <[email protected]> CommitDate: Mon Dec 8 09:38:53 2025 +0100 Use string view in OPropertyInfoService::getPropertyId Change-Id: I0913319d0120a7c6f9ffc091bf428661dbe4927e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195211 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins diff --git a/reportdesign/source/ui/inc/metadata.hxx b/reportdesign/source/ui/inc/metadata.hxx index 4b8c46b98a68..66e962291b1b 100644 --- a/reportdesign/source/ui/inc/metadata.hxx +++ b/reportdesign/source/ui/inc/metadata.hxx @@ -51,7 +51,7 @@ namespace rptui { public: // IPropertyInfoService - static sal_Int32 getPropertyId(const OUString& _rName); + static sal_Int32 getPropertyId(std::u16string_view _rName); static OUString getPropertyTranslation(sal_Int32 _nId); static OUString getPropertyHelpId(sal_Int32 _nId); static PropUIFlags getPropertyUIFlags(sal_Int32 _nId); @@ -65,7 +65,7 @@ namespace rptui private: static const OPropertyInfoImpl* getPropertyInfo(); - static const OPropertyInfoImpl* getPropertyInfo(const OUString& _rName); + static const OPropertyInfoImpl* getPropertyInfo(std::u16string_view _rName); static const OPropertyInfoImpl* getPropertyInfo(sal_Int32 _nId); OPropertyInfoService(const OPropertyInfoService&) = delete; diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx index bfed5fb59d43..efe3ea9eaf7c 100644 --- a/reportdesign/source/ui/inspection/metadata.cxx +++ b/reportdesign/source/ui/inspection/metadata.cxx @@ -73,6 +73,10 @@ namespace rptui { return _lhs.sName < _rhs.sName; } + bool operator()(const OPropertyInfoImpl& lhs, std::u16string_view rhs) const + { + return lhs.sName < rhs; + } }; } @@ -143,7 +147,7 @@ namespace rptui } - sal_Int32 OPropertyInfoService::getPropertyId(const OUString& _rName) + sal_Int32 OPropertyInfoService::getPropertyId(std::u16string_view _rName) { const OPropertyInfoImpl* pInfo = getPropertyInfo(_rName); return pInfo ? pInfo->nId : -1; @@ -171,15 +175,14 @@ namespace rptui } - const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(const OUString& _rName) + const OPropertyInfoImpl* OPropertyInfoService::getPropertyInfo(std::u16string_view _rName) { // initialization if(!s_pPropertyInfos) getPropertyInfo(); - OPropertyInfoImpl aSearch(_rName, 0, OUString(), u""_ustr, PropUIFlags::NONE); const OPropertyInfoImpl* pPropInfo = ::std::lower_bound( - s_pPropertyInfos, s_pPropertyInfos + s_nCount, aSearch, PropertyInfoLessByName() ); + s_pPropertyInfos, s_pPropertyInfos + s_nCount, _rName, PropertyInfoLessByName() ); if ( ( pPropInfo < s_pPropertyInfos + s_nCount ) && pPropInfo->sName == _rName ) return pPropInfo;
