diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2017-09-28 12:22:12 +0900 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-10-03 08:48:42 +0200 |
commit | 445b17ce332007a62cd1e4f6eac4d337896c68b2 (patch) | |
tree | 50ab61e1146b2a49b7b5fd15ddd3a03941f315bd /include | |
parent | d3971ec256450e6783920b46f672048b29719949 (diff) |
svx: Simplify SdrGluePointList with std::unique_ptr
This also inlines SdrGluePointList::GetObject().
Change-Id: I70052a5e94b3451f5a00e1185e6dee59e5537184
Reviewed-on: https://gerrit.libreoffice.org/43059
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/svx/svdglue.hxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/include/svx/svdglue.hxx b/include/svx/svdglue.hxx index 1db3ca9acce9..0a74ef8e5127 100644 --- a/include/svx/svdglue.hxx +++ b/include/svx/svdglue.hxx @@ -22,6 +22,7 @@ #include <tools/gen.hxx> #include <svx/svxdllapi.h> +#include <memory> #include <vector> #include <o3tl/typed_flags_set.hxx> @@ -115,13 +116,11 @@ public: #define SDRGLUEPOINT_NOTFOUND 0xFFFF class SVX_DLLPUBLIC SdrGluePointList { - std::vector<SdrGluePoint*> aList; -protected: - SdrGluePoint* GetObject(sal_uInt16 i) const { return aList[i]; } + std::vector<std::unique_ptr<SdrGluePoint>> aList; public: - SdrGluePointList(): aList() {} - SdrGluePointList(const SdrGluePointList& rSrcList): aList() { *this=rSrcList; } - ~SdrGluePointList() { Clear(); } + SdrGluePointList() {}; + SdrGluePointList(const SdrGluePointList& rSrcList) { *this=rSrcList; } + void Clear(); SdrGluePointList& operator=(const SdrGluePointList& rSrcList); sal_uInt16 GetCount() const { return sal_uInt16(aList.size()); } @@ -130,12 +129,10 @@ public: sal_uInt16 Insert(const SdrGluePoint& rGP); void Delete(sal_uInt16 nPos) { - SdrGluePoint* p = aList[nPos]; aList.erase(aList.begin()+nPos); - delete p; } - SdrGluePoint& operator[](sal_uInt16 nPos) { return *GetObject(nPos); } - const SdrGluePoint& operator[](sal_uInt16 nPos) const { return *GetObject(nPos); } + SdrGluePoint& operator[](sal_uInt16 nPos) { return *aList[nPos]; } + const SdrGluePoint& operator[](sal_uInt16 nPos) const { return *aList[nPos]; } sal_uInt16 FindGluePoint(sal_uInt16 nId) const; sal_uInt16 HitTest(const Point& rPnt, const OutputDevice& rOut, const SdrObject* pObj) const; void Invalidate(vcl::Window& rWin, const SdrObject* pObj) const; |