summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-11-22 22:37:41 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-11-22 22:47:21 -0500
commit811d6ff5e30e1527c54b25b8040b3783205245a6 (patch)
tree3ebbc2e903e70619873ffd9cfcd0ab2b8d66f677 /svtools
parent96811dbda3c61115ead7837b19f664533b86f6b5 (diff)
Apply pimpl to SvKeyValueIterator, to hide ptr_vector from the header.
Change-Id: I16c25d28066fbc8d6357bf89b047763b67bc85bb
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/svrtf/svparser.cxx45
1 files changed, 19 insertions, 26 deletions
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index 14126096fb37..d8c5aea9f27f 100644
--- a/svtools/source/svrtf/svparser.cxx
+++ b/svtools/source/svrtf/svparser.cxx
@@ -17,13 +17,15 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <stdio.h>
#include <svtools/svparser.hxx>
#include <tools/stream.hxx>
#include <tools/debug.hxx>
#include <rtl/textcvt.h>
#include <rtl/tencinfo.h>
+#include <stdio.h>
+#include <boost/ptr_container/ptr_vector.hpp>
+
// structure to store the actuel data
struct SvParser_Impl
{
@@ -649,40 +651,34 @@ IMPL_STATIC_LINK( SvParser, NewDataRead, void*, EMPTYARG )
*
*======================================================================*/
-/*
- * SvKeyValueIterator.
- */
-SvKeyValueIterator::SvKeyValueIterator (void)
- : m_pList (new SvKeyValueList_Impl),
- m_nPos (0)
+typedef boost::ptr_vector<SvKeyValue> SvKeyValueList_Impl;
+
+struct SvKeyValueIterator::Impl
{
-}
+ SvKeyValueList_Impl maList;
+ sal_uInt16 mnPos;
-/*
- * ~SvKeyValueIterator.
- */
-SvKeyValueIterator::~SvKeyValueIterator (void)
+ Impl() : mnPos(0) {}
+};
+
+SvKeyValueIterator::SvKeyValueIterator() : mpImpl(new Impl) {}
+
+SvKeyValueIterator::~SvKeyValueIterator()
{
- delete m_pList;
+ delete mpImpl;
}
-/*
- * GetFirst.
- */
bool SvKeyValueIterator::GetFirst (SvKeyValue &rKeyVal)
{
- m_nPos = m_pList->size();
+ mpImpl->mnPos = mpImpl->maList.size();
return GetNext (rKeyVal);
}
-/*
- * GetNext.
- */
bool SvKeyValueIterator::GetNext (SvKeyValue &rKeyVal)
{
- if (m_nPos > 0)
+ if (mpImpl->mnPos > 0)
{
- rKeyVal = (*m_pList)[--m_nPos];
+ rKeyVal = mpImpl->maList[--mpImpl->mnPos];
return true;
}
else
@@ -692,12 +688,9 @@ bool SvKeyValueIterator::GetNext (SvKeyValue &rKeyVal)
}
}
-/*
- * Append.
- */
void SvKeyValueIterator::Append (const SvKeyValue &rKeyVal)
{
- m_pList->push_back(new SvKeyValue(rKeyVal));
+ mpImpl->maList.push_back(new SvKeyValue(rKeyVal));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */