summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-03-17 21:34:21 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-03-18 09:49:50 +0100
commite5230535877e30c3b874495e8794faa3a42d8017 (patch)
tree6678613797f3cfa80a08455a4080ce9e653f9781 /include
parent673728c9caf7b3199dd684f48a32a0f5cafd6285 (diff)
simplify ORefVector code
by making it extend std::vector - it wants to be a ref-counted vector, so let it be, and we can simplify the usage sites Change-Id: I93ff6ee1522da965e16223dca171401d36fd67b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90664 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r--include/connectivity/CommonTools.hxx27
-rw-r--r--include/connectivity/FValue.hxx4
2 files changed, 13 insertions, 18 deletions
diff --git a/include/connectivity/CommonTools.hxx b/include/connectivity/CommonTools.hxx
index a515a3b65fed..62e25b10d3f8 100644
--- a/include/connectivity/CommonTools.hxx
+++ b/include/connectivity/CommonTools.hxx
@@ -55,34 +55,29 @@ namespace connectivity
typedef std::map<OUString,OSQLTable,comphelper::UStringMixLess> OSQLTables;
// class ORefVector allows reference counting on a std::vector
- template< class VectorVal > class ORefVector : public salhelper::SimpleReferenceObject
+ template< class VectorVal > class ORefVector : public salhelper::SimpleReferenceObject,
+ public std::vector< VectorVal >
{
- std::vector< VectorVal > m_vector;
-
protected:
virtual ~ORefVector() override {}
public:
typedef std::vector< VectorVal > Vector;
ORefVector() {}
- ORefVector(size_t _st) : m_vector(_st) {}
+ ORefVector(size_t _st) : std::vector< VectorVal >(_st) {}
ORefVector(const ORefVector& rOther)
: salhelper::SimpleReferenceObject()
- , m_vector(rOther.m_vector)
+ , std::vector< VectorVal >(rOther)
{}
ORefVector& operator=(const ORefVector& _rRH)
{
if ( &_rRH != this )
{
- m_vector = _rRH.m_vector;
+ std::vector< VectorVal >::operator=(_rRH);
}
return *this;
}
-
- std::vector< VectorVal > & get() { return m_vector; }
- std::vector< VectorVal > const & get() const { return m_vector; }
-
};
// class ORowVector includes refcounting and initialize himself
@@ -101,16 +96,16 @@ namespace connectivity
// search from first to last the column with the name _rVal
// when no such column exist last is returned
OOO_DLLPUBLIC_DBTOOLS
- OSQLColumns::Vector::const_iterator find( const OSQLColumns::Vector::const_iterator& first,
- const OSQLColumns::Vector::const_iterator& last,
+ OSQLColumns::const_iterator find( const OSQLColumns::const_iterator& first,
+ const OSQLColumns::const_iterator& last,
const OUString& _rVal,
const ::comphelper::UStringMixEqual& _rCase);
// search from first to last the column with the realname _rVal
// when no such column exist last is returned
OOO_DLLPUBLIC_DBTOOLS
- OSQLColumns::Vector::const_iterator findRealName( const OSQLColumns::Vector::const_iterator& first,
- const OSQLColumns::Vector::const_iterator& last,
+ OSQLColumns::const_iterator findRealName( const OSQLColumns::const_iterator& first,
+ const OSQLColumns::const_iterator& last,
const OUString& _rVal,
const ::comphelper::UStringMixEqual& _rCase);
@@ -118,8 +113,8 @@ namespace connectivity
// search from first to last the column with the property _rProp equals the value _rVal
// when no such column exist last is returned
OOO_DLLPUBLIC_DBTOOLS
- OSQLColumns::Vector::const_iterator find( OSQLColumns::Vector::const_iterator first,
- const OSQLColumns::Vector::const_iterator& last,
+ OSQLColumns::const_iterator find( OSQLColumns::const_iterator first,
+ const OSQLColumns::const_iterator& last,
const OUString& _rProp,
const OUString& _rVal,
const ::comphelper::UStringMixEqual& _rCase);
diff --git a/include/connectivity/FValue.hxx b/include/connectivity/FValue.hxx
index 44ec1e2393d6..9740b6712ac3 100644
--- a/include/connectivity/FValue.hxx
+++ b/include/connectivity/FValue.hxx
@@ -503,7 +503,7 @@ namespace connectivity
OValueRefVector(){}
OValueRefVector(size_t _st) : ODeleteVector< ORowSetValueDecoratorRef >(_st)
{
- for (auto & elem : get())
+ for (auto & elem : *this)
elem = new ORowSetValueDecorator;
}
};
@@ -513,7 +513,7 @@ namespace connectivity
{
::std::vector<sal_Int32> m_nParameterIndexes;
public:
- OAssignValues(Vector::size_type n) : OValueRefVector(n),m_nParameterIndexes(n+1,SQL_NO_PARAMETER){}
+ OAssignValues(size_type n) : OValueRefVector(n),m_nParameterIndexes(n+1,SQL_NO_PARAMETER){}
void setParameterIndex(sal_Int32 _nId,sal_Int32 _nParameterIndex) { m_nParameterIndexes[_nId] = _nParameterIndex;}
sal_Int32 getParameterIndex(sal_Int32 _nId) const { return m_nParameterIndexes[_nId]; }