summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2017-09-13 18:34:58 +0900
committerMichael Stahl <mstahl@redhat.com>2017-09-13 16:13:59 +0200
commit84b8e14ad30bc3bfbd52b38fe5472a6d85e4f41a (patch)
tree2157b05e1a06f6a7349acb6b5d8c4ef9a81c35c2 /include
parent1f582e38dd8f2f9c556720e5d66d0d17318b095a (diff)
svx: Simplify SdrHelpLineList with std::unique_ptr
This also kills no longer used SdrHelpLineList::GetObject(). Change-Id: I6e08e44214657c536717e96693c89104d7118cfd Reviewed-on: https://gerrit.libreoffice.org/42234 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/svx/svdhlpln.hxx23
1 files changed, 10 insertions, 13 deletions
diff --git a/include/svx/svdhlpln.hxx b/include/svx/svdhlpln.hxx
index 86890979f91d..ede56f82d279 100644
--- a/include/svx/svdhlpln.hxx
+++ b/include/svx/svdhlpln.hxx
@@ -26,6 +26,7 @@
#include <vcl/pointr.hxx>
#include <svx/svxdllapi.h>
+#include <memory>
class OutputDevice;
@@ -58,34 +59,30 @@ public:
#define SDRHELPLINE_NOTFOUND 0xFFFF
class SVX_DLLPUBLIC SdrHelpLineList {
- std::vector<SdrHelpLine*> aList;
-protected:
- SdrHelpLine* GetObject(sal_uInt16 i) const { return aList[i]; }
+ std::vector<std::unique_ptr<SdrHelpLine>> aList;
+
public:
- SdrHelpLineList(): aList() {}
- SdrHelpLineList(const SdrHelpLineList& rSrcList): aList() { *this=rSrcList; }
- ~SdrHelpLineList() { Clear(); }
+ SdrHelpLineList() {}
+ SdrHelpLineList(const SdrHelpLineList& rSrcList) { *this=rSrcList; }
void Clear();
SdrHelpLineList& operator=(const SdrHelpLineList& rSrcList);
bool operator==(const SdrHelpLineList& rCmp) const;
bool operator!=(const SdrHelpLineList& rCmp) const { return !operator==(rCmp); }
sal_uInt16 GetCount() const { return sal_uInt16(aList.size()); }
- void Insert(const SdrHelpLine& rHL) { aList.push_back(new SdrHelpLine(rHL)); }
+ void Insert(const SdrHelpLine& rHL) { aList.emplace_back(new SdrHelpLine(rHL)); }
void Insert(const SdrHelpLine& rHL, sal_uInt16 nPos)
{
if(nPos==0xFFFF)
- aList.push_back(new SdrHelpLine(rHL));
+ aList.emplace_back(new SdrHelpLine(rHL));
else
- aList.insert(aList.begin() + nPos, new SdrHelpLine(rHL));
+ aList.emplace(aList.begin() + nPos, new SdrHelpLine(rHL));
}
void Delete(sal_uInt16 nPos)
{
- SdrHelpLine* p = aList[nPos];
- delete p;
aList.erase(aList.begin() + nPos);
}
- SdrHelpLine& operator[](sal_uInt16 nPos) { return *GetObject(nPos); }
- const SdrHelpLine& operator[](sal_uInt16 nPos) const { return *GetObject(nPos); }
+ SdrHelpLine& operator[](sal_uInt16 nPos) { return *aList[nPos]; }
+ const SdrHelpLine& operator[](sal_uInt16 nPos) const { return *aList[nPos]; }
sal_uInt16 HitTest(const Point& rPnt, sal_uInt16 nTolLog, const OutputDevice& rOut) const;
};