From 7037d86a00add3eea69937807d5c40f12d39032b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 19 Oct 2024 01:35:36 +0200 Subject: [PATCH] Add tool to reduce relince on boost Inspired by https://github.com/Ardour/ardour/pull/914 --- tools/convert_boost.sh | 74 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 tools/convert_boost.sh diff --git a/tools/convert_boost.sh b/tools/convert_boost.sh new file mode 100755 index 0000000000..6e3cacecde --- /dev/null +++ b/tools/convert_boost.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +for file in `ag -l 'boost::unordered_map' libs gtk2_ardour` ; do + sed -i'' 's/boost::unordered_map/std::unordered_map/g' $file + sed -i'' 's/#include /#include /' $file +done + +for file in `ag -l 'BOOST_STATIC_ASSERT' libs gtk2_ardour` ; do + sed -i'' 's/BOOST_STATIC_ASSERT/static_assert/g' $file + sed -i'' '/#include /d' $file +done + +for file in `ag -l 'BOOST_FOREACH' libs gtk2_ardour` ; do + sed -i'' 's/BOOST_FOREACH *(\([^,]*\),\(.*\)/for (\1 :\2/' $file + sed -i'' '/#include /d' $file +done + +for file in `ag -l 'boost::tuple' libs gtk2_ardour` ; do + sed -i'' 's/boost::tuple/std::tuple/g' $file + sed -i'' 's/#include /#include /' $file + sed -i'' '/#include /d' $file +done + +for file in `ag -l 'boost::math::isnormal' libs gtk2_ardour` ; do + sed -i'' 's/boost::math::isnormal/std::isnormal/' $file + sed -i'' '/#include /d' $file +done + +for file in `ag -l 'boost::container::set' libs gtk2_ardour` ; do + sed -i'' 's/boost::container::set/std::set/' $file + sed -i'' '/#include /d' $file +done + +for file in `ag -l 'boost::none' libs gtk2_ardour` ; do + sed -i'' 's/boost::none/std::nullopt/' $file + sed -i'' '/#include /d' $file +done + +for file in `ag -l 'boost::optional' libs gtk2_ardour` ; do + sed -i'' 's/boost::optional/std::optional/' $file + sed -i'' 's/#include /#include /' $file +done + +for file in `ag -l 'boost::function' libs gtk2_ardour luasession session_utils` ; do + sed -i'' 's/boost::function1<\([^,]*\),\([^>]*\)>/std::function<\1 (\2)>/g' $file + sed -i'' 's/boost::function0<\([^>]*\)>/std::function<\1 ()>/g' $file + sed -i'' 's/boost::function0/std::function/g' $file + sed -i'' 's/boost::function/std::function/g' $file + sed -i'' '/#include /d' $file +done + +for file in `ag -l 'boost::bind' libs gtk2_ardour headless luasession` ; do + sed -i'' 's/boost::bind/std::bind/g;s/boost::type (),//' $file +done + +for file in `ag -l 'boost::ref' libs gtk2_ardour` ; do + sed -i'' 's/boost::ref/std::ref/g' $file +done + +for file in `ag -l ' boost::lambda::' libs gtk2_ardour` ; do + sed -i'' 's/ boost::lambda:://g' $file +done + +for file in `ag -l 'boost/bind.hpp' libs gtk2_ardour` ; do + sed -i'' '/#include /d' $file +done + +for file in `ag -l 'boost/lambda/lambda.hpp' libs gtk2_ardour` ; do + sed -i'' '/#include /d' $file +done + +for file in `ag -l 'boost::scoped_array' libs gtk2_ardour` ; do + sed -i'' 's/boost::scoped_array *<\([^>]*\)>/std::unique_ptr<\1[]>' $file +done