Drop char*-based API from NamedValueCollection

Change-Id: I87f339b348580e256a8d65470ad15cbdabf2c9dd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124609
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski
2021-11-02 18:55:59 +03:00
parent b0e574a8be
commit c9b100df77
12 changed files with 75 additions and 140 deletions

View File

@@ -107,7 +107,7 @@ namespace dbtools
} }
bool lcl_getDriverSetting( const char* _asciiName, const DatabaseMetaData_Impl& _metaData, Any& _out_setting ) bool lcl_getDriverSetting( const OUString& _asciiName, const DatabaseMetaData_Impl& _metaData, Any& _out_setting )
{ {
lcl_checkConnected( _metaData ); lcl_checkConnected( _metaData );
const ::comphelper::NamedValueCollection& rDriverMetaData = _metaData.aDriverConfig.getMetaData( _metaData.xConnectionMetaData->getURL() ); const ::comphelper::NamedValueCollection& rDriverMetaData = _metaData.aDriverConfig.getMetaData( _metaData.xConnectionMetaData->getURL() );
@@ -118,7 +118,7 @@ namespace dbtools
} }
bool lcl_getConnectionSetting( const char* _asciiName, const DatabaseMetaData_Impl& _metaData, Any& _out_setting ) bool lcl_getConnectionSetting(const OUString& _asciiName, const DatabaseMetaData_Impl& _metaData, Any& _out_setting )
{ {
try try
{ {
@@ -130,7 +130,7 @@ namespace dbtools
xDataSource->getPropertyValue("Settings"), xDataSource->getPropertyValue("Settings"),
UNO_QUERY_THROW ); UNO_QUERY_THROW );
_out_setting = xDataSourceSettings->getPropertyValue( OUString::createFromAscii( _asciiName ) ); _out_setting = xDataSourceSettings->getPropertyValue( _asciiName );
} }
else else
{ {

View File

@@ -1441,16 +1441,14 @@ void ODocumentDefinition::separateOpenCommandArguments( const Sequence< Property
{ {
::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments ); ::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments );
const char* const pObjectDescriptorArgs[] = static const std::u16string_view sObjectDescriptorArgs[] = { u"RecoveryStorage" };
for (const auto& rObjectDescriptorArg : sObjectDescriptorArgs)
{ {
"RecoveryStorage" const OUString sObjectDescriptorArg(rObjectDescriptorArg);
}; if ( aOpenCommandArguments.has( sObjectDescriptorArg ) )
for (const char* pObjectDescriptorArg : pObjectDescriptorArgs)
{
if ( aOpenCommandArguments.has( pObjectDescriptorArg ) )
{ {
o_rEmbeddedObjectDescriptor.put( pObjectDescriptorArg, aOpenCommandArguments.get( pObjectDescriptorArg ) ); o_rEmbeddedObjectDescriptor.put( sObjectDescriptorArg, aOpenCommandArguments.get( sObjectDescriptorArg ) );
aOpenCommandArguments.remove( pObjectDescriptorArg ); aOpenCommandArguments.remove( sObjectDescriptorArg );
} }
} }

View File

@@ -138,8 +138,8 @@ OUString SAL_CALL DBTypeDetection::detect( css::uno::Sequence< css::beans::Prope
{ {
// After fixing of the i88522 issue ( use the new file locking for database files ) the stream from the type detection can be used further // After fixing of the i88522 issue ( use the new file locking for database files ) the stream from the type detection can be used further
// for now the file should be reopened to have read/write access // for now the file should be reopened to have read/write access
aMedia.remove( OUString( "InputStream" ) ); aMedia.remove( "InputStream" );
aMedia.remove( OUString( "Stream" ) ); aMedia.remove( "Stream" );
aMedia >>= Descriptor; aMedia >>= Descriptor;
try try
{ {
@@ -374,7 +374,7 @@ void SAL_CALL DBContentLoader::load(const Reference< XFrame > & rFrame, const OU
else else
{ {
::comphelper::NamedValueCollection aCreationArgs; ::comphelper::NamedValueCollection aCreationArgs;
aCreationArgs.put( OUString(INFO_POOLURL), sSalvagedURL ); aCreationArgs.put( INFO_POOLURL, sSalvagedURL );
xDocumentDataSource.set( xDatabaseContext->createInstanceWithArguments( aCreationArgs.getWrappedNamedValues() ), UNO_QUERY_THROW ); xDocumentDataSource.set( xDatabaseContext->createInstanceWithArguments( aCreationArgs.getWrappedNamedValues() ), UNO_QUERY_THROW );
} }

View File

@@ -1170,7 +1170,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
eType = E_QUERY; eType = E_QUERY;
break; break;
case ID_NEW_QUERY_DESIGN: case ID_NEW_QUERY_DESIGN:
aCreationArgs.put( OUString(PROPERTY_GRAPHICAL_DESIGN), true ); aCreationArgs.put( PROPERTY_GRAPHICAL_DESIGN, true );
[[fallthrough]]; [[fallthrough]];
case ID_NEW_QUERY_SQL: case ID_NEW_QUERY_SQL:
eType = E_QUERY; eType = E_QUERY;
@@ -1208,7 +1208,7 @@ void OApplicationController::Execute(sal_uInt16 _nId, const Sequence< PropertyVa
QueryDesigner aDesigner( getORB(), this, getFrame(), true ); QueryDesigner aDesigner( getORB(), this, getFrame(), true );
::comphelper::NamedValueCollection aCreationArgs; ::comphelper::NamedValueCollection aCreationArgs;
aCreationArgs.put( OUString(PROPERTY_GRAPHICAL_DESIGN), ID_NEW_VIEW_DESIGN == _nId ); aCreationArgs.put( PROPERTY_GRAPHICAL_DESIGN, ID_NEW_VIEW_DESIGN == _nId );
const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY ); const Reference< XDataSource > xDataSource( m_xDataSource, UNO_QUERY );
const Reference< XComponent > xComponent = aDesigner.createNew( xDataSource, aCreationArgs ); const Reference< XComponent > xComponent = aDesigner.createNew( xDataSource, aCreationArgs );
@@ -1821,7 +1821,7 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
if ( bAddViewTypeArg ) if ( bAddViewTypeArg )
{ {
const bool bQueryGraphicalMode =( _nInstigatorCommand != SID_DB_APP_EDIT_SQL_VIEW ); const bool bQueryGraphicalMode =( _nInstigatorCommand != SID_DB_APP_EDIT_SQL_VIEW );
aArguments.put( OUString(PROPERTY_GRAPHICAL_DESIGN), bQueryGraphicalMode ); aArguments.put( PROPERTY_GRAPHICAL_DESIGN, bQueryGraphicalMode );
} }
} }
@@ -1829,8 +1829,8 @@ Reference< XComponent > OApplicationController::openElementWithArguments( const
{ {
pDesigner.reset( new ResultSetBrowser( getORB(), this, m_aCurrentFrame.getFrame(), _eType == E_TABLE ) ); pDesigner.reset( new ResultSetBrowser( getORB(), this, m_aCurrentFrame.getFrame(), _eType == E_TABLE ) );
if ( !aArguments.has( OUString(PROPERTY_SHOWMENU) ) ) if ( !aArguments.has( PROPERTY_SHOWMENU ) )
aArguments.put( OUString(PROPERTY_SHOWMENU), makeAny( true ) ); aArguments.put( PROPERTY_SHOWMENU, makeAny( true ) );
aDataSource <<= getDatabaseName(); aDataSource <<= getDatabaseName();
} }
@@ -2622,7 +2622,7 @@ sal_Bool SAL_CALL OApplicationController::attachModel(const Reference< XModel >
{ {
// to get the 'modified' for the data source // to get the 'modified' for the data source
::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) ); ::comphelper::NamedValueCollection aLayoutInfo( m_xDataSource->getPropertyValue( PROPERTY_LAYOUTINFORMATION ) );
if ( aLayoutInfo.has( OUString(INFO_PREVIEW) ) ) if ( aLayoutInfo.has( INFO_PREVIEW ) )
{ {
const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) ); const sal_Int32 nPreviewMode( aLayoutInfo.getOrDefault( INFO_PREVIEW, sal_Int32(0) ) );
m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode ); m_ePreviewMode = static_cast< PreviewMode >( nPreviewMode );

View File

@@ -1043,7 +1043,7 @@ void OAppDetailPageHelper::showPreview( const OUString& _sDataSourceName,
aArgs.put( "Preview", true ); aArgs.put( "Preview", true );
aArgs.put( "ReadOnly", true ); aArgs.put( "ReadOnly", true );
aArgs.put( "AsTemplate", false ); aArgs.put( "AsTemplate", false );
aArgs.put( OUString(PROPERTY_SHOWMENU), false ); aArgs.put( PROPERTY_SHOWMENU, false );
Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY ); Reference< XController > xPreview( pDispatcher->openExisting( makeAny( _sDataSourceName ), _sName, aArgs ), UNO_QUERY );
bool bClearPreview = !xPreview.is(); bool bClearPreview = !xPreview.is();

View File

@@ -146,14 +146,14 @@ namespace dbaui
Reference<XDataSource> xDataSource; Reference<XDataSource> xDataSource;
if ( _aDataSource >>= sDataSource ) if ( _aDataSource >>= sDataSource )
{ {
i_rDispatchArgs.put( OUString(PROPERTY_DATASOURCENAME), sDataSource ); i_rDispatchArgs.put( PROPERTY_DATASOURCENAME, sDataSource );
} }
else if ( _aDataSource >>= xDataSource ) else if ( _aDataSource >>= xDataSource )
{ {
i_rDispatchArgs.put( OUString(PROPERTY_DATASOURCE), xDataSource ); i_rDispatchArgs.put( PROPERTY_DATASOURCE, xDataSource );
} }
i_rDispatchArgs.put( OUString(PROPERTY_ACTIVE_CONNECTION), getConnection() ); i_rDispatchArgs.put( PROPERTY_ACTIVE_CONNECTION, getConnection() );
} }
// QueryDesigner // QueryDesigner
@@ -173,16 +173,16 @@ namespace dbaui
const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( PROPERTY_GRAPHICAL_DESIGN, true ); const bool bGraphicalDesign = i_rDispatchArgs.getOrDefault( PROPERTY_GRAPHICAL_DESIGN, true );
const bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && !bGraphicalDesign; const bool bEditViewAsSQLCommand = ( m_nCommandType == CommandType::TABLE ) && !bGraphicalDesign;
i_rDispatchArgs.put( OUString(PROPERTY_COMMAND_TYPE), m_nCommandType ); i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, m_nCommandType );
if ( bIncludeQueryName ) if ( bIncludeQueryName )
{ {
i_rDispatchArgs.put( OUString(PROPERTY_COMMAND), _rObjectName ); i_rDispatchArgs.put( PROPERTY_COMMAND, _rObjectName );
} }
if ( bEditViewAsSQLCommand ) if ( bEditViewAsSQLCommand )
{ {
i_rDispatchArgs.put( OUString(PROPERTY_ESCAPE_PROCESSING), false ); i_rDispatchArgs.put( PROPERTY_ESCAPE_PROCESSING, false );
} }
} }
@@ -199,7 +199,7 @@ namespace dbaui
if ( !_rObjectName.isEmpty() ) if ( !_rObjectName.isEmpty() )
{ {
i_rDispatchArgs.put( OUString(PROPERTY_CURRENTTABLE), _rObjectName ); i_rDispatchArgs.put( PROPERTY_CURRENTTABLE, _rObjectName );
} }
} }
@@ -258,15 +258,15 @@ namespace dbaui
if ( m_bTable ) if ( m_bTable )
::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::EComposeRule::InDataManipulation ); ::dbtools::qualifiedNameComponents( getConnection()->getMetaData(), _rQualifiedName, sCatalog, sSchema, sTable, ::dbtools::EComposeRule::InDataManipulation );
i_rDispatchArgs.put( OUString(PROPERTY_COMMAND_TYPE), (m_bTable ? CommandType::TABLE : CommandType::QUERY) ); i_rDispatchArgs.put( PROPERTY_COMMAND_TYPE, (m_bTable ? CommandType::TABLE : CommandType::QUERY) );
i_rDispatchArgs.put( OUString(PROPERTY_COMMAND), _rQualifiedName ); i_rDispatchArgs.put( PROPERTY_COMMAND, _rQualifiedName );
i_rDispatchArgs.put( OUString(PROPERTY_ENABLE_BROWSER), false ); i_rDispatchArgs.put( PROPERTY_ENABLE_BROWSER, false );
if ( m_bTable ) if ( m_bTable )
{ {
i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_CATALOGNAME), sCatalog ); i_rDispatchArgs.put( PROPERTY_UPDATE_CATALOGNAME, sCatalog );
i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_SCHEMANAME), sSchema ); i_rDispatchArgs.put( PROPERTY_UPDATE_SCHEMANAME, sSchema );
i_rDispatchArgs.put( OUString(PROPERTY_UPDATE_TABLENAME), sTable ); i_rDispatchArgs.put( PROPERTY_UPDATE_TABLENAME, sTable );
} }
} }

View File

@@ -53,39 +53,33 @@ namespace dbaui
{ {
/// one of the items from dsitems.hxx /// one of the items from dsitems.hxx
ItemID nItemID; ItemID nItemID;
const char* pAsciiFeatureName; OUString pAsciiFeatureName;
}; };
}
// global tables // global tables
static const FeatureMapping* lcl_getFeatureMappings() const FeatureMapping s_aMappings[] = {
{ { DSID_AUTORETRIEVEENABLED, "GeneratedValues" },
static const FeatureMapping s_aMappings[] = { { DSID_AUTOINCREMENTVALUE, "GeneratedValues" },
{ DSID_AUTORETRIEVEENABLED, "GeneratedValues" }, { DSID_AUTORETRIEVEVALUE, "GeneratedValues" },
{ DSID_AUTOINCREMENTVALUE, "GeneratedValues" }, { DSID_SQL92CHECK, "UseSQL92NamingConstraints" },
{ DSID_AUTORETRIEVEVALUE, "GeneratedValues" }, { DSID_APPEND_TABLE_ALIAS, "AppendTableAliasInSelect" },
{ DSID_SQL92CHECK, "UseSQL92NamingConstraints" }, { DSID_AS_BEFORE_CORRNAME, "UseKeywordAsBeforeAlias" },
{ DSID_APPEND_TABLE_ALIAS, "AppendTableAliasInSelect" }, { DSID_ENABLEOUTERJOIN, "UseBracketedOuterJoinSyntax" },
{ DSID_AS_BEFORE_CORRNAME, "UseKeywordAsBeforeAlias" }, { DSID_IGNOREDRIVER_PRIV, "IgnoreDriverPrivileges" },
{ DSID_ENABLEOUTERJOIN, "UseBracketedOuterJoinSyntax" }, { DSID_PARAMETERNAMESUBST, "ParameterNameSubstitution" },
{ DSID_IGNOREDRIVER_PRIV, "IgnoreDriverPrivileges" }, { DSID_SUPPRESSVERSIONCL, "DisplayVersionColumns" },
{ DSID_PARAMETERNAMESUBST, "ParameterNameSubstitution" }, { DSID_CATALOG, "UseCatalogInSelect" },
{ DSID_SUPPRESSVERSIONCL, "DisplayVersionColumns" }, { DSID_SCHEMA, "UseSchemaInSelect" },
{ DSID_CATALOG, "UseCatalogInSelect" }, { DSID_INDEXAPPENDIX, "UseIndexDirectionKeyword" },
{ DSID_SCHEMA, "UseSchemaInSelect" }, { DSID_DOSLINEENDS, "UseDOSLineEnds" },
{ DSID_INDEXAPPENDIX, "UseIndexDirectionKeyword" }, { DSID_BOOLEANCOMPARISON, "BooleanComparisonMode" },
{ DSID_DOSLINEENDS, "UseDOSLineEnds" }, { DSID_CHECK_REQUIRED_FIELDS, "FormsCheckRequiredFields" },
{ DSID_BOOLEANCOMPARISON, "BooleanComparisonMode" }, { DSID_IGNORECURRENCY, "IgnoreCurrency" },
{ DSID_CHECK_REQUIRED_FIELDS, "FormsCheckRequiredFields" }, { DSID_ESCAPE_DATETIME, "EscapeDateTime" },
{ DSID_IGNORECURRENCY, "IgnoreCurrency" }, { DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" },
{ DSID_ESCAPE_DATETIME, "EscapeDateTime" }, { DSID_RESPECTRESULTSETTYPE, "RespectDriverResultSetType" },
{ DSID_PRIMARY_KEY_SUPPORT, "PrimaryKeySupport" }, { DSID_MAX_ROW_SCAN, "MaxRowScan" },
{ DSID_RESPECTRESULTSETTYPE, "RespectDriverResultSetType" }, };
{ DSID_MAX_ROW_SCAN, "MaxRowScan" },
{ 0, nullptr }
};
return s_aMappings;
} }
static const FeatureSet& lcl_getFeatureSet( const OUString& _rURL ) static const FeatureSet& lcl_getFeatureSet( const OUString& _rURL )
@@ -101,12 +95,10 @@ namespace dbaui
FeatureSet aCurrentSet; FeatureSet aCurrentSet;
const ::comphelper::NamedValueCollection aCurrentFeatures( aDriverConfig.getFeatures( pattern ).getNamedValues() ); const ::comphelper::NamedValueCollection aCurrentFeatures( aDriverConfig.getFeatures( pattern ).getNamedValues() );
const FeatureMapping* pFeatureMapping = lcl_getFeatureMappings(); for ( const FeatureMapping& rFeatureMapping : s_aMappings )
while ( pFeatureMapping->pAsciiFeatureName )
{ {
if ( aCurrentFeatures.has( pFeatureMapping->pAsciiFeatureName ) ) if ( aCurrentFeatures.has( rFeatureMapping.pAsciiFeatureName ) )
aCurrentSet.put( pFeatureMapping->nItemID ); aCurrentSet.put( rFeatureMapping.nItemID );
++pFeatureMapping;
} }
tmp[ pattern ] = aCurrentSet; tmp[ pattern ] = aCurrentSet;

View File

@@ -135,7 +135,7 @@ namespace dbaui
} }
aArguments.put( "OpenMode", sOpenMode ); aArguments.put( "OpenMode", sOpenMode );
aArguments.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection ); aArguments.put( PROPERTY_ACTIVE_CONNECTION, m_xConnection );
Reference<XHierarchicalNameContainer> xHier(m_xDocumentContainer,UNO_QUERY); Reference<XHierarchicalNameContainer> xHier(m_xDocumentContainer,UNO_QUERY);
if ( xHier.is() && xHier->hasByHierarchicalName(_rLinkName) ) if ( xHier.is() && xHier->hasByHierarchicalName(_rLinkName) )
@@ -251,7 +251,7 @@ namespace dbaui
::comphelper::NamedValueCollection aCreationArgs( i_rCreationArgs ); ::comphelper::NamedValueCollection aCreationArgs( i_rCreationArgs );
if ( aClassId.hasElements() ) if ( aClassId.hasElements() )
aCreationArgs.put( "ClassID", aClassId ); aCreationArgs.put( "ClassID", aClassId );
aCreationArgs.put( OUString(PROPERTY_ACTIVE_CONNECTION), m_xConnection ); aCreationArgs.put( PROPERTY_ACTIVE_CONNECTION, m_xConnection );
// separate values which are real creation args from args relevant for opening the doc // separate values which are real creation args from args relevant for opening the doc
::comphelper::NamedValueCollection aCommandArgs; ::comphelper::NamedValueCollection aCommandArgs;

View File

@@ -245,7 +245,7 @@ void SAL_CALL OQueryController::getFastPropertyValue( Any& o_rValue, sal_Int32 i
{ {
::comphelper::NamedValueCollection aCurrentDesign; ::comphelper::NamedValueCollection aCurrentDesign;
aCurrentDesign.put( "GraphicalDesign", isGraphicalDesign() ); aCurrentDesign.put( "GraphicalDesign", isGraphicalDesign() );
aCurrentDesign.put( OUString(PROPERTY_ESCAPE_PROCESSING), m_bEscapeProcessing ); aCurrentDesign.put( PROPERTY_ESCAPE_PROCESSING, m_bEscapeProcessing );
if ( isGraphicalDesign() ) if ( isGraphicalDesign() )
{ {
@@ -735,11 +735,11 @@ void OQueryController::impl_initialize()
if ( aCurrentQueryDesignProps.hasElements() ) if ( aCurrentQueryDesignProps.hasElements() )
{ {
::comphelper::NamedValueCollection aCurrentQueryDesign( aCurrentQueryDesignProps ); ::comphelper::NamedValueCollection aCurrentQueryDesign( aCurrentQueryDesignProps );
if ( aCurrentQueryDesign.has( OUString(PROPERTY_GRAPHICAL_DESIGN) ) ) if ( aCurrentQueryDesign.has( PROPERTY_GRAPHICAL_DESIGN ) )
{ {
aCurrentQueryDesign.get_ensureType( PROPERTY_GRAPHICAL_DESIGN, m_bGraphicalDesign ); aCurrentQueryDesign.get_ensureType( PROPERTY_GRAPHICAL_DESIGN, m_bGraphicalDesign );
} }
if ( aCurrentQueryDesign.has( OUString(PROPERTY_ESCAPE_PROCESSING) ) ) if ( aCurrentQueryDesign.has( PROPERTY_ESCAPE_PROCESSING ) )
{ {
aCurrentQueryDesign.get_ensureType( PROPERTY_ESCAPE_PROCESSING, m_bEscapeProcessing ); aCurrentQueryDesign.get_ensureType( PROPERTY_ESCAPE_PROCESSING, m_bEscapeProcessing );
} }

View File

@@ -141,26 +141,14 @@ namespace comphelper
_out_rValue. _out_rValue.
*/ */
template < typename VALUE_TYPE > template < typename VALUE_TYPE >
bool get_ensureType( const char* _pAsciiValueName, VALUE_TYPE& _out_rValue ) const bool get_ensureType( const OUString& _rValueName, VALUE_TYPE& _out_rValue ) const
{ {
return get_ensureType( OUString::createFromAscii( _pAsciiValueName ), &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() ); return get_ensureType( _rValueName, &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() );
}
template < typename VALUE_TYPE >
void get_ensureType( const OUString& _rValueName, VALUE_TYPE& _out_rValue ) const
{
get_ensureType( _rValueName, &_out_rValue, ::cppu::UnoType< VALUE_TYPE >::get() );
} }
/** retrieves a value with a given name, or defaults it to a given value, if it's not present /** retrieves a value with a given name, or defaults it to a given value, if it's not present
in the collection in the collection
*/ */
template < typename VALUE_TYPE >
VALUE_TYPE getOrDefault( const char* _pAsciiValueName, const VALUE_TYPE& _rDefault ) const
{
return getOrDefault( OUString::createFromAscii( _pAsciiValueName ), _rDefault );
}
template < typename VALUE_TYPE > template < typename VALUE_TYPE >
VALUE_TYPE getOrDefault( const OUString& _rValueName, const VALUE_TYPE& _rDefault ) const VALUE_TYPE getOrDefault( const OUString& _rValueName, const VALUE_TYPE& _rDefault ) const
{ {
@@ -169,16 +157,6 @@ namespace comphelper
return retVal; return retVal;
} }
/** retrieves a (untyped) value with a given name
If the collection does not contain a value with the given name, an empty
Any is returned.
*/
const css::uno::Any& get( const char* _pAsciiValueName ) const
{
return get( OUString::createFromAscii( _pAsciiValueName ) );
}
/** retrieves a (untyped) value with a given name /** retrieves a (untyped) value with a given name
If the collection does not contain a value with the given name, an empty If the collection does not contain a value with the given name, an empty
@@ -189,29 +167,12 @@ namespace comphelper
return impl_get( _rValueName ); return impl_get( _rValueName );
} }
/// determines whether a value with a given name is present in the collection
bool has( const char* _pAsciiValueName ) const
{
return impl_has( OUString::createFromAscii( _pAsciiValueName ) );
}
/// determines whether a value with a given name is present in the collection /// determines whether a value with a given name is present in the collection
bool has( const OUString& _rValueName ) const bool has( const OUString& _rValueName ) const
{ {
return impl_has( _rValueName ); return impl_has( _rValueName );
} }
/** puts a value into the collection
@return true if and only if a value was already present previously, in
which case it has been overwritten.
*/
template < typename VALUE_TYPE >
bool put( const char* _pAsciiValueName, const VALUE_TYPE& _rValue )
{
return impl_put( OUString::createFromAscii( _pAsciiValueName ), css::uno::makeAny( _rValue ) );
}
/** puts a value into the collection /** puts a value into the collection
@return true if and only if a value was already present previously, in @return true if and only if a value was already present previously, in
@@ -223,25 +184,11 @@ namespace comphelper
return impl_put( _rValueName, css::uno::makeAny( _rValue ) ); return impl_put( _rValueName, css::uno::makeAny( _rValue ) );
} }
bool put( const char* _pAsciiValueName, const css::uno::Any& _rValue )
{
return impl_put( OUString::createFromAscii( _pAsciiValueName ), _rValue );
}
bool put( const OUString& _rValueName, const css::uno::Any& _rValue ) bool put( const OUString& _rValueName, const css::uno::Any& _rValue )
{ {
return impl_put( _rValueName, _rValue ); return impl_put( _rValueName, _rValue );
} }
/** removes the value with the given name from the collection
@return true if and only if a value with the given name existed in the collection.
*/
bool remove( const char* _pAsciiValueName )
{
return impl_remove( OUString::createFromAscii( _pAsciiValueName ) );
}
/** removes the value with the given name from the collection /** removes the value with the given name from the collection
@return true if and only if a value with the given name existed in the collection. @return true if and only if a value with the given name existed in the collection.

View File

@@ -539,7 +539,7 @@ namespace
template< class ATTRIBUTE_TYPE > template< class ATTRIBUTE_TYPE >
void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const char* _pAttributeName, void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const OUString& _pAttributeName,
const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat, const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
void (SAL_CALL report::XReportControlFormat::*pSetter)( ATTRIBUTE_TYPE ) ) void (SAL_CALL report::XReportControlFormat::*pSetter)( ATTRIBUTE_TYPE ) )
{ {
@@ -549,7 +549,7 @@ namespace
} }
void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const char* _pAttributeName, void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const OUString& _pAttributeName,
const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat, const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
void (SAL_CALL report::XReportControlFormat::*pSetter)( const OUString& ) ) void (SAL_CALL report::XReportControlFormat::*pSetter)( const OUString& ) )
{ {
@@ -559,7 +559,7 @@ namespace
} }
void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const char* _pAttributeName, void lcl_applyFontAttribute( const ::comphelper::NamedValueCollection& _rAttrValues, const OUString& _pAttributeName,
const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat, const uno::Reference<report::XReportControlFormat >& _rxReportControlFormat,
void (SAL_CALL report::XReportControlFormat::*pSetter)( const lang::Locale& ) ) void (SAL_CALL report::XReportControlFormat::*pSetter)( const lang::Locale& ) )
{ {

View File

@@ -501,18 +501,16 @@ void SfxFrameLoader_Impl::impl_removeLoaderArguments( ::comphelper::NamedValueCo
::comphelper::NamedValueCollection SfxFrameLoader_Impl::impl_extractViewCreationArgs( ::comphelper::NamedValueCollection& io_rDescriptor ) ::comphelper::NamedValueCollection SfxFrameLoader_Impl::impl_extractViewCreationArgs( ::comphelper::NamedValueCollection& io_rDescriptor )
{ {
static const char* pKnownViewArgs[] = { static const std::u16string_view sKnownViewArgs[] = { u"JumpMark", u"PickListEntry" };
"JumpMark",
"PickListEntry"
};
::comphelper::NamedValueCollection aViewArgs; ::comphelper::NamedValueCollection aViewArgs;
for (const char* pKnownViewArg : pKnownViewArgs) for (const auto& rKnownViewArg : sKnownViewArgs)
{ {
if ( io_rDescriptor.has( pKnownViewArg ) ) const OUString sKnownViewArg(rKnownViewArg);
if ( io_rDescriptor.has( sKnownViewArg ) )
{ {
aViewArgs.put( pKnownViewArg, io_rDescriptor.get( pKnownViewArg ) ); aViewArgs.put( sKnownViewArg, io_rDescriptor.get( sKnownViewArg ) );
io_rDescriptor.remove( pKnownViewArg ); io_rDescriptor.remove( sKnownViewArg );
} }
} }
return aViewArgs; return aViewArgs;