[Libreoffice-commits] core.git: 2 commits - dbaccess/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon May 28 06:46:49 UTC 2018
dbaccess/source/ui/inc/TableConnection.hxx | 4 ++--
dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx | 1 +
dbaccess/source/ui/querydesign/JoinTableView.cxx | 8 ++++----
dbaccess/source/ui/querydesign/TableConnection.cxx | 10 ++++------
dbaccess/source/ui/querydesign/querydlg.cxx | 4 ++--
dbaccess/source/ui/querydesign/querydlg.hxx | 2 +-
dbaccess/source/ui/relationdesign/RTableConnection.cxx | 4 ++--
7 files changed, 16 insertions(+), 17 deletions(-)
New commits:
commit dc8e63784687292ffa178ff29f6fe2f9fd100eea
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon May 21 15:32:02 2018 +0200
loplugin:useuniqueptr in DlgQryJoin
Change-Id: Ia9a5534b6d69dde163fae54fbd2764dc9b279a5d
Reviewed-on: https://gerrit.libreoffice.org/54855
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/dbaccess/source/ui/querydesign/querydlg.cxx b/dbaccess/source/ui/querydesign/querydlg.cxx
index 2bf06735b947..fc5108442506 100644
--- a/dbaccess/source/ui/querydesign/querydlg.cxx
+++ b/dbaccess/source/ui/querydesign/querydlg.cxx
@@ -67,7 +67,7 @@ DlgQryJoin::DlgQryJoin( OQueryTableView * pParent,
m_pConnData.reset(_pData->NewInstance());
m_pConnData->CopyFrom(*_pData);
- m_pTableControl = new OTableListBoxControl(this, _pTableMap, this);
+ m_pTableControl.reset(new OTableListBoxControl(this, _pTableMap, this));
m_pCBNatural->Check(static_cast<OQueryTableConnectionData*>(m_pConnData.get())->isNatural());
@@ -143,7 +143,7 @@ DlgQryJoin::~DlgQryJoin()
void DlgQryJoin::dispose()
{
- delete m_pTableControl;
+ m_pTableControl.reset();
m_pML_HelpText.clear();
m_pPB_OK.clear();
m_pLB_JoinType.clear();
diff --git a/dbaccess/source/ui/querydesign/querydlg.hxx b/dbaccess/source/ui/querydesign/querydlg.hxx
index 93a8d53e54f8..004afdc4fc32 100644
--- a/dbaccess/source/ui/querydesign/querydlg.hxx
+++ b/dbaccess/source/ui/querydesign/querydlg.hxx
@@ -43,7 +43,7 @@ namespace dbaui
VclPtr<ListBox> m_pLB_JoinType;
VclPtr<CheckBox> m_pCBNatural;
- OTableListBoxControl* m_pTableControl;
+ std::unique_ptr<OTableListBoxControl> m_pTableControl;
EJoinType eJoinType;
TTableConnectionData::value_type m_pConnData; // contains left and right table
commit 39d19a88bd4f0bd22aa843b630ab50f9b2708d87
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Mon May 21 10:33:18 2018 +0200
loplugin:useuniqueptr in OTableConnection
Change-Id: I4fe5c706d0aec4b2b81bdbe9e9a59e771af4a02e
Reviewed-on: https://gerrit.libreoffice.org/54854
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/dbaccess/source/ui/inc/TableConnection.hxx b/dbaccess/source/ui/inc/TableConnection.hxx
index 7b6725772796..04759077eff8 100644
--- a/dbaccess/source/ui/inc/TableConnection.hxx
+++ b/dbaccess/source/ui/inc/TableConnection.hxx
@@ -36,7 +36,7 @@ namespace dbaui
class OTableConnection : public vcl::Window
{
- std::vector<OConnectionLine*> m_vConnLine;
+ std::vector<std::unique_ptr<OConnectionLine>> m_vConnLine;
TTableConnectionData::value_type
m_pData;
VclPtr<OJoinTableView> m_pParent;
@@ -88,7 +88,7 @@ namespace dbaui
tools::Rectangle GetBoundingRect() const;
const TTableConnectionData::value_type& GetData() const { return m_pData; }
- const std::vector<OConnectionLine*>& GetConnLineList() const { return m_vConnLine; }
+ const std::vector<std::unique_ptr<OConnectionLine>>& GetConnLineList() const { return m_vConnLine; }
OJoinTableView* GetParent() const { return m_pParent; }
virtual void Draw(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect);
using Window::Draw;
diff --git a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
index 04a9da583b56..bd90d9688490 100644
--- a/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
+++ b/dbaccess/source/ui/querydesign/ConnectionLineAccess.cxx
@@ -18,6 +18,7 @@
*/
#include <ConnectionLineAccess.hxx>
+#include <ConnectionLine.hxx>
#include <JoinTableView.hxx>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
diff --git a/dbaccess/source/ui/querydesign/JoinTableView.cxx b/dbaccess/source/ui/querydesign/JoinTableView.cxx
index f361ca0b125d..dda98512cb77 100644
--- a/dbaccess/source/ui/querydesign/JoinTableView.cxx
+++ b/dbaccess/source/ui/querydesign/JoinTableView.cxx
@@ -892,8 +892,8 @@ void OJoinTableView::SelectConn(OTableConnection* pConn)
SvTreeListEntry* pFirstSourceVisible = pSourceBox->GetFirstEntryInView();
SvTreeListEntry* pFirstDestVisible = pDestBox->GetFirstEntryInView();
- const std::vector<OConnectionLine*>& rLines = pConn->GetConnLineList();
- std::vector<OConnectionLine*>::const_reverse_iterator aIter = rLines.rbegin();
+ const std::vector<std::unique_ptr<OConnectionLine>>& rLines = pConn->GetConnLineList();
+ auto aIter = rLines.rbegin();
for(;aIter != rLines.rend();++aIter)
{
if ((*aIter)->IsValid())
@@ -1144,8 +1144,8 @@ void OJoinTableView::Command(const CommandEvent& rEvt)
{
if (rSelConnection)
{
- const std::vector<OConnectionLine*>& rLines = rSelConnection->GetConnLineList();
- std::vector<OConnectionLine*>::const_iterator aIter = std::find_if(rLines.begin(), rLines.end(),std::mem_fn(&OConnectionLine::IsValid));
+ const std::vector<std::unique_ptr<OConnectionLine>>& rLines = rSelConnection->GetConnLineList();
+ auto aIter = std::find_if(rLines.begin(), rLines.end(),std::mem_fn(&OConnectionLine::IsValid));
if( aIter != rLines.end() )
executePopup((*aIter)->getMidPoint(), rSelConnection);
}
diff --git a/dbaccess/source/ui/querydesign/TableConnection.cxx b/dbaccess/source/ui/querydesign/TableConnection.cxx
index 21f82f792feb..25ce126c306d 100644
--- a/dbaccess/source/ui/querydesign/TableConnection.cxx
+++ b/dbaccess/source/ui/querydesign/TableConnection.cxx
@@ -57,13 +57,11 @@ namespace dbaui
OConnectionLineDataVec& rLineData = GetData()->GetConnLineDataList();
m_vConnLine.reserve(rLineData.size());
for (auto const& elem : rLineData)
- m_vConnLine.push_back( new OConnectionLine(this, elem) );
+ m_vConnLine.emplace_back( new OConnectionLine(this, elem) );
}
void OTableConnection::clearLineData()
{
- for (auto const& elem : m_vConnLine)
- delete elem;
m_vConnLine.clear();
}
void OTableConnection::UpdateLineList()
@@ -85,10 +83,10 @@ namespace dbaui
// copy linelist
if(! rConn.GetConnLineList().empty() )
{
- const std::vector<OConnectionLine*>& rLine = rConn.GetConnLineList();
+ const std::vector<std::unique_ptr<OConnectionLine>>& rLine = rConn.GetConnLineList();
m_vConnLine.reserve(rLine.size());
for (auto const& elem : rLine)
- m_vConnLine.push_back( new OConnectionLine(*elem));
+ m_vConnLine.emplace_back( new OConnectionLine(*elem));
}
// as the data are not mine, I also do not delete the old
@@ -146,7 +144,7 @@ namespace dbaui
return std::any_of(m_vConnLine.begin(),
m_vConnLine.end(),
[&rMousePos]
- ( const OConnectionLine* pLine )
+ ( const std::unique_ptr<OConnectionLine> & pLine )
{ return pLine->CheckHit( rMousePos ); } );
}
diff --git a/dbaccess/source/ui/relationdesign/RTableConnection.cxx b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
index b76016d14c1a..56e7549c1998 100644
--- a/dbaccess/source/ui/relationdesign/RTableConnection.cxx
+++ b/dbaccess/source/ui/relationdesign/RTableConnection.cxx
@@ -60,7 +60,7 @@ void ORelationTableConnection::Draw(vcl::RenderContext& rRenderContext, const to
long nTemp;
const OConnectionLine* pTopLine = nullptr;
- const std::vector<OConnectionLine*>& rConnLineList = GetConnLineList();
+ const std::vector<std::unique_ptr<OConnectionLine>>& rConnLineList = GetConnLineList();
for (auto const& elem : rConnLineList)
{
@@ -71,7 +71,7 @@ void ORelationTableConnection::Draw(vcl::RenderContext& rRenderContext, const to
if(nTemp < nTop)
{
nTop = nTemp;
- pTopLine = elem;
+ pTopLine = elem.get();
}
}
}
More information about the Libreoffice-commits
mailing list