Replace deprecated std::auto_ptr with boost::scoped_ptr

Change-Id: Iafdebacd43ed24a30fb8e2d041fe975a1adbcfa0
This commit is contained in:
Takeshi Abe
2014-02-20 11:02:54 +09:00
parent 22b709e84a
commit c92753e395
7 changed files with 22 additions and 36 deletions

View File

@@ -30,7 +30,7 @@
#include <comphelper/logging.hxx> #include <comphelper/logging.hxx>
#include <memory> #include <boost/scoped_ptr.hpp>
using namespace connectivity; using namespace connectivity;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
@@ -172,14 +172,14 @@ namespace
if ( _pEnvironment->IsInstanceOf( jThrow, java_sql_SQLException_BASE::st_getMyClass() ) ) if ( _pEnvironment->IsInstanceOf( jThrow, java_sql_SQLException_BASE::st_getMyClass() ) )
{ {
::std::auto_ptr< java_sql_SQLException_BASE > pException( new java_sql_SQLException_BASE( _pEnvironment, jThrow ) ); boost::scoped_ptr< java_sql_SQLException_BASE > pException( new java_sql_SQLException_BASE( _pEnvironment, jThrow ) );
_out_rException = SQLException( pException->getMessage(), _rxContext, _out_rException = SQLException( pException->getMessage(), _rxContext,
pException->getSQLState(), pException->getErrorCode(), Any() ); pException->getSQLState(), pException->getErrorCode(), Any() );
return true; return true;
} }
else if ( _pEnvironment->IsInstanceOf( jThrow, java_lang_Throwable::st_getMyClass() ) ) else if ( _pEnvironment->IsInstanceOf( jThrow, java_lang_Throwable::st_getMyClass() ) )
{ {
::std::auto_ptr< java_lang_Throwable > pThrow( new java_lang_Throwable( _pEnvironment, jThrow ) ); boost::scoped_ptr< java_lang_Throwable > pThrow( new java_lang_Throwable( _pEnvironment, jThrow ) );
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
pThrow->printStackTrace(); pThrow->printStackTrace();
#endif #endif

View File

@@ -55,7 +55,7 @@
#include <unotools/configmgr.hxx> #include <unotools/configmgr.hxx>
#include <unotools/sharedunocomponent.hxx> #include <unotools/sharedunocomponent.hxx>
#include <memory> #include <boost/scoped_ptr.hpp>
using namespace ::dbaccess; using namespace ::dbaccess;
using namespace ::dbtools; using namespace ::dbtools;
@@ -676,9 +676,7 @@ void OSingleSelectQueryComposer::setSingleAdditiveClause( SQLPart _ePart, const
aClauses.push_back( getSQLPart( eLoopParts, m_aSqlIterator, sal_True ) ); aClauses.push_back( getSQLPart( eLoopParts, m_aSqlIterator, sal_True ) );
// overwrite the one part in question here // overwrite the one part in question here
SAL_WNODEPRECATED_DECLARATIONS_PUSH boost::scoped_ptr< TokenComposer > pComposer;
::std::auto_ptr< TokenComposer > pComposer;
SAL_WNODEPRECATED_DECLARATIONS_POP
if ( ( _ePart == Where ) || ( _ePart == Having ) ) if ( ( _ePart == Where ) || ( _ePart == Having ) )
pComposer.reset( new FilterCreator ); pComposer.reset( new FilterCreator );
else else
@@ -816,9 +814,7 @@ Reference< XNameAccess > SAL_CALL OSingleSelectQueryComposer::getColumns( ) thr
OUString sSQL( aSQL.makeStringAndClear() ); OUString sSQL( aSQL.makeStringAndClear() );
// normalize the statement so that it doesn't contain any application-level features anymore // normalize the statement so that it doesn't contain any application-level features anymore
OUString sError; OUString sError;
SAL_WNODEPRECATED_DECLARATIONS_PUSH const boost::scoped_ptr< OSQLParseNode > pStatementTree( m_aSqlParser.parseTree( sError, sSQL, false ) );
const ::std::auto_ptr< OSQLParseNode > pStatementTree( m_aSqlParser.parseTree( sError, sSQL, false ) );
SAL_WNODEPRECATED_DECLARATIONS_POP
OSL_ENSURE( pStatementTree.get(), "OSingleSelectQueryComposer::getColumns: could not parse the column retrieval statement!" ); OSL_ENSURE( pStatementTree.get(), "OSingleSelectQueryComposer::getColumns: could not parse the column retrieval statement!" );
if ( pStatementTree.get() ) if ( pStatementTree.get() )
if ( !pStatementTree->parseNodeToExecutableStatement( sSQL, m_xConnection, m_aSqlParser, NULL ) ) if ( !pStatementTree->parseNodeToExecutableStatement( sSQL, m_xConnection, m_aSqlParser, NULL ) )
@@ -1738,9 +1734,7 @@ Sequence< Sequence< PropertyValue > > OSingleSelectQueryComposer::getStructuredC
const OSQLParseNode* pTempNode = m_aAdditiveIterator.getParseTree(); const OSQLParseNode* pTempNode = m_aAdditiveIterator.getParseTree();
OUString aErrorMsg; OUString aErrorMsg;
SAL_WNODEPRECATED_DECLARATIONS_PUSH boost::scoped_ptr<OSQLParseNode> pSqlParseNode( m_aSqlParser.parseTree(aErrorMsg,aSql));
::std::auto_ptr<OSQLParseNode> pSqlParseNode( m_aSqlParser.parseTree(aErrorMsg,aSql));
SAL_WNODEPRECATED_DECLARATIONS_POP
if ( pSqlParseNode.get() ) if ( pSqlParseNode.get() )
{ {
m_aAdditiveIterator.setParseTree(pSqlParseNode.get()); m_aAdditiveIterator.setParseTree(pSqlParseNode.get());

View File

@@ -25,7 +25,7 @@
#include <vcl/image.hxx> #include <vcl/image.hxx>
#include "callbacks.hxx" #include "callbacks.hxx"
#include "AppElementType.hxx" #include "AppElementType.hxx"
#include <memory> #include <boost/scoped_ptr.hpp>
using namespace ::dbaui; using namespace ::dbaui;
// class OApplicationIconControl // class OApplicationIconControl
@@ -68,7 +68,7 @@ OApplicationIconControl::~OApplicationIconControl()
SvxIconChoiceCtrlEntry* pEntry = GetEntry( i ); SvxIconChoiceCtrlEntry* pEntry = GetEntry( i );
if ( pEntry ) if ( pEntry )
{ {
::std::auto_ptr<ElementType> aType(static_cast<ElementType*>(pEntry->GetUserData())); boost::scoped_ptr<ElementType> aType(static_cast<ElementType*>(pEntry->GetUserData()));
pEntry->SetUserData(NULL); pEntry->SetUserData(NULL);
} }
} }

View File

@@ -50,7 +50,7 @@
#include <comphelper/numbers.hxx> #include <comphelper/numbers.hxx>
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include "UITools.hxx" #include "UITools.hxx"
#include <memory> #include <boost/scoped_ptr.hpp>
#include "dbu_control.hrc" #include "dbu_control.hrc"
#include "dbu_tbl.hrc" #include "dbu_tbl.hrc"
#include <osl/diagnose.h> #include <osl/diagnose.h>
@@ -212,15 +212,11 @@ OFieldDescControl::~OFieldDescControl()
{ {
{ {
SAL_WNODEPRECATED_DECLARATIONS_PUSH boost::scoped_ptr<Window> aTemp(m_pVertScroll);
::std::auto_ptr<Window> aTemp(m_pVertScroll);
SAL_WNODEPRECATED_DECLARATIONS_POP
m_pVertScroll = NULL; m_pVertScroll = NULL;
} }
{ {
SAL_WNODEPRECATED_DECLARATIONS_PUSH boost::scoped_ptr<Window> aTemp(m_pHorzScroll);
::std::auto_ptr<Window> aTemp(m_pHorzScroll);
SAL_WNODEPRECATED_DECLARATIONS_POP
m_pHorzScroll = NULL; m_pHorzScroll = NULL;
} }
if ( m_bAdded ) if ( m_bAdded )

View File

@@ -23,7 +23,8 @@
#include <svl/stritem.hxx> #include <svl/stritem.hxx>
#include <svl/eitem.hxx> #include <svl/eitem.hxx>
#include <memory> #include <cassert>
#include <boost/scoped_ptr.hpp>
namespace dbaui namespace dbaui
{ {
@@ -61,7 +62,8 @@ namespace dbaui
// TODO: one could throw an IllegalArgumentException here - finally, this method // TODO: one could throw an IllegalArgumentException here - finally, this method
// is (to be) used from within an XPropertySet::setPropertyValue implementation, // is (to be) used from within an XPropertySet::setPropertyValue implementation,
// where this would be the appropriate reaction on wrong value types // where this would be the appropriate reaction on wrong value types
::std::auto_ptr< ITEMTYPE > pClone( dynamic_cast< ITEMTYPE* >( pTypedItem->Clone() ) ); boost::scoped_ptr< ITEMTYPE > pClone( dynamic_cast< ITEMTYPE* >( pTypedItem->Clone() ) );
assert(pClone.get());
pClone->SetValue( aValue ); pClone->SetValue( aValue );
_rSet.Put( *pClone ); _rSet.Put( *pClone );
return true; return true;

View File

@@ -21,7 +21,7 @@
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <svtools/svmedit.hxx> #include <svtools/svmedit.hxx>
#include "dbaccess_helpid.hrc" #include "dbaccess_helpid.hrc"
#include <memory> #include <boost/scoped_ptr.hpp>
using namespace dbaui; using namespace dbaui;
#define STANDARD_MARGIN 6 #define STANDARD_MARGIN 6
// class OTableDesignHelpBar // class OTableDesignHelpBar
@@ -37,7 +37,7 @@ OTableDesignHelpBar::OTableDesignHelpBar( Window* pParent ) :
OTableDesignHelpBar::~OTableDesignHelpBar() OTableDesignHelpBar::~OTableDesignHelpBar()
{ {
::std::auto_ptr<Window> aTemp(m_pTextWin); boost::scoped_ptr<Window> aTemp(m_pTextWin);
m_pTextWin = NULL; m_pTextWin = NULL;
} }

View File

@@ -25,7 +25,7 @@
#include <vcl/fixed.hxx> #include <vcl/fixed.hxx>
#include "dbaccess_helpid.hrc" #include "dbaccess_helpid.hrc"
#include "moduledbu.hxx" #include "moduledbu.hxx"
#include <memory> #include <boost/scoped_ptr.hpp>
#define STANDARD_MARGIN 6 #define STANDARD_MARGIN 6
#define DETAILS_HEADER_HEIGHT 25 #define DETAILS_HEADER_HEIGHT 25
@@ -70,21 +70,15 @@ OTableFieldDescWin::~OTableFieldDescWin()
m_pHeader->Hide(); m_pHeader->Hide();
{ {
SAL_WNODEPRECATED_DECLARATIONS_PUSH boost::scoped_ptr<Window> aTemp(m_pGenPage);
::std::auto_ptr<Window> aTemp(m_pGenPage);
SAL_WNODEPRECATED_DECLARATIONS_POP
m_pGenPage = NULL; m_pGenPage = NULL;
} }
{ {
SAL_WNODEPRECATED_DECLARATIONS_PUSH boost::scoped_ptr<Window> aTemp(m_pHeader);
::std::auto_ptr<Window> aTemp(m_pHeader);
SAL_WNODEPRECATED_DECLARATIONS_POP
m_pHeader = NULL; m_pHeader = NULL;
} }
{ {
SAL_WNODEPRECATED_DECLARATIONS_PUSH boost::scoped_ptr<Window> aTemp(m_pHelpBar);
::std::auto_ptr<Window> aTemp(m_pHelpBar);
SAL_WNODEPRECATED_DECLARATIONS_POP
m_pHelpBar = NULL; m_pHelpBar = NULL;
} }
} }