Kaydet (Commit) 05fc30e3 authored tarafından Julien Nabet's avatar Julien Nabet

Replace some lists by vectors (xmloff)

Change-Id: Ide0270ae0b6a17d7c48c0a9ff7901145e00dca6b
Reviewed-on: https://gerrit.libreoffice.org/44792Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJulien Nabet <serval2412@yahoo.fr>
üst 3e1b9212
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
#include <sax/tools/converter.hxx> #include <sax/tools/converter.hxx>
#include <list> #include <vector>
#include <o3tl/make_unique.hxx> #include <o3tl/make_unique.hxx>
...@@ -741,7 +741,7 @@ void AnimationNodeContext::init_node( const css::uno::Reference< css::xml::sax: ...@@ -741,7 +741,7 @@ void AnimationNodeContext::init_node( const css::uno::Reference< css::xml::sax:
Reference< XTransitionFilter > xTransitionFilter( mxNode, UNO_QUERY ); Reference< XTransitionFilter > xTransitionFilter( mxNode, UNO_QUERY );
Reference< XIterateContainer > xIter( mxNode, UNO_QUERY ); Reference< XIterateContainer > xIter( mxNode, UNO_QUERY );
std::list< NamedValue > aUserData; std::vector< NamedValue > aUserData;
XMLTokenEnum meAttributeName = XML_TOKEN_INVALID; XMLTokenEnum meAttributeName = XML_TOKEN_INVALID;
OUString aFrom, aBy, aTo, aValues; OUString aFrom, aBy, aTo, aValues;
bool bHaveXmlId( false ); bool bHaveXmlId( false );
...@@ -1201,10 +1201,8 @@ void AnimationNodeContext::init_node( const css::uno::Reference< css::xml::sax: ...@@ -1201,10 +1201,8 @@ void AnimationNodeContext::init_node( const css::uno::Reference< css::xml::sax:
{ {
Sequence< NamedValue > aUnoUserData( nUserDataCount ); Sequence< NamedValue > aUnoUserData( nUserDataCount );
NamedValue* pData = aUnoUserData.getArray(); NamedValue* pData = aUnoUserData.getArray();
std::list< NamedValue >::iterator aIter( aUserData.begin() ); for (auto const& item : aUserData)
const std::list< NamedValue >::iterator aEnd( aUserData.end() ); *pData++ = item;
while( aIter != aEnd )
*pData++ = (*aIter++);
mxNode->setUserData( aUnoUserData ); mxNode->setUserData( aUnoUserData );
} }
......
...@@ -71,11 +71,9 @@ XMLRedlineExport::XMLRedlineExport(SvXMLExport& rExp) ...@@ -71,11 +71,9 @@ XMLRedlineExport::XMLRedlineExport(SvXMLExport& rExp)
XMLRedlineExport::~XMLRedlineExport() XMLRedlineExport::~XMLRedlineExport()
{ {
// delete changes lists // delete changes lists
for( ChangesMapType::iterator aIter = aChangeMap.begin(); for (auto const& change : aChangeMap)
aIter != aChangeMap.end();
++aIter )
{ {
delete aIter->second; delete change.second;
} }
aChangeMap.clear(); aChangeMap.clear();
} }
...@@ -130,7 +128,7 @@ void XMLRedlineExport::ExportChangesList( ...@@ -130,7 +128,7 @@ void XMLRedlineExport::ExportChangesList(
ChangesMapType::iterator aFind = aChangeMap.find(rText); ChangesMapType::iterator aFind = aChangeMap.find(rText);
if (aFind != aChangeMap.end()) if (aFind != aChangeMap.end())
{ {
ChangesListType* pChangesList = aFind->second; ChangesVectorType* pChangesList = aFind->second;
// export only if changes are found // export only if changes are found
if (pChangesList->size() > 0) if (pChangesList->size() > 0)
...@@ -141,11 +139,9 @@ void XMLRedlineExport::ExportChangesList( ...@@ -141,11 +139,9 @@ void XMLRedlineExport::ExportChangesList(
true, true); true, true);
// iterate over changes list // iterate over changes list
for( ChangesListType::iterator aIter = pChangesList->begin(); for (auto const& change : *pChangesList)
aIter != pChangesList->end();
++aIter )
{ {
ExportChangedRegion( *aIter ); ExportChangedRegion(change);
} }
} }
// else: changes list empty -> ignore // else: changes list empty -> ignore
...@@ -162,7 +158,7 @@ void XMLRedlineExport::SetCurrentXText( ...@@ -162,7 +158,7 @@ void XMLRedlineExport::SetCurrentXText(
ChangesMapType::iterator aIter = aChangeMap.find(rText); ChangesMapType::iterator aIter = aChangeMap.find(rText);
if (aIter == aChangeMap.end()) if (aIter == aChangeMap.end())
{ {
ChangesListType* pList = new ChangesListType; ChangesVectorType* pList = new ChangesVectorType;
aChangeMap[rText] = pList; aChangeMap[rText] = pList;
pCurrentChangesList = pList; pCurrentChangesList = pList;
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h> #include <com/sun/star/uno/Sequence.h>
#include <list> #include <vector>
#include <map> #include <map>
class SvXMLExport; class SvXMLExport;
...@@ -37,13 +37,13 @@ namespace com { namespace sun { namespace star { ...@@ -37,13 +37,13 @@ namespace com { namespace sun { namespace star {
} } } } } }
// store a list of redline properties // store a list of redline properties
typedef ::std::list< typedef ::std::vector<
css::uno::Reference<css::beans::XPropertySet> > ChangesListType; css::uno::Reference<css::beans::XPropertySet> > ChangesVectorType;
// store a list of redline properties for each XText // store a list of redline properties for each XText
typedef ::std::map< typedef ::std::map<
css::uno::Reference< css::text::XText>, css::uno::Reference< css::text::XText>,
ChangesListType* > ChangesMapType; ChangesVectorType* > ChangesMapType;
/** /**
...@@ -70,7 +70,7 @@ class XMLRedlineExport ...@@ -70,7 +70,7 @@ class XMLRedlineExport
ChangesMapType aChangeMap; /// map of recorded changes ChangesMapType aChangeMap; /// map of recorded changes
/// list of current changes; is NULL or points to member of aChangeMap /// list of current changes; is NULL or points to member of aChangeMap
ChangesListType* pCurrentChangesList; ChangesVectorType* pCurrentChangesList;
public: public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment