summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorMario J. Rugiero <mrugiero@gmail.com>2015-10-30 00:26:23 -0300
committerNoel Grandin <noelgrandin@gmail.com>2015-10-30 06:04:59 +0000
commitf53343320101bfe650f5fe2cdf95f94995778037 (patch)
tree93cb0269c225e6d74b3bca94f754ac0cbfa46200 /xmloff
parent26d5407a5f653e55ec9255117760886bcec4fe15 (diff)
xmloff tree cleanup
- Replaces for_each(*.begin(), *.end(), ...) by its range based for loop equivalents. - Replaces boost::bind calls by C++11 lambdas. - Cleans a few hacks made to workaround boost::bind limitations. Change-Id: Ie88cc651a2a835b03d5037e54e2a61ca93866310 Reviewed-on: https://gerrit.libreoffice.org/19678 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/inc/pch/precompiled_xo.hxx1
-rw-r--r--xmloff/source/chart/SchXMLExport.cxx17
-rw-r--r--xmloff/source/core/RDFaExportHelper.cxx14
-rw-r--r--xmloff/source/core/RDFaImportHelper.cxx33
-rw-r--r--xmloff/source/forms/layerimport.cxx15
5 files changed, 24 insertions, 56 deletions
diff --git a/xmloff/inc/pch/precompiled_xo.hxx b/xmloff/inc/pch/precompiled_xo.hxx
index b78a28a59eae..f11c370fab0a 100644
--- a/xmloff/inc/pch/precompiled_xo.hxx
+++ b/xmloff/inc/pch/precompiled_xo.hxx
@@ -31,7 +31,6 @@
#include <basegfx/tuple/b3dtuple.hxx>
#include <basegfx/vector/b2dvector.hxx>
#include <basegfx/vector/b3dvector.hxx>
-#include <boost/bind.hpp>
#include <boost/iterator_adaptors.hpp>
#include <boost/noncopyable.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx
index 568e3e938c74..ed226f5d0e69 100644
--- a/xmloff/source/chart/SchXMLExport.cxx
+++ b/xmloff/source/chart/SchXMLExport.cxx
@@ -713,18 +713,6 @@ struct lcl_TableData
::std::vector< sal_Int32 > aHiddenColumns;
};
-// ::std::bind2nd( ::std::mem_fun_ref( &T::resize ), nSize ) does not work
-template< class T >
- struct lcl_resize
- {
- lcl_resize( typename T::size_type nSize, typename T::value_type fDefaultValue ) : m_nSize( nSize ), m_fDefaultValue( fDefaultValue ) {}
- void operator()( T & t )
- { t.resize( m_nSize, m_fDefaultValue ); }
- private:
- typename T::size_type m_nSize;
- typename T::value_type m_fDefaultValue;
- };
-
typedef ::std::map< sal_Int32, SchXMLExportHelper_Impl::tLabelValuesDataPair >
lcl_DataSequenceMap;
@@ -818,8 +806,9 @@ lcl_TableData lcl_getDataForLocalTable(
aResult.aDataInRows.resize( nNumRows );
double fNan = 0.0;
::rtl::math::setNan( &fNan );
- ::std::for_each( aResult.aDataInRows.begin(), aResult.aDataInRows.end(),
- lcl_resize< t2DNumberContainer::value_type >( nNumColumns, fNan ));
+
+ for (auto& aData: aResult.aDataInRows)
+ aData.resize(nNumColumns, fNan);
aResult.aColumnDescriptions.resize( nNumColumns );
aResult.aComplexColumnDescriptions.realloc( nNumColumns );
aResult.aRowDescriptions.resize( nNumRows );
diff --git a/xmloff/source/core/RDFaExportHelper.cxx b/xmloff/source/core/RDFaExportHelper.cxx
index a2dd40013ee2..bfce90499f81 100644
--- a/xmloff/source/core/RDFaExportHelper.cxx
+++ b/xmloff/source/core/RDFaExportHelper.cxx
@@ -38,7 +38,6 @@
#include <rtl/ustrbuf.hxx>
-#include <boost/bind.hpp>
#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_
@@ -166,16 +165,17 @@ RDFaExportHelper::AddRDFa(
xContent->getValue());
}
+ auto aStatementToCURIE = [this](rdf::Statement const& aStatement) {
+ return makeCURIE(&this->m_rExport, aStatement.Predicate);
+ };
OUStringBuffer property;
::comphelper::intersperse(
- ::boost::make_transform_iterator(rStatements.begin(),
- ::boost::bind(&makeCURIE, &m_rExport,
- ::boost::bind(&rdf::Statement::Predicate, _1))),
- // argh, this must be the same type :(
+ ::boost::make_transform_iterator(
+ rStatements.begin(),
+ aStatementToCURIE),
::boost::make_transform_iterator(
rStatements.end(),
- ::boost::bind(&makeCURIE, &m_rExport,
- ::boost::bind(&rdf::Statement::Predicate, _1))),
+ aStatementToCURIE),
::comphelper::OUStringBufferAppender(property),
OUString(" "));
diff --git a/xmloff/source/core/RDFaImportHelper.cxx b/xmloff/source/core/RDFaImportHelper.cxx
index ac2738a1aa3c..d2705e557260 100644
--- a/xmloff/source/core/RDFaImportHelper.cxx
+++ b/xmloff/source/core/RDFaImportHelper.cxx
@@ -30,7 +30,6 @@
#include <rtl/ustring.hxx>
-#include <boost/bind.hpp>
#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_
@@ -312,18 +311,6 @@ RDFaInserter::MakeResource( OUString const & i_rResource)
}
}
-/** i wrote this because c++ implementations cannot agree on which variant
- of boost::bind and std::mem_fun_ref applied to Reference::is compiles */
-class ref_is_null :
- public ::std::unary_function<bool, const uno::Reference<rdf::XURI> & >
-{
-public:
- bool operator() (const uno::Reference<rdf::XURI> & i_rRef)
- {
- return !i_rRef.is();
- }
-};
-
void RDFaInserter::InsertRDFaEntry(
struct RDFaEntry const & i_rEntry)
{
@@ -341,22 +328,18 @@ 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(),
- ::boost::bind(&RDFaInserter::MakeURI, this, _1)),
- // argh, this must be the same type :(
+ aPropertyToXURI),
::boost::make_transform_iterator(
i_rEntry.m_xRDFaAttributes->m_Properties.end(),
- ::boost::bind(&RDFaInserter::MakeURI, this, _1)),
+ aPropertyToXURI),
::std::back_inserter(predicates),
- ref_is_null() );
- // compiles only on wntmsci12
-// ::boost::bind( ::std::logical_not<sal_Bool>(), ::boost::bind<sal_Bool>(&uno::Reference<rdf::XURI>::is, _1)));
- // compiles on unxsoli4, wntsci12, but not unxlngi6
-// ::boost::bind( ::std::logical_not<sal_Bool>(), ::boost::bind<sal_Bool, com::sun::star::uno::Reference<rdf::XURI> >(&uno::Reference<rdf::XURI>::is, _1)));
- // compiles on unxsoli4, unxlngi6, but not wntsci12
-// ::std::not1( ::std::mem_fun_ref(&uno::Reference<rdf::XURI>::is)) );
+ [this](uno::Reference<rdf::XURI> const& arRef) { return !arRef.is(); } );
if (predicates.empty())
{
@@ -467,8 +450,8 @@ void RDFaImportHelper::InsertRDFa(
SAL_WARN_IF(!xRepository.is(), "xmloff.core", "InsertRDFa: no DocumentRepository?");
if (!xRepository.is()) return;
RDFaInserter inserter(GetImport().GetComponentContext(), xRepository);
- ::std::for_each(m_RDFaEntries.begin(), m_RDFaEntries.end(),
- ::boost::bind(&RDFaInserter::InsertRDFaEntry, &inserter, _1));
+ for (const auto& RDFaEntry : m_RDFaEntries)
+ inserter.InsertRDFaEntry(RDFaEntry);
}
} // namespace xmloff
diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx
index 453c49009842..97f4592080e9 100644
--- a/xmloff/source/forms/layerimport.cxx
+++ b/xmloff/source/forms/layerimport.cxx
@@ -580,17 +580,14 @@ void OFormLayerXMLImport_Impl::documentDone( )
}
// process XForms-bindings; call registerXFormsValueBinding for each
- std::for_each( m_aXFormsValueBindings.begin(),
- m_aXFormsValueBindings.end(),
- std::bind( bindXFormsValueBinding, rImport.GetModel(), std::placeholders::_1 ) );
+ for (auto& aXFormsValueBinding : m_aXFormsValueBindings)
+ bindXFormsValueBinding(rImport.GetModel(), aXFormsValueBinding);
// same for list bindings
- std::for_each( m_aXFormsListBindings.begin(),
- m_aXFormsListBindings.end(),
- std::bind( bindXFormsListBinding, rImport.GetModel(), std::placeholders::_1 ) );
+ for (auto& aXFormsListBindings : m_aXFormsListBindings)
+ bindXFormsListBinding(rImport.GetModel(), aXFormsListBindings);
// same for submissions
- std::for_each( m_aXFormsSubmissions.begin(),
- m_aXFormsSubmissions.end(),
- std::bind( bindXFormsSubmission, rImport.GetModel(), std::placeholders::_1 ) );
+ for (auto& aXFormsSubmission : m_aXFormsSubmissions)
+ bindXFormsSubmission(rImport.GetModel(), aXFormsSubmission);
}
} // namespace xmloff