[Libreoffice-commits] .: tools/inc tools/source
Lubos Lunak
llunak at kemper.freedesktop.org
Fri Mar 4 03:13:06 PST 2011
tools/inc/tools/inetmime.hxx | 31 +++++++++++++++++++------------
tools/source/inet/inetmime.cxx | 19 +++++++++----------
2 files changed, 28 insertions(+), 22 deletions(-)
New commits:
commit 1e8f1c5757bfbb26d55ec5a6eb4e9719e1fbaa8b
Author: npcdoom <venccsralph at gmail.com>
Date: Tue Mar 1 13:34:49 2011 -0430
Remove deprecated container List.
Signed-off-by: LuboÅ¡ LuÅák <l.lunak at suse.cz>
diff --git a/tools/inc/tools/inetmime.hxx b/tools/inc/tools/inetmime.hxx
index 51c6263..f02a487 100644
--- a/tools/inc/tools/inetmime.hxx
+++ b/tools/inc/tools/inetmime.hxx
@@ -28,13 +28,14 @@
#ifndef TOOLS_INETMIME_HXX
#define TOOLS_INETMIME_HXX
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include "tools/toolsdllapi.h"
#include <rtl/alloc.h>
#include <rtl/string.h>
#include "rtl/tencinfo.h"
#include <tools/debug.hxx>
#include <tools/errcode.hxx>
-#include <tools/list.hxx>
#include <tools/string.hxx>
class DateTime;
@@ -1418,29 +1419,35 @@ inline INetContentTypeParameter::INetContentTypeParameter(const ByteString &
{}
//============================================================================
-class TOOLS_DLLPUBLIC INetContentTypeParameterList: private List
+class TOOLS_DLLPUBLIC INetContentTypeParameterList
{
public:
- ~INetContentTypeParameterList() { Clear(); }
-
- using List::Count;
void Clear();
void Insert(INetContentTypeParameter * pParameter, ULONG nIndex)
- { List::Insert(pParameter, nIndex); }
+ {
+ maEntries.insert(maEntries.begin()+nIndex,pParameter);
+ }
+
+ void Append(INetContentTypeParameter *pParameter)
+ {
+ maEntries.push_back(pParameter);
+ }
- inline const INetContentTypeParameter * GetObject(ULONG nIndex) const;
+ inline const INetContentTypeParameter * GetObject(ULONG nIndex) const
+ {
+ return &(maEntries[nIndex]);
+ }
const INetContentTypeParameter * find(const ByteString & rAttribute)
const;
+
+private:
+
+ boost::ptr_vector<INetContentTypeParameter> maEntries;
};
-inline const INetContentTypeParameter *
-INetContentTypeParameterList::GetObject(ULONG nIndex) const
-{
- return static_cast< INetContentTypeParameter * >(List::GetObject(nIndex));
-}
#endif // TOOLS_INETMIME_HXX
diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx
index 35db390..f7577e3 100644
--- a/tools/source/inet/inetmime.cxx
+++ b/tools/source/inet/inetmime.cxx
@@ -373,12 +373,11 @@ bool parseParameters(ParameterList const & rInput,
break;
};
}
- pOutput->Insert(new INetContentTypeParameter(p->m_aAttribute,
+ pOutput->Append(new INetContentTypeParameter(p->m_aAttribute,
p->m_aCharset,
p->m_aLanguage,
aValue,
- !bBadEncoding),
- LIST_APPEND);
+ !bBadEncoding));
p = pNext;
}
return true;
@@ -4544,21 +4543,21 @@ INetMIMEEncodedWordOutputSink::operator <<(sal_uInt32 nChar)
void INetContentTypeParameterList::Clear()
{
- while (Count() > 0)
- delete static_cast< INetContentTypeParameter * >(Remove(Count() - 1));
+ maEntries.clear();
}
//============================================================================
const INetContentTypeParameter *
INetContentTypeParameterList::find(const ByteString & rAttribute) const
{
- for (ULONG i = 0; i < Count(); ++i)
+ boost::ptr_vector<INetContentTypeParameter>::const_iterator iter;
+ for (iter = maEntries.begin(); iter != maEntries.end(); ++iter)
{
- const INetContentTypeParameter * pParameter = GetObject(i);
- if (pParameter->m_sAttribute.EqualsIgnoreCaseAscii(rAttribute))
- return pParameter;
+ if (iter->m_sAttribute.EqualsIgnoreCaseAscii(rAttribute))
+ return &(*iter);
}
- return 0;
+
+ return NULL;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list