diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-12 12:43:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-04-13 08:38:53 +0200 |
commit | fdfd517a6f75e394ddcb1e195decbfed33ba56b9 (patch) | |
tree | e3bff14e5531affcd908415b4e85d7ceac4aa1fd /dbaccess | |
parent | e568c9dca8b93b96a8a130a8fb6f1bba1a33d6ea (diff) |
loplugin:stringviewparam whitelist some more functions
for which we have o3tl:: equivalents
Change-Id: I4670fd8b703ac47214be213f41e88d1c6ede7032
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132913
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/core/api/KeySet.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/api/KeySet.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/core/dataaccess/documentcontainer.cxx | 6 | ||||
-rw-r--r-- | dbaccess/source/core/misc/dsntypes.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/app/AppDetailPageHelper.cxx | 13 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/TextConnectionHelper.cxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/TextConnectionHelper.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/TableWindowListBox.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/UITools.hxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/misc/UITools.cxx | 66 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/TableWindowListBox.cxx | 5 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TEditControl.cxx | 2 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TEditControl.hxx | 2 |
13 files changed, 57 insertions, 55 deletions
diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index ba712b574bc4..9cf07310502d 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -1379,7 +1379,7 @@ namespace dbaccess void getColumnPositions(const Reference<XNameAccess>& _rxQueryColumns, const css::uno::Sequence< OUString >& _aColumnNames, - const OUString& _rsUpdateTableName, + std::u16string_view _rsUpdateTableName, SelectColumnsMetaData& o_rColumnNames, bool i_bAppendTableName) { diff --git a/dbaccess/source/core/api/KeySet.hxx b/dbaccess/source/core/api/KeySet.hxx index e5d3c61ea5ac..57889c7743b2 100644 --- a/dbaccess/source/core/api/KeySet.hxx +++ b/dbaccess/source/core/api/KeySet.hxx @@ -63,7 +63,7 @@ namespace dbaccess // the elements of _rxQueryColumns must have the properties PROPERTY_REALNAME and PROPERTY_TABLENAME void getColumnPositions(const css::uno::Reference< css::container::XNameAccess >& _rxQueryColumns, const css::uno::Sequence< OUString >& _rColumnNames, - const OUString& _rsUpdateTableName, + std::u16string_view _rsUpdateTableName, SelectColumnsMetaData& o_rColumnNames /* out */, bool i_bAppendTableName = false); diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index ffbabde52f76..1a4eedac9532 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -493,10 +493,10 @@ Any SAL_CALL ODocumentContainer::execute( const Command& aCommand, sal_Int32 Com namespace { - bool lcl_queryContent(const OUString& _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,OUString& _sSimpleName) + bool lcl_queryContent(std::u16string_view _sName,Reference< XNameContainer >& _xNameContainer,Any& _rRet,OUString& _sSimpleName) { sal_Int32 nIndex = 0; - OUString sName = _sName.getToken(0,'/',nIndex); + OUString sName( o3tl::getToken(_sName,0,'/',nIndex) ); bool bRet = _xNameContainer->hasByName(sName); if ( bRet ) { @@ -504,7 +504,7 @@ namespace _rRet = _xNameContainer->getByName(_sSimpleName); while ( nIndex != -1 && bRet ) { - sName = _sName.getToken(0,'/',nIndex); + sName = o3tl::getToken(_sName,0,'/',nIndex); _xNameContainer.set(_rRet,UNO_QUERY); bRet = _xNameContainer.is(); if ( bRet ) diff --git a/dbaccess/source/core/misc/dsntypes.cxx b/dbaccess/source/core/misc/dsntypes.cxx index b05cd467da81..25513b36c952 100644 --- a/dbaccess/source/core/misc/dsntypes.cxx +++ b/dbaccess/source/core/misc/dsntypes.cxx @@ -36,12 +36,12 @@ namespace dbaccess namespace { - void lcl_extractHostAndPort(const OUString& _sUrl,OUString& _sHostname,sal_Int32& _nPortNumber) + void lcl_extractHostAndPort(std::u16string_view _sUrl, OUString& _sHostname, sal_Int32& _nPortNumber) { if ( comphelper::string::getTokenCount(_sUrl, ':') >= 2 ) { sal_Int32 nPos {0}; - _sHostname = _sUrl.getToken(0, ':', nPos); + _sHostname = o3tl::getToken(_sUrl, 0, ':', nPos); _nPortNumber = o3tl::toInt32(o3tl::getToken(_sUrl, 0, ':', nPos)); } } diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index 4e9bb41cb63c..9533ec087c14 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/util/XCloseable.hpp> #include <comphelper/propertyvalue.hxx> #include <comphelper/string.hxx> +#include <o3tl/string_view.hxx> #include "AppView.hxx" #include <helpids.h> #include <strings.hxx> @@ -79,11 +80,11 @@ namespace dbaui namespace { - bool lcl_findEntry_impl(const TreeListBox& rTree, const OUString& rName, weld::TreeIter& rIter) + bool lcl_findEntry_impl(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter) { bool bReturn = false; sal_Int32 nIndex = 0; - OUString sName( rName.getToken(0,'/',nIndex) ); + std::u16string_view sName( o3tl::getToken(rName,0,'/',nIndex) ); const weld::TreeView& rTreeView = rTree.GetWidget(); bool bEntry = true; @@ -93,7 +94,7 @@ namespace { if ( nIndex != -1 ) { - sName = rName.getToken(0,'/',nIndex); + sName = o3tl::getToken(rName,0,'/',nIndex); bEntry = rTreeView.iter_children(rIter); } else @@ -110,11 +111,11 @@ namespace return bReturn; } - bool lcl_findEntry(const TreeListBox& rTree, const OUString& rName, weld::TreeIter& rIter) + bool lcl_findEntry(const TreeListBox& rTree, std::u16string_view rName, weld::TreeIter& rIter) { sal_Int32 nIndex = 0; - OUString sErase = rName.getToken(0,'/',nIndex); // we don't want to have the "private:forms" part - return nIndex != -1 && lcl_findEntry_impl(rTree, rName.copy(sErase.getLength() + 1), rIter); + std::u16string_view sErase = o3tl::getToken(rName,0,'/',nIndex); // we don't want to have the "private:forms" part + return nIndex != -1 && lcl_findEntry_impl(rTree, rName.substr(sErase.size() + 1), rIter); } } diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 1dee8a1f57e2..caac1d968779 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -366,7 +366,7 @@ namespace dbaui return OUString(); } - void OTextConnectionHelper::SetSeparator( weld::ComboBox& rBox, const OUString& rList, const OUString& rVal ) + void OTextConnectionHelper::SetSeparator( weld::ComboBox& rBox, std::u16string_view rList, const OUString& rVal ) { if (rVal.getLength()==1) { @@ -376,7 +376,7 @@ namespace dbaui sal_Int32 nPrevIdx {nIdx}; if (static_cast<sal_Unicode>(o3tl::toInt32(o3tl::getToken(rList, 1, '\t', nIdx))) == nVal) { - rBox.set_entry_text(rList.getToken(0, '\t', nPrevIdx)); + rBox.set_entry_text(OUString(o3tl::getToken(rList,0, '\t', nPrevIdx))); return; } } diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx index 5fface3d0512..6755a422378e 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.hxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.hxx @@ -72,7 +72,7 @@ namespace dbaui DECL_LINK(OnEditModified, weld::Entry&, void); OUString GetSeparator(const weld::ComboBox& rBox, std::u16string_view rList); - void SetSeparator(weld::ComboBox& rBox, const OUString& rList, const OUString& rVal); + void SetSeparator(weld::ComboBox& rBox, std::u16string_view rList, const OUString& rVal); void SetExtension(const OUString& _rVal); public: diff --git a/dbaccess/source/ui/inc/TableWindowListBox.hxx b/dbaccess/source/ui/inc/TableWindowListBox.hxx index 0d3890cf26c7..cdad4947ca8d 100644 --- a/dbaccess/source/ui/inc/TableWindowListBox.hxx +++ b/dbaccess/source/ui/inc/TableWindowListBox.hxx @@ -90,7 +90,7 @@ namespace dbaui virtual void Command(const CommandEvent& rEvt) override; OTableWindow* GetTabWin(){ return m_pTabWin; } - int GetEntryFromText( const OUString& rEntryText ); + int GetEntryFromText( std::u16string_view rEntryText ); }; class TableWindowListBoxHelper final : public DropTargetHelper diff --git a/dbaccess/source/ui/inc/UITools.hxx b/dbaccess/source/ui/inc/UITools.hxx index 34249933f9b6..c622c73f65c5 100644 --- a/dbaccess/source/ui/inc/UITools.hxx +++ b/dbaccess/source/ui/inc/UITools.hxx @@ -115,7 +115,7 @@ namespace dbaui @param _rTypeInfoIters the vector filled with map iterators */ void fillTypeInfo( const css::uno::Reference< css::sdbc::XConnection>& _rxConnection, - const OUString& _rsTypeNames, + std::u16string_view _rsTypeNames, OTypeInfoMap& _rTypeInfoMap, std::vector<OTypeInfoMap::iterator>& _rTypeInfoIters); diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index fca7026cf9e2..e5f595d72446 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -395,7 +395,7 @@ TOTypeInfoSP getTypeInfoFromType(const OTypeInfoMap& _rTypeInfo, } void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, - const OUString& _rsTypeNames, + std::u16string_view _rsTypeNames, OTypeInfoMap& _rTypeInfoMap, std::vector<OTypeInfoMap::iterator>& _rTypeInfoIters) { @@ -489,108 +489,108 @@ void fillTypeInfo( const Reference< css::sdbc::XConnection>& _rxConnection, if( pInfo->nNumPrecRadix <= 1) pInfo->nNumPrecRadix = 10; - OUString aName; + std::u16string_view aName; switch(pInfo->nType) { case DataType::CHAR: - aName = _rsTypeNames.getToken(TYPE_CHAR, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_CHAR, ';'); break; case DataType::VARCHAR: - aName = _rsTypeNames.getToken(TYPE_TEXT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_TEXT, ';'); break; case DataType::DECIMAL: - aName = _rsTypeNames.getToken(TYPE_DECIMAL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DECIMAL, ';'); break; case DataType::NUMERIC: - aName = _rsTypeNames.getToken(TYPE_NUMERIC, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_NUMERIC, ';'); break; case DataType::BIGINT: - aName = _rsTypeNames.getToken(TYPE_BIGINT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BIGINT, ';'); break; case DataType::FLOAT: - aName = _rsTypeNames.getToken(TYPE_FLOAT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_FLOAT, ';'); break; case DataType::DOUBLE: - aName = _rsTypeNames.getToken(TYPE_DOUBLE, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DOUBLE, ';'); break; case DataType::LONGVARCHAR: - aName = _rsTypeNames.getToken(TYPE_MEMO, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_MEMO, ';'); break; case DataType::LONGVARBINARY: - aName = _rsTypeNames.getToken(TYPE_IMAGE, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_IMAGE, ';'); break; case DataType::DATE: - aName = _rsTypeNames.getToken(TYPE_DATE, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DATE, ';'); break; case DataType::TIME: - aName = _rsTypeNames.getToken(TYPE_TIME, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_TIME, ';'); break; case DataType::TIMESTAMP: - aName = _rsTypeNames.getToken(TYPE_DATETIME, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DATETIME, ';'); break; case DataType::BIT: if ( !pInfo->aCreateParams.isEmpty() ) { - aName = _rsTypeNames.getToken(TYPE_BIT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BIT, ';'); break; } [[fallthrough]]; case DataType::BOOLEAN: - aName = _rsTypeNames.getToken(TYPE_BOOL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BOOL, ';'); break; case DataType::TINYINT: - aName = _rsTypeNames.getToken(TYPE_TINYINT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_TINYINT, ';'); break; case DataType::SMALLINT: - aName = _rsTypeNames.getToken(TYPE_SMALLINT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_SMALLINT, ';'); break; case DataType::INTEGER: - aName = _rsTypeNames.getToken(TYPE_INTEGER, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_INTEGER, ';'); break; case DataType::REAL: - aName = _rsTypeNames.getToken(TYPE_REAL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_REAL, ';'); break; case DataType::BINARY: - aName = _rsTypeNames.getToken(TYPE_BINARY, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BINARY, ';'); break; case DataType::VARBINARY: - aName = _rsTypeNames.getToken(TYPE_VARBINARY, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_VARBINARY, ';'); break; case DataType::SQLNULL: - aName = _rsTypeNames.getToken(TYPE_SQLNULL, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_SQLNULL, ';'); break; case DataType::OBJECT: - aName = _rsTypeNames.getToken(TYPE_OBJECT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_OBJECT, ';'); break; case DataType::DISTINCT: - aName = _rsTypeNames.getToken(TYPE_DISTINCT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_DISTINCT, ';'); break; case DataType::STRUCT: - aName = _rsTypeNames.getToken(TYPE_STRUCT, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_STRUCT, ';'); break; case DataType::ARRAY: - aName = _rsTypeNames.getToken(TYPE_ARRAY, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_ARRAY, ';'); break; case DataType::BLOB: - aName = _rsTypeNames.getToken(TYPE_BLOB, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_BLOB, ';'); break; case DataType::CLOB: - aName = _rsTypeNames.getToken(TYPE_CLOB, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_CLOB, ';'); break; case DataType::REF: - aName = _rsTypeNames.getToken(TYPE_REF, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_REF, ';'); break; case DataType::OTHER: - aName = _rsTypeNames.getToken(TYPE_OTHER, ';'); + aName = o3tl::getToken(_rsTypeNames, TYPE_OTHER, ';'); break; } - if ( !aName.isEmpty() ) + if ( !aName.empty() ) { pInfo->aUIName = aName; pInfo->aUIName += " [ "; } pInfo->aUIName += pInfo->aTypeName; - if ( !aName.isEmpty() ) + if ( !aName.empty() ) pInfo->aUIName += " ]"; // Now that we have the type info, save it in the multimap _rTypeInfoMap.emplace(pInfo->nType,pInfo); diff --git a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx index a1a8a17c4735..3066f8429f35 100644 --- a/dbaccess/source/ui/querydesign/TableWindowListBox.cxx +++ b/dbaccess/source/ui/querydesign/TableWindowListBox.cxx @@ -28,6 +28,7 @@ #include <com/sun/star/sdbc/SQLException.hpp> #include <vcl/svapp.hxx> #include <vcl/commandevent.hxx> +#include <o3tl/string_view.hxx> using namespace dbaui; using namespace ::com::sun::star::sdbc; @@ -92,7 +93,7 @@ void OTableWindowListBox::dispose() InterimItemWindow::dispose(); } -int OTableWindowListBox::GetEntryFromText(const OUString& rEntryText) +int OTableWindowListBox::GetEntryFromText(std::u16string_view rEntryText) { // iterate through the list OJoinDesignView* pView = m_pTabWin->getDesignView(); @@ -111,7 +112,7 @@ int OTableWindowListBox::GetEntryFromText(const OUString& rEntryText) for (int nEntry = 0, nCount = m_xTreeView->n_children(); nEntry < nCount; ++nEntry) { if (bCase ? rEntryText == m_xTreeView->get_text(nEntry) - : rEntryText.equalsIgnoreAsciiCase(m_xTreeView->get_text(nEntry))) + : o3tl::equalsIgnoreAsciiCase(rEntryText, m_xTreeView->get_text(nEntry))) return nEntry; } } diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 728b21cf55d6..119791a7c438 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -477,7 +477,7 @@ void OTableEditorCtrl::CursorMoved() OTableRowView::CursorMoved(); } -sal_Int32 OTableEditorCtrl::HasFieldName( const OUString& rFieldName ) +sal_Int32 OTableEditorCtrl::HasFieldName( std::u16string_view rFieldName ) { Reference<XConnection> xCon = GetView()->getController().getConnection(); diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx index 74e3594cf0b2..7b1d467815db 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.hxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx @@ -176,7 +176,7 @@ namespace dbaui DECL_LINK( InvalidateFieldType, void*, void ); void InitCellController(); - sal_Int32 HasFieldName( const OUString& rFieldName ); + sal_Int32 HasFieldName( std::u16string_view rFieldName ); OUString GenerateName( const OUString& rName ); bool SetDataPtr( sal_Int32 nRow ); |