summaryrefslogtreecommitdiff
path: root/ucb/source
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-06-10 21:59:45 +0200
committerJulien Nabet <serval2412@yahoo.fr>2021-06-11 14:57:41 +0200
commita75596f3f8d3660bd96a107eb13a2ea210be5b66 (patch)
treeca2bad558f45f464c3ee8e53d533c83268ecc419 /ucb/source
parentf676b194faf2805529556c2f1da0578b58bf37de (diff)
Simplify Sequences initializations (ucb)
Change-Id: Idd38076a40b1177253719c01c1928da4c903151c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117017 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'ucb/source')
-rw-r--r--ucb/source/core/FileAccess.cxx17
-rw-r--r--ucb/source/core/provprox.cxx4
-rw-r--r--ucb/source/ucp/cmis/cmis_content.cxx46
-rw-r--r--ucb/source/ucp/file/bc.cxx37
-rw-r--r--ucb/source/ucp/file/filglob.cxx4
-rw-r--r--ucb/source/ucp/file/filinsreq.cxx4
-rw-r--r--ucb/source/ucp/file/filrset.cxx15
-rw-r--r--ucb/source/ucp/file/filtask.cxx32
-rw-r--r--ucb/source/ucp/ftp/ftpcontent.cxx18
-rw-r--r--ucb/source/ucp/ftp/ftpresultsetbase.cxx18
-rw-r--r--ucb/source/ucp/gio/gio_content.cxx32
11 files changed, 74 insertions, 153 deletions
diff --git a/ucb/source/core/FileAccess.cxx b/ucb/source/core/FileAccess.cxx
index c998318924ff..8e93248bd192 100644
--- a/ucb/source/core/FileAccess.cxx
+++ b/ucb/source/core/FileAccess.cxx
@@ -364,15 +364,10 @@ void OFileAccess::createFolder( const OUString& NewFolderURL )
if ( rProps[ 0 ].Name != "Title" )
continue;
- Sequence<OUString> aNames { "Title" };
- Sequence< Any > aValues(1);
- Any* pValues = aValues.getArray();
- pValues[0] <<= aTitle;
-
ucbhelper::Content aNew;
try
{
- if ( !aCnt.insertNewContent( rCurr.Type, aNames, aValues, aNew ) )
+ if ( !aCnt.insertNewContent( rCurr.Type, { "Title" }, { Any(aTitle) }, aNew ) )
continue;
// Success. We're done.
@@ -429,13 +424,12 @@ Sequence< OUString > OFileAccess::getFolderContents( const OUString& FolderURL,
ucbhelper::Content aCnt( aFolderObj.GetMainURL( INetURLObject::DecodeMechanism::NONE ), mxEnvironment, comphelper::getProcessComponentContext() );
Reference< XResultSet > xResultSet;
- Sequence< OUString > aProps(0);
ucbhelper::ResultSetInclude eInclude = bIncludeFolders ? ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS : ucbhelper::INCLUDE_DOCUMENTS_ONLY;
try
{
- xResultSet = aCnt.createCursor( aProps, eInclude );
+ xResultSet = aCnt.createCursor( {}, eInclude );
}
catch ( css::ucb::CommandFailedException const & )
{
@@ -598,16 +592,11 @@ bool OFileAccess::createNewFile( const OUString & rParentURL,
if ( rProps[ 0 ].Name != "Title" )
continue;
- Sequence<OUString> aNames { "Title" };
- Sequence< Any > aValues(1);
- Any* pValues = aValues.getArray();
- pValues[0] <<= rTitle;
-
try
{
ucbhelper::Content aNew;
if ( aParentCnt.insertNewContent(
- rCurr.Type, aNames, aValues, data, aNew ) )
+ rCurr.Type, { "Title" }, { Any(rTitle) }, data, aNew ) )
return true; // success.
else
continue;
diff --git a/ucb/source/core/provprox.cxx b/ucb/source/core/provprox.cxx
index 337a1d8f1c42..379b6e4887ed 100644
--- a/ucb/source/core/provprox.cxx
+++ b/ucb/source/core/provprox.cxx
@@ -306,9 +306,7 @@ UcbContentProviderProxy::getContentProvider()
{
Reference<XInitialization> xInit(m_xProvider,UNO_QUERY);
if(xInit.is()) {
- Sequence<Any> aArgs(1);
- aArgs[0] <<= m_aArguments;
- xInit->initialize(aArgs);
+ xInit->initialize({ Any(m_aArguments) });
}
}
}
diff --git a/ucb/source/ucp/cmis/cmis_content.cxx b/ucb/source/ucp/cmis/cmis_content.cxx
index e29afbf72ae5..aa7628199a8c 100644
--- a/ucb/source/ucp/cmis/cmis_content.cxx
+++ b/ucb/source/ucp/cmis/cmis_content.cxx
@@ -1969,28 +1969,32 @@ namespace cmis
{
if ( isFolder( xEnv ) )
{
- uno::Sequence< ucb::ContentInfo > seq(2);
// Minimum set of props we really need
- uno::Sequence< beans::Property > props( 1 );
- props[0] = beans::Property(
- "Title",
- -1,
- cppu::UnoType<OUString>::get(),
- beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND );
-
- // file
- seq[0].Type = CMIS_FILE_TYPE;
- seq[0].Attributes = ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
- ucb::ContentInfoAttribute::KIND_DOCUMENT );
- seq[0].Properties = props;
-
- // folder
- seq[1].Type = CMIS_FOLDER_TYPE;
- seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
- seq[1].Properties = props;
-
- return seq;
+ uno::Sequence< beans::Property > props
+ {
+ {
+ "Title",
+ -1,
+ cppu::UnoType<OUString>::get(),
+ beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND
+ }
+ };
+
+ return
+ {
+ {
+ CMIS_FILE_TYPE,
+ ( ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
+ ucb::ContentInfoAttribute::KIND_DOCUMENT ),
+ props
+ },
+ {
+ CMIS_FOLDER_TYPE,
+ ucb::ContentInfoAttribute::KIND_FOLDER,
+ props
+ }
+ };
}
}
catch (const uno::RuntimeException&)
@@ -2004,7 +2008,7 @@ namespace cmis
"wrapped Exception " + e.Message,
uno::Reference<uno::XInterface>(), a);
}
- return uno::Sequence< ucb::ContentInfo >();
+ return {};
}
std::vector< uno::Reference< ucb::XContent > > Content::getChildren( )
diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx
index e79d5ba2b0b9..07c3d846a35f 100644
--- a/ucb/source/ucp/file/bc.cxx
+++ b/ucb/source/ucp/file/bc.cxx
@@ -294,13 +294,7 @@ BaseContent::execute( const Command& aCommand,
}
else if ( aCommand.Name == "getCasePreservingURL" )
{
- Sequence< beans::Property > seq(1);
- seq[0] = beans::Property(
- "CasePreservingURL",
- -1,
- cppu::UnoType<sal_Bool>::get(),
- 0 );
- Reference< sdbc::XRow > xRow = getPropertyValues( CommandId,seq );
+ Reference< sdbc::XRow > xRow = getPropertyValues( CommandId, { { "CasePreservingURL", -1, cppu::UnoType<sal_Bool>::get(), 0 } });
OUString CasePreservingURL = xRow->getString(1);
if(!xRow->wasNull())
aAny <<= CasePreservingURL;
@@ -398,12 +392,7 @@ BaseContent::getContentType()
try
{
// Who am I ?
- Sequence< beans::Property > seq(1);
- seq[0] = beans::Property( "IsDocument",
- -1,
- cppu::UnoType<sal_Bool>::get(),
- 0 );
- Reference< sdbc::XRow > xRow = getPropertyValues( -1,seq );
+ Reference< sdbc::XRow > xRow = getPropertyValues( -1, { { "IsDocument", -1, cppu::UnoType<sal_Bool>::get(), 0 } });
bool IsDocument = xRow->getBoolean( 1 );
if ( !xRow->wasNull() )
@@ -516,12 +505,7 @@ BaseContent::createNewContent( const ContentInfo& Info )
try
{
- Sequence< beans::Property > seq(1);
- seq[0] = beans::Property( "IsDocument",
- -1,
- cppu::UnoType<sal_Bool>::get(),
- 0 );
- Reference< sdbc::XRow > xRow = getPropertyValues( -1,seq );
+ Reference< sdbc::XRow > xRow = getPropertyValues( -1, { { "IsDocument", -1, cppu::UnoType<sal_Bool>::get(), 0 } });
IsDocument = xRow->getBoolean( 1 );
if ( xRow->wasNull() )
@@ -946,12 +930,7 @@ BaseContent::transfer( sal_Int32 nMyCommandIdentifier,
NewTitle = srcUncPath.copy( 1 + srcUncPath.lastIndexOf( '/' ) );
// Is destination a document or a folder ?
- Sequence< beans::Property > seq(1);
- seq[0] = beans::Property( "IsDocument",
- -1,
- cppu::UnoType<sal_Bool>::get(),
- 0 );
- Reference< sdbc::XRow > xRow = getPropertyValues( nMyCommandIdentifier,seq );
+ Reference< sdbc::XRow > xRow = getPropertyValues( nMyCommandIdentifier,{ { "IsDocument", -1, cppu::UnoType<sal_Bool>::get(), 0 } } );
bool IsDocument = xRow->getBoolean( 1 );
if( xRow->wasNull() )
{ // Destination file type could not be determined
@@ -1012,13 +991,7 @@ void BaseContent::insert( sal_Int32 nMyCommandIdentifier,
// Inserting a document or a file?
bool bDocument = false;
- Sequence< beans::Property > seq(1);
- seq[0] = beans::Property( "IsDocument",
- -1,
- cppu::UnoType<sal_Bool>::get(),
- 0 );
-
- Reference< sdbc::XRow > xRow = getPropertyValues( -1,seq );
+ Reference< sdbc::XRow > xRow = getPropertyValues( -1, { { "IsDocument", -1, cppu::UnoType<sal_Bool>::get(), 0 } });
bool contentTypeSet = true; // is set to false, if contentType not set
try
diff --git a/ucb/source/ucp/file/filglob.cxx b/ucb/source/ucp/file/filglob.cxx
index 97e979a93edf..20c14da193bc 100644
--- a/ucb/source/ucp/file/filglob.cxx
+++ b/ucb/source/ucp/file/filglob.cxx
@@ -564,9 +564,7 @@ namespace fileaccess {
rtl_UriDecodeWithCharset,
RTL_TEXTENCODING_UTF8));
prop.Value <<= aClashingName;
- Sequence<Any> seq(1);
- seq[0] <<= prop;
- excep.Arguments = seq;
+ excep.Arguments = { Any(prop) };
excep.Classification = InteractionClassification_ERROR;
excep.Context = Reference<XInterface>( xComProc, UNO_QUERY );
excep.Message = "the name contained invalid characters";
diff --git a/ucb/source/ucp/file/filinsreq.cxx b/ucb/source/ucp/file/filinsreq.cxx
index 21a4b4c66d68..e64fbe807548 100644
--- a/ucb/source/ucp/file/filinsreq.cxx
+++ b/ucb/source/ucp/file/filinsreq.cxx
@@ -70,9 +70,7 @@ XInteractionRequestImpl::XInteractionRequestImpl(
prop.Name = "ResourceName";
prop.Handle = -1;
prop.Value <<= aClashingName;
- Sequence<Any> seq(1);
- seq[0] <<= prop;
- excep.Arguments = seq;
+ excep.Arguments = { Any(prop) };
excep.Classification = InteractionClassification_ERROR;
excep.Context = m_xOrigin;
excep.Message = "the name contained invalid characters";
diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx
index 5447af1433a9..716c9bbe4b89 100644
--- a/ucb/source/ucp/file/filrset.cxx
+++ b/ucb/source/ucp/file/filrset.cxx
@@ -615,16 +615,11 @@ uno::Reference< beans::XPropertySetInfo > SAL_CALL
XResultSet_impl::getPropertySetInfo()
{
- uno::Sequence< beans::Property > seq(2);
- seq[0].Name = "RowCount";
- seq[0].Handle = -1;
- seq[0].Type = cppu::UnoType<sal_Int32>::get();
- seq[0].Attributes = beans::PropertyAttribute::READONLY;
-
- seq[1].Name = "IsRowCountFinal";
- seq[1].Handle = -1;
- seq[1].Type = cppu::UnoType<sal_Bool>::get();
- seq[1].Attributes = beans::PropertyAttribute::READONLY;
+ uno::Sequence< beans::Property > seq
+ {
+ { "RowCount", -1, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::READONLY },
+ { "IsRowCountFinal", -1, cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::READONLY }
+ };
return new XPropertySetInfo_impl( m_pMyShell, seq );
}
diff --git a/ucb/source/ucp/file/filtask.cxx b/ucb/source/ucp/file/filtask.cxx
index 89e085773568..221f33c7c937 100644
--- a/ucb/source/ucp/file/filtask.cxx
+++ b/ucb/source/ucp/file/filtask.cxx
@@ -2901,27 +2901,17 @@ TaskManager::copyPersistentSet( const OUString& srcUnqPath,
uno::Sequence< ucb::ContentInfo > TaskManager::queryCreatableContentsInfo()
{
- uno::Sequence< ucb::ContentInfo > seq(2);
-
- // file
- seq[0].Type = FileContentType;
- seq[0].Attributes = ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
- | ucb::ContentInfoAttribute::KIND_DOCUMENT;
-
- uno::Sequence< beans::Property > props( 1 );
- props[0] = beans::Property(
- "Title",
- -1,
- cppu::UnoType<OUString>::get(),
- beans::PropertyAttribute::MAYBEVOID
- | beans::PropertyAttribute::BOUND );
- seq[0].Properties = props;
-
- // folder
- seq[1].Type = FolderContentType;
- seq[1].Attributes = ucb::ContentInfoAttribute::KIND_FOLDER;
- seq[1].Properties = props;
- return seq;
+
+
+ uno::Sequence< beans::Property > props
+ {
+ { "Title", -1, cppu::UnoType<OUString>::get(), beans::PropertyAttribute::MAYBEVOID | beans::PropertyAttribute::BOUND }
+ };
+ return
+ {
+ { FileContentType, ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM | ucb::ContentInfoAttribute::KIND_DOCUMENT, props },
+ { FolderContentType, ucb::ContentInfoAttribute::KIND_FOLDER, props }
+ };
}
/*******************************************************************************/
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index a1f4a6a21fba..ca38f16ae08c 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -571,11 +571,6 @@ FTPContent::queryCreatableContentsInfo( )
Sequence<ContentInfo >
FTPContent::queryCreatableContentsInfo_Static( )
{
- Sequence< ContentInfo > seq(2);
-
- seq[0].Type = FTP_FILE;
- seq[0].Attributes = ContentInfoAttribute::INSERT_WITH_INPUTSTREAM
- | ContentInfoAttribute::KIND_DOCUMENT;
Sequence< Property > props( 1 );
props[0] = Property(
"Title",
@@ -583,14 +578,11 @@ FTPContent::queryCreatableContentsInfo_Static( )
cppu::UnoType<OUString>::get(),
PropertyAttribute::MAYBEVOID
| PropertyAttribute::BOUND );
- seq[0].Properties = props;
-
- // folder
- seq[1].Type = FTP_FOLDER;
- seq[1].Attributes = ContentInfoAttribute::KIND_FOLDER;
- seq[1].Properties = props;
-
- return seq;
+ return
+ {
+ { FTP_FILE, ContentInfoAttribute::INSERT_WITH_INPUTSTREAM | ContentInfoAttribute::KIND_DOCUMENT, props },
+ { FTP_FOLDER, ContentInfoAttribute::KIND_FOLDER, props }
+ };
}
Reference<XContent > SAL_CALL
diff --git a/ucb/source/ucp/ftp/ftpresultsetbase.cxx b/ucb/source/ucp/ftp/ftpresultsetbase.cxx
index 05422549fa25..66af1c4a8479 100644
--- a/ucb/source/ucp/ftp/ftpresultsetbase.cxx
+++ b/ucb/source/ucp/ftp/ftpresultsetbase.cxx
@@ -398,18 +398,12 @@ private:
uno::Reference< beans::XPropertySetInfo > SAL_CALL
ResultSetBase::getPropertySetInfo()
{
- uno::Sequence< beans::Property > seq(2);
- seq[0].Name = "RowCount";
- seq[0].Handle = -1;
- seq[0].Type = cppu::UnoType<sal_Int32>::get();
- seq[0].Attributes = beans::PropertyAttribute::READONLY;
-
- seq[1].Name = "IsRowCountFinal";
- seq[1].Handle = -1;
- seq[1].Type = cppu::UnoType<sal_Bool>::get();
- seq[1].Attributes = beans::PropertyAttribute::READONLY;
-
- //t
+ uno::Sequence< beans::Property > seq
+ {
+ { "RowCount", -1, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::READONLY },
+ { "IsRowCountFinal", -1, cppu::UnoType<sal_Bool>::get(), beans::PropertyAttribute::READONLY }
+ };
+
return uno::Reference< beans::XPropertySetInfo > (
new XPropertySetInfoImpl( seq ) );
}
diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx
index 31907611e880..7278a7956361 100644
--- a/ucb/source/ucp/gio/gio_content.cxx
+++ b/ucb/source/ucp/gio/gio_content.cxx
@@ -1117,32 +1117,22 @@ css::uno::Sequence< css::ucb::ContentInfo > Content::queryCreatableContentsInfo(
{
if ( isFolder( xEnv ) )
{
- css::uno::Sequence< css::ucb::ContentInfo > seq(2);
// Minimum set of props we really need
- css::uno::Sequence< css::beans::Property > props( 1 );
- props[0] = css::beans::Property(
- "Title",
- -1,
- cppu::UnoType<OUString>::get(),
- css::beans::PropertyAttribute::MAYBEVOID | css::beans::PropertyAttribute::BOUND );
-
- // file
- seq[0].Type = GIO_FILE_TYPE;
- seq[0].Attributes = ( css::ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM |
- css::ucb::ContentInfoAttribute::KIND_DOCUMENT );
- seq[0].Properties = props;
-
- // folder
- seq[1].Type = GIO_FOLDER_TYPE;
- seq[1].Attributes = css::ucb::ContentInfoAttribute::KIND_FOLDER;
- seq[1].Properties = props;
-
- return seq;
+ css::uno::Sequence< css::beans::Property > props
+ {
+ { "Title", -1, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEVOID | css::beans::PropertyAttribute::BOUND }
+ };
+
+ return
+ {
+ { GIO_FILE_TYPE, ( css::ucb::ContentInfoAttribute::INSERT_WITH_INPUTSTREAM | css::ucb::ContentInfoAttribute::KIND_DOCUMENT ), props },
+ { GIO_FOLDER_TYPE, css::ucb::ContentInfoAttribute::KIND_FOLDER, props }
+ };
}
else
{
- return css::uno::Sequence< css::ucb::ContentInfo >();
+ return {};
}
}