[Libreoffice-commits] core.git: include/svtools svtools/source
Kohei Yoshida
kohei.yoshida at collabora.com
Sat Nov 22 19:47:50 PST 2014
include/svtools/svparser.hxx | 15 ++++--------
svtools/source/svrtf/svparser.cxx | 45 ++++++++++++++++----------------------
2 files changed, 24 insertions(+), 36 deletions(-)
New commits:
commit 811d6ff5e30e1527c54b25b8040b3783205245a6
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Sat Nov 22 22:37:41 2014 -0500
Apply pimpl to SvKeyValueIterator, to hide ptr_vector from the header.
Change-Id: I16c25d28066fbc8d6357bf89b047763b67bc85bb
diff --git a/include/svtools/svparser.hxx b/include/svtools/svparser.hxx
index d3294ea..f6cfc9c 100644
--- a/include/svtools/svparser.hxx
+++ b/include/svtools/svparser.hxx
@@ -25,8 +25,7 @@
#include <tools/ref.hxx>
#include <rtl/textenc.h>
#include <rtl/ustring.hxx>
-#include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/utility.hpp>
+#include <boost/noncopyable.hpp>
#include <vector>
struct SvParser_Impl;
@@ -248,21 +247,17 @@ public:
*
*======================================================================*/
-typedef boost::ptr_vector<SvKeyValue> SvKeyValueList_Impl;
-
class SVT_DLLPUBLIC SvKeyValueIterator : public SvRefBase,
private boost::noncopyable
{
- /** Representation.
- */
- SvKeyValueList_Impl* m_pList;
- sal_uInt16 m_nPos;
+ struct Impl;
+ Impl* mpImpl;
public:
/** Construction/Destruction.
*/
- SvKeyValueIterator (void);
- virtual ~SvKeyValueIterator (void);
+ SvKeyValueIterator();
+ virtual ~SvKeyValueIterator();
/** Operation.
*/
diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx
index 1412609..d8c5aea 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: */
More information about the Libreoffice-commits
mailing list