Use std::initializer_list, C-style array instead of more expensive Sequence

Change-Id: Ibb268268926cc91f595f19026f6cee4b5a74a8bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178038
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2024-12-07 17:23:17 +05:00
parent a35f0aee62
commit 04c62acc63
21 changed files with 25 additions and 29 deletions

View file

@ -41,7 +41,7 @@ OUString VCLXAccessibleComboBox::getImplementationName()
Sequence< OUString > VCLXAccessibleComboBox::getSupportedServiceNames() Sequence< OUString > VCLXAccessibleComboBox::getSupportedServiceNames()
{ {
return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(), return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(),
Sequence<OUString>{u"com.sun.star.accessibility.AccessibleComboBox"_ustr}); std::initializer_list<OUString>{u"com.sun.star.accessibility.AccessibleComboBox"_ustr});
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -60,7 +60,7 @@ OUString VCLXAccessibleDropDownComboBox::getImplementationName()
Sequence< OUString > VCLXAccessibleDropDownComboBox::getSupportedServiceNames() Sequence< OUString > VCLXAccessibleDropDownComboBox::getSupportedServiceNames()
{ {
return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(), return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(),
Sequence<OUString>{u"com.sun.star.accessibility.AccessibleDropDownComboBox"_ustr}); std::initializer_list<OUString>{u"com.sun.star.accessibility.AccessibleDropDownComboBox"_ustr});
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -39,7 +39,7 @@ OUString VCLXAccessibleDropDownListBox::getImplementationName()
Sequence< OUString > VCLXAccessibleDropDownListBox::getSupportedServiceNames() Sequence< OUString > VCLXAccessibleDropDownListBox::getSupportedServiceNames()
{ {
return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(), return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(),
Sequence<OUString>{u"com.sun.star.accessibility.AccessibleDropDownListBox"_ustr}); std::initializer_list<OUString>{u"com.sun.star.accessibility.AccessibleDropDownListBox"_ustr});
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -602,7 +602,7 @@ OUString VCLXAccessibleList::getImplementationName()
Sequence< OUString > VCLXAccessibleList::getSupportedServiceNames() Sequence< OUString > VCLXAccessibleList::getSupportedServiceNames()
{ {
return comphelper::concatSequences(VCLXAccessibleComponent::getSupportedServiceNames(), return comphelper::concatSequences(VCLXAccessibleComponent::getSupportedServiceNames(),
Sequence<OUString>{u"com.sun.star.accessibility.AccessibleList"_ustr}); std::initializer_list<OUString>{u"com.sun.star.accessibility.AccessibleList"_ustr});
} }
void VCLXAccessibleList::UpdateVisibleLineCount() void VCLXAccessibleList::UpdateVisibleLineCount()

View file

@ -40,7 +40,7 @@ OUString VCLXAccessibleListBox::getImplementationName()
Sequence< OUString > VCLXAccessibleListBox::getSupportedServiceNames() Sequence< OUString > VCLXAccessibleListBox::getSupportedServiceNames()
{ {
return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(), return comphelper::concatSequences(VCLXAccessibleBox::getSupportedServiceNames(),
Sequence<OUString>{u"com.sun.star.accessibility.AccessibleListBox"_ustr}); std::initializer_list<OUString>{u"com.sun.star.accessibility.AccessibleListBox"_ustr});
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -96,7 +96,7 @@ OUString VCLXAccessibleTextField::getImplementationName()
Sequence< OUString > VCLXAccessibleTextField::getSupportedServiceNames() Sequence< OUString > VCLXAccessibleTextField::getSupportedServiceNames()
{ {
return comphelper::concatSequences(VCLXAccessibleTextComponent::getSupportedServiceNames(), return comphelper::concatSequences(VCLXAccessibleTextComponent::getSupportedServiceNames(),
Sequence<OUString>{u"com.sun.star.accessibility.AccessibleTextField"_ustr}); std::initializer_list<OUString>{u"com.sun.star.accessibility.AccessibleTextField"_ustr});
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -589,7 +589,7 @@ OUString VCLXAccessibleToolBox::getImplementationName()
Sequence< OUString > VCLXAccessibleToolBox::getSupportedServiceNames() Sequence< OUString > VCLXAccessibleToolBox::getSupportedServiceNames()
{ {
return comphelper::concatSequences(VCLXAccessibleComponent::getSupportedServiceNames(), return comphelper::concatSequences(VCLXAccessibleComponent::getSupportedServiceNames(),
Sequence<OUString>{u"com.sun.star.accessibility.AccessibleToolBox"_ustr}); std::initializer_list<OUString>{u"com.sun.star.accessibility.AccessibleToolBox"_ustr});
} }
// XAccessibleContext // XAccessibleContext

View file

@ -208,7 +208,7 @@ namespace comphelper
return comphelper::concatSequences( return comphelper::concatSequences(
OComponentProxyAggregationHelper::getTypes(), OComponentProxyAggregationHelper::getTypes(),
// append XComponent, coming from WeakComponentImplHelperBase // append XComponent, coming from WeakComponentImplHelperBase
Sequence { cppu::UnoType<XComponent>::get() }); std::initializer_list<Type>{ cppu::UnoType<XComponent>::get() });
} }

View file

@ -61,10 +61,10 @@ Any SAL_CALL java_sql_CallableStatement::queryInterface( const Type & rType )
css::uno::Sequence< css::uno::Type > SAL_CALL java_sql_CallableStatement::getTypes( ) css::uno::Sequence< css::uno::Type > SAL_CALL java_sql_CallableStatement::getTypes( )
{ {
::cppu::OTypeCollection aTypes( cppu::UnoType<css::sdbc::XRow>::get(), css::uno::Type aTypes[] { cppu::UnoType<css::sdbc::XRow>::get(),
cppu::UnoType<css::sdbc::XOutParameters>::get()); cppu::UnoType<css::sdbc::XOutParameters>::get() };
return ::comphelper::concatSequences(aTypes.getTypes(),java_sql_PreparedStatement::getTypes()); return ::comphelper::concatSequences(java_sql_PreparedStatement::getTypes(), aTypes);
} }
sal_Bool SAL_CALL java_sql_CallableStatement::wasNull( ) sal_Bool SAL_CALL java_sql_CallableStatement::wasNull( )

View file

@ -550,7 +550,7 @@ uno::Sequence< uno::Type > SAL_CALL SvxUnoTextField::getTypes()
{ {
maTypeSequence = comphelper::concatSequences( maTypeSequence = comphelper::concatSequences(
OComponentHelper::getTypes(), OComponentHelper::getTypes(),
uno::Sequence { std::initializer_list<uno::Type>{
cppu::UnoType<text::XTextField>::get(), cppu::UnoType<text::XTextField>::get(),
cppu::UnoType<beans::XPropertySet>::get(), cppu::UnoType<beans::XPropertySet>::get(),
cppu::UnoType<lang::XServiceInfo>::get(), cppu::UnoType<lang::XServiceInfo>::get(),

View file

@ -3717,11 +3717,11 @@ Sequence< OUString > SAL_CALL ODatabaseForm::getSupportedServiceNames()
// concat without own services // concat without own services
return ::comphelper::concatSequences( return ::comphelper::concatSequences(
css::uno::Sequence<OUString> { aServices,
std::initializer_list<OUString>{
FRM_SUN_FORMCOMPONENT, u"com.sun.star.form.FormComponents"_ustr, FRM_SUN_FORMCOMPONENT, u"com.sun.star.form.FormComponents"_ustr,
FRM_SUN_COMPONENT_FORM, FRM_SUN_COMPONENT_HTMLFORM, FRM_SUN_COMPONENT_FORM, FRM_SUN_COMPONENT_HTMLFORM,
FRM_SUN_COMPONENT_DATAFORM, FRM_COMPONENT_FORM }, FRM_SUN_COMPONENT_DATAFORM, FRM_COMPONENT_FORM }
aServices
); );
} }

View file

@ -119,7 +119,7 @@ css::uno::Reference< css::util::XCloneable > SAL_CALL ODateModel::createClone()
css::uno::Sequence<OUString> SAL_CALL ODateModel::getSupportedServiceNames() css::uno::Sequence<OUString> SAL_CALL ODateModel::getSupportedServiceNames()
{ {
const css::uno::Sequence<OUString> vals { static constexpr OUString vals[] {
BINDABLE_CONTROL_MODEL, BINDABLE_CONTROL_MODEL,
DATA_AWARE_CONTROL_MODEL, DATA_AWARE_CONTROL_MODEL,
VALIDATABLE_CONTROL_MODEL, VALIDATABLE_CONTROL_MODEL,

View file

@ -48,7 +48,7 @@ using namespace ::com::sun::star::util;
Sequence<Type> OFileControlModel::_getTypes() Sequence<Type> OFileControlModel::_getTypes()
{ {
static Sequence<Type> const aTypes = static Sequence<Type> const aTypes =
concatSequences(OControlModel::_getTypes(), Sequence<Type>{ cppu::UnoType<XReset>::get() }); concatSequences(OControlModel::_getTypes(), std::initializer_list<Type>{ cppu::UnoType<XReset>::get() });
return aTypes; return aTypes;
} }

View file

@ -1508,7 +1508,7 @@ css::uno::Sequence<OUString> SAL_CALL OBoundControlModel::getSupportedServiceNam
Sequence< OUString > OBoundControlModel::getSupportedServiceNames_Static() Sequence< OUString > OBoundControlModel::getSupportedServiceNames_Static()
{ {
Sequence<OUString> aOwnServiceNames { u"com.sun.star.form.DataAwareControlModel"_ustr }; static constexpr OUString aOwnServiceNames[] { u"com.sun.star.form.DataAwareControlModel"_ustr };
return ::comphelper::concatSequences( return ::comphelper::concatSequences(
OControlModel::getSupportedServiceNames_Static(), OControlModel::getSupportedServiceNames_Static(),
aOwnServiceNames aOwnServiceNames

View file

@ -120,7 +120,7 @@ namespace frm
// to benefit from the functionality for binding to spreadsheet cells // to benefit from the functionality for binding to spreadsheet cells
Sequence< OUString > SAL_CALL OScrollBarModel::getSupportedServiceNames() Sequence< OUString > SAL_CALL OScrollBarModel::getSupportedServiceNames()
{ {
Sequence< OUString > aOwnNames { FRM_SUN_COMPONENT_SCROLLBAR, BINDABLE_INTEGER_VALUE_RANGE }; static constexpr OUString aOwnNames[] { FRM_SUN_COMPONENT_SCROLLBAR, BINDABLE_INTEGER_VALUE_RANGE };
return ::comphelper::combineSequences( return ::comphelper::combineSequences(
getAggregateServiceNames(), getAggregateServiceNames(),

View file

@ -73,7 +73,7 @@ namespace frm
// to benefit from the functionality for binding to spreadsheet cells // to benefit from the functionality for binding to spreadsheet cells
Sequence< OUString > SAL_CALL OSpinButtonModel::getSupportedServiceNames() Sequence< OUString > SAL_CALL OSpinButtonModel::getSupportedServiceNames()
{ {
Sequence< OUString > aOwnNames { FRM_SUN_COMPONENT_SPINBUTTON, BINDABLE_INTEGER_VALUE_RANGE }; static constexpr OUString aOwnNames[] { FRM_SUN_COMPONENT_SPINBUTTON, BINDABLE_INTEGER_VALUE_RANGE };
return ::comphelper::combineSequences( return ::comphelper::combineSequences(
getAggregateServiceNames(), getAggregateServiceNames(),

View file

@ -263,7 +263,7 @@ namespace frm
Sequence< OUString > SAL_CALL ORichTextModel::getSupportedServiceNames() Sequence< OUString > SAL_CALL ORichTextModel::getSupportedServiceNames()
{ {
Sequence< OUString > aOwnNames { static constexpr OUString aOwnNames[] {
FRM_SUN_COMPONENT_RICHTEXTCONTROL, FRM_SUN_COMPONENT_RICHTEXTCONTROL,
u"com.sun.star.text.TextRange"_ustr, u"com.sun.star.text.TextRange"_ustr,
u"com.sun.star.style.CharacterProperties"_ustr, u"com.sun.star.style.CharacterProperties"_ustr,

View file

@ -81,12 +81,8 @@ using namespace ::svxform;
FM_SUN_COMPONENT_IMAGECONTROL FM_SUN_COMPONENT_IMAGECONTROL
}; };
static const sal_uInt16 nSvxComponentServiceNameListCount = SAL_N_ELEMENTS(aSvxComponentServiceNameList);
auto aSeq( comphelper::arrayToSequence< OUString >(aSvxComponentServiceNameList, nSvxComponentServiceNameListCount) );
::com::sun::star::uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() ); ::com::sun::star::uno::Sequence< OUString > aParentSeq( SvxUnoDrawMSFactory::getAvailableServiceNames() );
return comphelper::concatSequences( aParentSeq, aSeq ); return comphelper::concatSequences(aParentSeq, aSvxComponentServiceNameList);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View file

@ -656,7 +656,7 @@ Sequence< OUString> SAL_CALL FormController::getSupportedServiceNames()
{ {
// service names which are supported only, but cannot be used to created an // service names which are supported only, but cannot be used to created an
// instance at a service factory // instance at a service factory
Sequence<OUString> aNonCreatableServiceNames { u"com.sun.star.form.FormControllerDispatcher"_ustr }; static constexpr OUString aNonCreatableServiceNames[] { u"com.sun.star.form.FormControllerDispatcher"_ustr };
// services which can be used to created an instance at a service factory // services which can be used to created an instance at a service factory
Sequence< OUString > aCreatableServiceNames( getSupportedServiceNames_Static() ); Sequence< OUString > aCreatableServiceNames( getSupportedServiceNames_Static() );

View file

@ -834,7 +834,7 @@ void SAL_CALL Cell::release() noexcept
Sequence< Type > SAL_CALL Cell::getTypes( ) Sequence< Type > SAL_CALL Cell::getTypes( )
{ {
return comphelper::concatSequences( SvxUnoTextBase::getTypes(), return comphelper::concatSequences( SvxUnoTextBase::getTypes(),
Sequence { std::initializer_list<Type>{
cppu::UnoType<XMergeableCell>::get(), cppu::UnoType<XMergeableCell>::get(),
cppu::UnoType<XLayoutConstrains>::get() }); cppu::UnoType<XLayoutConstrains>::get() });
} }

View file

@ -468,7 +468,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoDrawingModel::getAvailableServiceNames(
{ {
const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() ); const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() );
uno::Sequence< OUString > aSNS{ static constexpr OUString aSNS[] {
u"com.sun.star.drawing.DashTable"_ustr, u"com.sun.star.drawing.DashTable"_ustr,
u"com.sun.star.drawing.GradientTable"_ustr, u"com.sun.star.drawing.GradientTable"_ustr,
u"com.sun.star.drawing.HatchTable"_ustr, u"com.sun.star.drawing.HatchTable"_ustr,