diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-04-03 20:26:50 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-04-03 23:27:39 +0200 |
commit | 0ae1a6248434d60f2530fbf948cc302c987de1a5 (patch) | |
tree | ce15598d3fa5f6af80ecf998eb689c6361af1e38 /sfx2 | |
parent | simplify this a bit (diff) | |
download | core-0ae1a6248434d60f2530fbf948cc302c987de1a5.tar.gz core-0ae1a6248434d60f2530fbf948cc302c987de1a5.zip |
no need for pointers here
Change-Id: I0eca0d07d251949f99ebed44ef3267fa6dfb4c80
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/bastyp/helper.cxx | 56 |
1 files changed, 16 insertions, 40 deletions
diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index 4a6a39ce3660..7c026352e20a 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -58,8 +58,6 @@ using ::rtl::OUString; using ::rtl::OStringBuffer; using ::rtl::OStringToOUString; -typedef vector< OUString* > StringList_Impl; - #define CONVERT_DATETIME( aUnoDT, aToolsDT ) \ aToolsDT = DateTime( Date( aUnoDT.Day, aUnoDT.Month, aUnoDT.Year ), \ Time( aUnoDT.Hours, aUnoDT.Minutes, aUnoDT.Seconds, aUnoDT.HundredthSeconds ) ); @@ -79,7 +77,7 @@ void AppendDateTime_Impl( const util::DateTime rDT, uno::Sequence < OUString > SfxContentHelper::GetResultSet( const String& rURL ) { - StringList_Impl* pList = NULL; + vector<OUString> aList; try { ::ucbhelper::Content aCnt( rURL, uno::Reference< ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() ); @@ -109,7 +107,6 @@ uno::Sequence < OUString > SfxContentHelper::GetResultSet( const String& rURL ) if ( xResultSet.is() ) { - pList = new StringList_Impl(); uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); @@ -124,8 +121,7 @@ uno::Sequence < OUString > SfxContentHelper::GetResultSet( const String& rURL ) aRow += aType; aRow += '\t'; aRow += String( xContentAccess->queryContentIdentifierString() ); - OUString* pRow = new OUString( aRow ); - pList->push_back( pRow ); + aList.push_back( OUString( aRow ) ); } } catch( const ucb::CommandAbortedException& ) @@ -143,30 +139,21 @@ uno::Sequence < OUString > SfxContentHelper::GetResultSet( const String& rURL ) SAL_WARN( "sfx2.bastyp", "GetResultSet: Any other exception: " << e.Message ); } - if ( pList ) + size_t nCount = aList.size(); + uno::Sequence < OUString > aRet( nCount ); + OUString* pRet = aRet.getArray(); + for ( size_t i = 0; i < nCount; ++i ) { - size_t nCount = pList->size(); - uno::Sequence < OUString > aRet( nCount ); - OUString* pRet = aRet.getArray(); - for ( size_t i = 0; i < nCount; ++i ) - { - OUString* pEntry = pList->at(i); - pRet[i] = *( pEntry ); - delete pEntry; - } - pList->clear(); - delete pList; - return aRet; + pRet[i] = aList[0]; } - else - return uno::Sequence < OUString > (); + return aRet; } // ----------------------------------------------------------------------- uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const String& rURL ) { - StringList_Impl* pProperties = NULL; + vector< OUString > aProperties; try { uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); @@ -196,7 +183,6 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin if ( xResultSet.is() ) { - pProperties = new StringList_Impl(); uno::Reference< sdbc::XRow > xRow( xResultSet, uno::UNO_QUERY ); uno::Reference< ucb::XContentAccess > xContentAccess( xResultSet, uno::UNO_QUERY ); @@ -211,8 +197,7 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin aRow += String( xContentAccess->queryContentIdentifierString() ); aRow += '\t'; aRow += bFolder ? '1' : '0'; - OUString* pRow = new OUString( aRow ); - pProperties->push_back( pRow ); + aProperties.push_back( OUString( aRow ) ); } } catch( const ucb::CommandAbortedException& ) @@ -227,23 +212,14 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin { } - if ( pProperties ) + size_t nCount = aProperties.size(); + uno::Sequence < OUString > aRet( nCount ); + OUString* pRet = aRet.getArray(); + for(size_t i = 0; i < nCount; ++i) { - size_t nCount = pProperties->size(); - uno::Sequence < OUString > aRet( nCount ); - OUString* pRet = aRet.getArray(); - for ( size_t i = 0; i < nCount; ++i ) - { - OUString* pProperty = pProperties->at(i); - pRet[i] = *( pProperty ); - delete pProperty; - } - pProperties->clear(); - delete pProperties; - return aRet; + pRet[i] = aProperties[i]; } - else - return uno::Sequence < OUString > (); + return aRet; } // ----------------------------------------------------------------------- |