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 <type_traits>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <boost/iterator_adaptors.hpp>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <osl/doublecheckedlocking.h> #include <osl/doublecheckedlocking.h>
#include <osl/endian.h> #include <osl/endian.h>

View File

@@ -38,14 +38,6 @@
#include <rtl/ustrbuf.hxx> #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 <functional>
#include <algorithm> #include <algorithm>
@@ -165,17 +157,13 @@ RDFaExportHelper::AddRDFa(
xContent->getValue()); xContent->getValue());
} }
auto aStatementToCURIE = [this](rdf::Statement const& aStatement) { ::std::vector<::rtl::OUString> curies;
return makeCURIE(&this->m_rExport, aStatement.Predicate); for (rdf::Statement const& rStatement : rStatements)
}; {
curies.push_back(makeCURIE(&m_rExport, rStatement.Predicate));
}
OUStringBuffer property; OUStringBuffer property;
::comphelper::intersperse( ::comphelper::intersperse(curies.begin(), curies.end(),
::boost::make_transform_iterator(
rStatements.begin(),
aStatementToCURIE),
::boost::make_transform_iterator(
rStatements.end(),
aStatementToCURIE),
::comphelper::OUStringBufferAppender(property), ::comphelper::OUStringBufferAppender(property),
OUString(" ")); OUString(" "));

View File

@@ -30,14 +30,6 @@
#include <rtl/ustring.hxx> #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 <map>
#include <iterator> #include <iterator>
#include <functional> #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) RDFaInserter::MakeResource( OUString const & i_rResource)
{ {
if (i_rResource.startsWith("_:")) // blank node if (i_rResource.startsWith("_:")) // blank node
@@ -328,18 +320,14 @@ void RDFaInserter::InsertRDFaEntry(
predicates.reserve(i_rEntry.m_xRDFaAttributes->m_Properties.size()); predicates.reserve(i_rEntry.m_xRDFaAttributes->m_Properties.size());
auto aPropertyToXURI = [this](OUString const& aProperty) { return this->MakeURI(aProperty); }; for (OUString const& prop : i_rEntry.m_xRDFaAttributes->m_Properties)
// Store as variable so the type matches in both calls. {
auto const xURI(MakeURI(prop));
::std::remove_copy_if( if (xURI.is())
::boost::make_transform_iterator( {
i_rEntry.m_xRDFaAttributes->m_Properties.begin(), predicates.push_back(xURI);
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(); } );
if (predicates.empty()) if (predicates.empty())
{ {