Kaydet (Commit) ba3a9184 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Remove trivial class XMLTransformerContextVector

Change-Id: I140614895d5727ffd97681ddd06bf7439fe7a443
üst 21e72c5f
...@@ -19,8 +19,11 @@ ...@@ -19,8 +19,11 @@
#ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_CHARTPLOTAREAOOOTCONTEXT_HXX #ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_CHARTPLOTAREAOOOTCONTEXT_HXX
#define INCLUDED_XMLOFF_SOURCE_TRANSFORM_CHARTPLOTAREAOOOTCONTEXT_HXX #define INCLUDED_XMLOFF_SOURCE_TRANSFORM_CHARTPLOTAREAOOOTCONTEXT_HXX
#include <sal/config.h>
#include <vector>
#include "ProcAttrTContext.hxx" #include "ProcAttrTContext.hxx"
#include "TContextVector.hxx"
class XMLAxisOOoContext; class XMLAxisOOoContext;
......
...@@ -17,11 +17,14 @@ ...@@ -17,11 +17,14 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <sal/config.h>
#include <vector>
#include "CreateElemTContext.hxx" #include "CreateElemTContext.hxx"
#include "MutableAttrList.hxx" #include "MutableAttrList.hxx"
#include "TransformerBase.hxx" #include "TransformerBase.hxx"
#include "TransformerActions.hxx" #include "TransformerActions.hxx"
#include "TContextVector.hxx"
#include "FlatTContext.hxx" #include "FlatTContext.hxx"
#include "AttrTransformerAction.hxx" #include "AttrTransformerAction.hxx"
#include <xmloff/nmspmap.hxx> #include <xmloff/nmspmap.hxx>
...@@ -49,7 +52,7 @@ void XMLCreateElemTransformerContext::StartElement( ...@@ -49,7 +52,7 @@ void XMLCreateElemTransformerContext::StartElement(
{ {
Reference< XAttributeList > xAttrList( rAttrList ); Reference< XAttributeList > xAttrList( rAttrList );
XMLTransformerContextVector aChildContexts; std::vector<rtl::Reference<XMLTransformerContext>> aChildContexts;
XMLMutableAttributeList *pMutableAttrList = nullptr; XMLMutableAttributeList *pMutableAttrList = nullptr;
XMLTransformerActions *pActions = XMLTransformerActions *pActions =
...@@ -106,11 +109,9 @@ void XMLCreateElemTransformerContext::StartElement( ...@@ -106,11 +109,9 @@ void XMLCreateElemTransformerContext::StartElement(
} }
XMLTransformerContext::StartElement( xAttrList ); XMLTransformerContext::StartElement( xAttrList );
XMLTransformerContextVector::iterator aIter = aChildContexts.begin(); for (auto const & i: aChildContexts)
for( ; aIter != aChildContexts.end(); ++aIter )
{ {
(*aIter)->Export(); i->Export();
} }
} }
......
...@@ -152,11 +152,9 @@ rtl::Reference<XMLTransformerContext> XMLPersElemContentTContext::CreateChildCon ...@@ -152,11 +152,9 @@ rtl::Reference<XMLTransformerContext> XMLPersElemContentTContext::CreateChildCon
void XMLPersElemContentTContext::ExportContent() void XMLPersElemContentTContext::ExportContent()
{ {
XMLTransformerContextVector::iterator aIter = m_aChildContexts.begin(); for (auto const & i: m_aChildContexts)
for( ; aIter != m_aChildContexts.end(); ++aIter )
{ {
(*aIter)->Export(); i->Export();
} }
} }
......
...@@ -24,11 +24,10 @@ ...@@ -24,11 +24,10 @@
#include <vector> #include <vector>
#include "PersAttrListTContext.hxx" #include "PersAttrListTContext.hxx"
#include "TContextVector.hxx"
class XMLPersElemContentTContext : public XMLPersAttrListTContext class XMLPersElemContentTContext : public XMLPersAttrListTContext
{ {
XMLTransformerContextVector m_aChildContexts; std::vector<rtl::Reference<XMLTransformerContext>> m_aChildContexts;
public: public:
// element content persistence only // element content persistence only
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_TCONTEXTVECTOR_HXX
#define INCLUDED_XMLOFF_SOURCE_TRANSFORM_TCONTEXTVECTOR_HXX
#include <rtl/ref.hxx>
#include <vector>
#include "TransformerContext.hxx"
class XMLTransformerContextVector :
public ::std::vector< ::rtl::Reference< XMLTransformerContext > >
{
};
#endif // INCLUDED_XMLOFF_SOURCE_TRANSFORM_TCONTEXTVECTOR_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include "TransformerTokenMap.hxx" #include "TransformerTokenMap.hxx"
#include "TransformerBase.hxx" #include "TransformerBase.hxx"
#include "TContextVector.hxx"
using namespace ::osl; using namespace ::osl;
using namespace ::xmloff::token; using namespace ::xmloff::token;
...@@ -187,7 +186,6 @@ XMLTransformerBase::XMLTransformerBase( XMLTransformerActionInit *pInit, ...@@ -187,7 +186,6 @@ XMLTransformerBase::XMLTransformerBase( XMLTransformerActionInit *pInit,
throw () : throw () :
m_pNamespaceMap( new SvXMLNamespaceMap ), m_pNamespaceMap( new SvXMLNamespaceMap ),
m_pReplaceNamespaceMap( new SvXMLNamespaceMap ), m_pReplaceNamespaceMap( new SvXMLNamespaceMap ),
m_pContexts( new XMLTransformerContextVector ),
m_pElemActions( new XMLTransformerActions( pInit ) ), m_pElemActions( new XMLTransformerActions( pInit ) ),
m_pTokenMap( new XMLTransformerTokenMap( pTKMapInit ) ) m_pTokenMap( new XMLTransformerTokenMap( pTKMapInit ) )
{ {
...@@ -204,7 +202,6 @@ XMLTransformerBase::~XMLTransformerBase() throw () ...@@ -204,7 +202,6 @@ XMLTransformerBase::~XMLTransformerBase() throw ()
{ {
delete m_pNamespaceMap; delete m_pNamespaceMap;
delete m_pReplaceNamespaceMap; delete m_pReplaceNamespaceMap;
delete m_pContexts;
delete m_pElemActions; delete m_pElemActions;
delete m_pTokenMap; delete m_pTokenMap;
} }
...@@ -288,9 +285,9 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName, ...@@ -288,9 +285,9 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName,
// If there are contexts already, call a CreateChildContext at the topmost // If there are contexts already, call a CreateChildContext at the topmost
// context. Otherwise, create a default context. // context. Otherwise, create a default context.
::rtl::Reference < XMLTransformerContext > xContext; ::rtl::Reference < XMLTransformerContext > xContext;
if( !m_pContexts->empty() ) if( !m_pContexts.empty() )
{ {
xContext = m_pContexts->back()->CreateChildContext( nPrefix, xContext = m_pContexts.back()->CreateChildContext( nPrefix,
aLocalName, aLocalName,
rName, rName,
xAttrList ); xAttrList );
...@@ -309,7 +306,7 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName, ...@@ -309,7 +306,7 @@ void SAL_CALL XMLTransformerBase::startElement( const OUString& rName,
xContext->SetRewindMap( pRewindMap ); xContext->SetRewindMap( pRewindMap );
// Push context on stack. // Push context on stack.
m_pContexts->push_back( xContext ); m_pContexts.push_back( xContext );
// Call a startElement at the new context. // Call a startElement at the new context.
xContext->StartElement( xAttrList ); xContext->StartElement( xAttrList );
...@@ -322,10 +319,10 @@ rName ...@@ -322,10 +319,10 @@ rName
) )
throw(SAXException, RuntimeException, std::exception) throw(SAXException, RuntimeException, std::exception)
{ {
if( !m_pContexts->empty() ) if( !m_pContexts.empty() )
{ {
// Get topmost context // Get topmost context
::rtl::Reference< XMLTransformerContext > xContext = m_pContexts->back(); ::rtl::Reference< XMLTransformerContext > xContext = m_pContexts.back();
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
OSL_ENSURE( xContext->GetQName() == rName, OSL_ENSURE( xContext->GetQName() == rName,
...@@ -336,7 +333,7 @@ rName ...@@ -336,7 +333,7 @@ rName
xContext->EndElement(); xContext->EndElement();
// and remove it from the stack. // and remove it from the stack.
m_pContexts->pop_back(); m_pContexts.pop_back();
// Get a namespace map to rewind. // Get a namespace map to rewind.
SvXMLNamespaceMap *pRewindMap = xContext->GetRewindMap(); SvXMLNamespaceMap *pRewindMap = xContext->GetRewindMap();
...@@ -356,9 +353,9 @@ rName ...@@ -356,9 +353,9 @@ rName
void SAL_CALL XMLTransformerBase::characters( const OUString& rChars ) void SAL_CALL XMLTransformerBase::characters( const OUString& rChars )
throw(SAXException, RuntimeException, std::exception) throw(SAXException, RuntimeException, std::exception)
{ {
if( !m_pContexts->empty() ) if( !m_pContexts.empty() )
{ {
m_pContexts->back()->Characters( rChars ); m_pContexts.back()->Characters( rChars );
} }
} }
...@@ -852,7 +849,7 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList( ...@@ -852,7 +849,7 @@ XMLMutableAttributeList *XMLTransformerBase::ProcessAttrList(
case XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY: case XML_ATACTION_WRITER_BACK_GRAPHIC_TRANSPARENCY:
{ {
// determine, if it's the transparency of a document style // determine, if it's the transparency of a document style
XMLTransformerContext* pFirstContext = (*m_pContexts)[0].get(); XMLTransformerContext* pFirstContext = m_pContexts[0].get();
OUString aFirstContextLocalName; OUString aFirstContextLocalName;
/* sal_uInt16 nFirstContextPrefix = */ /* sal_uInt16 nFirstContextPrefix = */
GetNamespaceMap().GetKeyByAttrName( pFirstContext->GetQName(), GetNamespaceMap().GetKeyByAttrName( pFirstContext->GetQName(),
...@@ -1427,23 +1424,20 @@ XMLTokenEnum XMLTransformerBase::GetToken( const OUString& rStr ) const ...@@ -1427,23 +1424,20 @@ XMLTokenEnum XMLTransformerBase::GetToken( const OUString& rStr ) const
const XMLTransformerContext *XMLTransformerBase::GetCurrentContext() const const XMLTransformerContext *XMLTransformerBase::GetCurrentContext() const
{ {
OSL_ENSURE( !m_pContexts->empty(), "empty stack" ); OSL_ENSURE( !m_pContexts.empty(), "empty stack" );
return m_pContexts->empty() ? nullptr : m_pContexts->back().get(); return m_pContexts.empty() ? nullptr : m_pContexts.back().get();
} }
const XMLTransformerContext *XMLTransformerBase::GetAncestorContext( const XMLTransformerContext *XMLTransformerBase::GetAncestorContext(
sal_uInt32 n ) const sal_uInt32 n ) const
{ {
XMLTransformerContextVector::size_type nSize = auto nSize = m_pContexts.size();
m_pContexts->size();
XMLTransformerContextVector::size_type nPos =
static_cast<XMLTransformerContextVector::size_type>( n );
OSL_ENSURE( nSize >nPos+2 , "invalid context" ); OSL_ENSURE( nSize > n + 2 , "invalid context" );
return nSize > nPos+2 ? (*m_pContexts)[nSize-(nPos+2)].get() : nullptr; return nSize > n + 2 ? m_pContexts[nSize - (n + 2)].get() : nullptr;
} }
bool XMLTransformerBase::isWriter() const bool XMLTransformerBase::isWriter() const
......
...@@ -20,12 +20,17 @@ ...@@ -20,12 +20,17 @@
#ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERBASE_HXX #ifndef INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERBASE_HXX
#define INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERBASE_HXX #define INCLUDED_XMLOFF_SOURCE_TRANSFORM_TRANSFORMERBASE_HXX
#include <sal/config.h>
#include <vector>
#include <com/sun/star/xml/sax/SAXParseException.hpp> #include <com/sun/star/xml/sax/SAXParseException.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp> #include <com/sun/star/xml/sax/SAXException.hpp>
#include <com/sun/star/xml/sax/XAttributeList.hpp> #include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/xml/sax/XLocator.hpp> #include <com/sun/star/xml/sax/XLocator.hpp>
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XModel.hpp>
#include <rtl/ref.hxx>
#include <xmloff/xmltoken.hxx> #include <xmloff/xmltoken.hxx>
#include "Transformer.hxx" #include "Transformer.hxx"
...@@ -36,7 +41,6 @@ namespace com { namespace sun { namespace star { ...@@ -36,7 +41,6 @@ namespace com { namespace sun { namespace star {
class SvXMLNamespaceMap; class SvXMLNamespaceMap;
class XMLTransformerContext; class XMLTransformerContext;
class XMLTransformerContextVector;
class XMLTransformerActions; class XMLTransformerActions;
struct XMLTransformerActionInit; struct XMLTransformerActionInit;
struct TransformerAction_Impl; struct TransformerAction_Impl;
...@@ -60,7 +64,7 @@ class XMLTransformerBase : public XMLTransformer ...@@ -60,7 +64,7 @@ class XMLTransformerBase : public XMLTransformer
SvXMLNamespaceMap *m_pNamespaceMap; SvXMLNamespaceMap *m_pNamespaceMap;
SvXMLNamespaceMap *m_pReplaceNamespaceMap; SvXMLNamespaceMap *m_pReplaceNamespaceMap;
XMLTransformerContextVector *m_pContexts; std::vector<rtl::Reference<XMLTransformerContext>> m_pContexts;
XMLTransformerActions *m_pElemActions; XMLTransformerActions *m_pElemActions;
XMLTransformerTokenMap *m_pTokenMap; XMLTransformerTokenMap *m_pTokenMap;
......
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