diff options
author | Noel Grandin <noel@peralex.com> | 2015-11-10 14:23:47 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-11-10 15:30:03 +0200 |
commit | d489e76a514dc9cd5c9a432e51e6c8ff986b91ee (patch) | |
tree | 6292e044a2d42be199e0c815db05d5c47a15c958 /editeng | |
parent | bb4379a2e4d58485dd44da03f324ca0fd13c49d9 (diff) |
editeng: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I212c6b990da655ad7947154ca9e62981b049489e
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 18 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.hxx | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 53ff7cfccd40..a0abc5b1aee2 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -440,22 +440,22 @@ sal_Int32 TextPortionList::Count() const const TextPortion& TextPortionList::operator[](sal_Int32 nPos) const { - return maPortions[nPos]; + return *maPortions[nPos].get(); } TextPortion& TextPortionList::operator[](sal_Int32 nPos) { - return maPortions[nPos]; + return *maPortions[nPos].get(); } void TextPortionList::Append(TextPortion* p) { - maPortions.push_back(p); + maPortions.push_back(std::unique_ptr<TextPortion>(p)); } void TextPortionList::Insert(sal_Int32 nPos, TextPortion* p) { - maPortions.insert(maPortions.begin()+nPos, p); + maPortions.insert(maPortions.begin()+nPos, std::unique_ptr<TextPortion>(p)); } void TextPortionList::Remove(sal_Int32 nPos) @@ -465,14 +465,14 @@ void TextPortionList::Remove(sal_Int32 nPos) namespace { -class FindTextPortionByAddress : std::unary_function<TextPortion, bool> +class FindTextPortionByAddress : std::unary_function<std::unique_ptr<TextPortion>, bool> { const TextPortion* mp; public: explicit FindTextPortionByAddress(const TextPortion* p) : mp(p) {} - bool operator() (const TextPortion& v) const + bool operator() (const std::unique_ptr<TextPortion>& v) const { - return &v == mp; + return v.get() == mp; } }; @@ -497,7 +497,7 @@ sal_Int32 TextPortionList::FindPortion( sal_Int32 n = maPortions.size(); for (sal_Int32 i = 0; i < n; ++i) { - const TextPortion& rPortion = maPortions[i]; + const TextPortion& rPortion = *maPortions[i].get(); nTmpPos = nTmpPos + rPortion.GetLen(); if ( nTmpPos >= nCharPos ) { @@ -518,7 +518,7 @@ sal_Int32 TextPortionList::GetStartPos(sal_Int32 nPortion) sal_Int32 nPos = 0; for (sal_Int32 i = 0; i < nPortion; ++i) { - const TextPortion& rPortion = maPortions[i]; + const TextPortion& rPortion = *maPortions[i].get(); nPos = nPos + rPortion.GetLen(); } return nPos; diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx index 02d2af9ad600..45838d9dcda6 100644 --- a/editeng/source/editeng/editdoc.hxx +++ b/editeng/source/editeng/editdoc.hxx @@ -445,7 +445,7 @@ public: class TextPortionList { - typedef boost::ptr_vector<TextPortion> PortionsType; + typedef std::vector<std::unique_ptr<TextPortion> > PortionsType; PortionsType maPortions; public: |