xmloff: C++ is an imperative language, so let's write imperative loops

... instead of some over-engineered pseudo-functional boostified monstrosity.
What the hell was the original author thinking?

Change-Id: I64581b3f78792933373ed8f74ebbb38a8a27f1f8
This commit is contained in:
Michael Stahl
2016-05-06 21:49:36 +02:00
parent f93ab86ea4
commit 7a2afb2d77
3 changed files with 15 additions and 40 deletions

View File

@@ -43,7 +43,6 @@
#include <type_traits>
#include <utility>
#include <vector>
#include <boost/iterator_adaptors.hpp>
#include <osl/diagnose.h>
#include <osl/doublecheckedlocking.h>
#include <osl/endian.h>

View File

@@ -38,14 +38,6 @@
#include <rtl/ustrbuf.hxx>
#include <boost/iterator_adaptors.hpp>
#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp
// N.B.: the check for the header guard _of a specific version of boost_
// is here so this may work on different versions of boost,
// which sadly put the goods in different header files
#include <boost/iterator/transform_iterator.hpp>
#endif
#include <functional>
#include <algorithm>
@@ -165,17 +157,13 @@ RDFaExportHelper::AddRDFa(
xContent->getValue());
}
auto aStatementToCURIE = [this](rdf::Statement const& aStatement) {
return makeCURIE(&this->m_rExport, aStatement.Predicate);
};
::std::vector<::rtl::OUString> curies;
for (rdf::Statement const& rStatement : rStatements)
{
curies.push_back(makeCURIE(&m_rExport, rStatement.Predicate));
}
OUStringBuffer property;
::comphelper::intersperse(
::boost::make_transform_iterator(
rStatements.begin(),
aStatementToCURIE),
::boost::make_transform_iterator(
rStatements.end(),
aStatementToCURIE),
::comphelper::intersperse(curies.begin(), curies.end(),
::comphelper::OUStringBufferAppender(property),
OUString(" "));

View File

@@ -30,14 +30,6 @@
#include <rtl/ustring.hxx>
#include <boost/iterator_adaptors.hpp>
#ifndef BOOST_ITERATOR_ADAPTOR_DWA053000_HPP_ // from iterator_adaptors.hpp
// N.B.: the check for the header guard _of a specific version of boost_
// is here so this may work on different versions of boost,
// which sadly put the goods in different header files
#include <boost/iterator/transform_iterator.hpp>
#endif
#include <map>
#include <iterator>
#include <functional>
@@ -291,7 +283,7 @@ RDFaInserter::MakeURI( OUString const & i_rURI) const
}
}
uno::Reference< rdf::XResource>
uno::Reference<rdf::XResource>
RDFaInserter::MakeResource( OUString const & i_rResource)
{
if (i_rResource.startsWith("_:")) // blank node
@@ -328,18 +320,14 @@ void RDFaInserter::InsertRDFaEntry(
predicates.reserve(i_rEntry.m_xRDFaAttributes->m_Properties.size());
auto aPropertyToXURI = [this](OUString const& aProperty) { return this->MakeURI(aProperty); };
// Store as variable so the type matches in both calls.
::std::remove_copy_if(
::boost::make_transform_iterator(
i_rEntry.m_xRDFaAttributes->m_Properties.begin(),
aPropertyToXURI),
::boost::make_transform_iterator(
i_rEntry.m_xRDFaAttributes->m_Properties.end(),
aPropertyToXURI),
::std::back_inserter(predicates),
[this](uno::Reference<rdf::XURI> const& arRef) { return !arRef.is(); } );
for (OUString const& prop : i_rEntry.m_xRDFaAttributes->m_Properties)
{
auto const xURI(MakeURI(prop));
if (xURI.is())
{
predicates.push_back(xURI);
}
}
if (predicates.empty())
{