summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-11-13 21:08:48 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-11-14 08:53:11 +0000
commit6b35488c723e2f2266f7e377ad53a82af7b6fede (patch)
tree42421e4c755e01ea0c331ceb463760ec22cdb29d /connectivity
parentaa3f954222a270d3e2fa531badd2fa7febd30338 (diff)
coverity#1371279 Missing move assignment operator
Change-Id: Ic1c1017184bff54360b0ea3b6f57e53d61cbe1d5
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/evoab2/NStatement.hxx102
1 files changed, 58 insertions, 44 deletions
diff --git a/connectivity/source/drivers/evoab2/NStatement.hxx b/connectivity/source/drivers/evoab2/NStatement.hxx
index 54085d78b381..efdc5f2f124e 100644
--- a/connectivity/source/drivers/evoab2/NStatement.hxx
+++ b/connectivity/source/drivers/evoab2/NStatement.hxx
@@ -69,67 +69,81 @@ namespace connectivity
eFilterOther
};
- struct QueryData
+ class EBookQueryWrapper
{
private:
- EBookQuery* pQuery;
-
+ EBookQuery* mpQuery;
public:
- OUString sTable;
- QueryFilterType eFilterType;
- ::rtl::Reference< ::connectivity::OSQLColumns > xSelectColumns;
- SortDescriptor aSortOrder;
-
- QueryData()
- :pQuery( nullptr )
- ,sTable()
- ,eFilterType( eFilterOther )
- ,xSelectColumns()
- ,aSortOrder()
+ EBookQueryWrapper()
+ : mpQuery(nullptr)
{
}
-
- QueryData( const QueryData& _rhs )
- :pQuery( nullptr )
- ,sTable()
- ,eFilterType( eFilterOther )
- ,xSelectColumns()
- ,aSortOrder()
+ EBookQueryWrapper(const EBookQueryWrapper& rhs)
+ : mpQuery(rhs.mpQuery)
{
- *this = _rhs;
+ if (mpQuery)
+ e_book_query_ref(mpQuery);
}
-
- QueryData& operator=( const QueryData& _rhs )
+ EBookQueryWrapper(EBookQueryWrapper&& rhs)
+ : mpQuery(rhs.mpQuery)
{
- if ( this == &_rhs )
- return *this;
-
- setQuery( _rhs.pQuery );
- sTable = _rhs.sTable;
- eFilterType = _rhs.eFilterType;
- xSelectColumns = _rhs.xSelectColumns;
- aSortOrder = _rhs.aSortOrder;
-
+ rhs.mpQuery = nullptr;
+ }
+ void reset(EBookQuery* pQuery)
+ {
+ if (mpQuery)
+ e_book_query_unref(mpQuery);
+ mpQuery = pQuery;
+ if (mpQuery)
+ e_book_query_ref(mpQuery);
+ }
+ EBookQueryWrapper& operator=(const EBookQueryWrapper& rhs)
+ {
+ if (this != &rhs)
+ reset(rhs.mpQuery);
return *this;
}
-
- ~QueryData()
+ EBookQueryWrapper& operator=(EBookQueryWrapper&& rhs)
{
- setQuery( nullptr );
+ if (mpQuery)
+ e_book_query_unref(mpQuery);
+ mpQuery = rhs.mpQuery;
+ rhs.mpQuery = nullptr;
+ return *this;
}
+ ~EBookQueryWrapper()
+ {
+ if (mpQuery)
+ e_book_query_unref(mpQuery);
+ }
+ EBookQuery* getQuery() const
+ {
+ return mpQuery;
+ }
+ };
- EBookQuery* getQuery() const { return pQuery; }
+ struct QueryData
+ {
+ private:
+ EBookQueryWrapper aQuery;
+
+ public:
+ OUString sTable;
+ QueryFilterType eFilterType;
+ rtl::Reference<connectivity::OSQLColumns> xSelectColumns;
+ SortDescriptor aSortOrder;
- void setQuery( EBookQuery* _pQuery )
+ QueryData()
+ : sTable()
+ , eFilterType( eFilterOther )
+ , xSelectColumns()
+ , aSortOrder()
{
- if ( pQuery )
- e_book_query_unref( pQuery );
- pQuery = _pQuery;
- if ( pQuery )
- e_book_query_ref( pQuery );
}
- };
+ EBookQuery* getQuery() const { return aQuery.getQuery(); }
+ void setQuery(EBookQuery* pQuery) { aQuery.reset(pQuery); }
+ };
//************ Class: OCommonStatement
// is a base class for the normal statement and for the prepared statement