diff --git a/CMakeLists.txt b/CMakeLists.txt index feb70aa4..98364324 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,6 @@ else() find_package(NIBoost REQUIRED) add_library(Boost::boost ALIAS boost_header_only_interface) add_library(Boost::iostreams ALIAS boost_iostreams) - add_library(Boost::filesystem ALIAS boost_filesystem) add_library(Boost::system ALIAS boost_system) add_library(Boost::program_options ALIAS boost_program_options) @@ -104,7 +103,7 @@ endif() foreach( target audiostream audiostream_test pcm_test generator ) if( TARGET ${target} ) if( NIMEDIA_OPEN_SOURCE ) - set_property( TARGET ${target} PROPERTY CXX_STANDARD 14) + set_property( TARGET ${target} PROPERTY CXX_STANDARD 17) if( NIMEDIA_TREAT_WARNINGS_AS_ERRORS ) ni_treat_warnings_as_errors( ${target} ) endif() diff --git a/audiostream/CMakeLists.txt b/audiostream/CMakeLists.txt index ace785c7..f0a495b8 100644 --- a/audiostream/CMakeLists.txt +++ b/audiostream/CMakeLists.txt @@ -314,7 +314,7 @@ target_include_directories ( audiostream ) target_link_libraries ( audiostream PUBLIC pcm - PRIVATE Boost::iostreams Boost::filesystem Boost::system ${codec_libraries}) + PRIVATE Boost::iostreams Boost::system ${codec_libraries}) if(MSVC) target_compile_options( audiostream PRIVATE /wd4351 ) # MSVC new behaviour warning diff --git a/audiostream/doc/ifstream.md b/audiostream/doc/ifstream.md index 04ddf484..b0d0bcd1 100644 --- a/audiostream/doc/ifstream.md +++ b/audiostream/doc/ifstream.md @@ -15,7 +15,7 @@ The constructor will throw a runtime error if the file format is not supported o Example code: ```cpp -void analyze_file( const std::string& filename ) +void analyze_file( const std::filesystem::path& filename ) { audio::ifstream stream; try @@ -36,7 +36,7 @@ void analyze_file( const std::string& filename ) You can also allow only a specific container: ```cpp -void analyze_wav_file( const std::string& filename ) +void analyze_wav_file( const std::filesystem::path& filename ) { audio::ifstream stream; try @@ -58,7 +58,7 @@ An `audio::ifstream` also supports multi stream containers, which allows us to s By default, an `audio::ifstream` will open the Stems Master Stream, but is also capable of opening any of the other streams by simply passing the desired stream index as argument to the constructor: ```cpp -void analyze_stem_stream( const std::string& filename, size_t stream_index ) +void analyze_stem_stream( const std::filesystem::path& filename, size_t stream_index ) { audio::ifstream stream; try diff --git a/audiostream/inc/ni/media/audio/aiff/aiff_ofstream.h b/audiostream/inc/ni/media/audio/aiff/aiff_ofstream.h index 0dfe9116..663353dc 100644 --- a/audiostream/inc/ni/media/audio/aiff/aiff_ofstream.h +++ b/audiostream/inc/ni/media/audio/aiff/aiff_ofstream.h @@ -25,6 +25,8 @@ #include #include +#include + namespace audio { @@ -38,7 +40,7 @@ class aiff_ofstream : public ofstream aiff_ofstream( aiff_ofstream&& ); aiff_ofstream& operator=( aiff_ofstream&& ); - aiff_ofstream( const std::string& file, const info_type& info ); + aiff_ofstream( const std::filesystem::path& file, const info_type& info ); const info_type& info() const override; }; diff --git a/audiostream/inc/ni/media/audio/ifstream.h b/audiostream/inc/ni/media/audio/ifstream.h index b77c5890..54613b81 100644 --- a/audiostream/inc/ni/media/audio/ifstream.h +++ b/audiostream/inc/ni/media/audio/ifstream.h @@ -25,6 +25,7 @@ #include #include +#include #include namespace audio @@ -37,8 +38,8 @@ class ifstream : public istream ifstream(); - ifstream( const std::string& file ); - ifstream( const std::string& file, info_type::container_type container, size_t stream_index = 0 ); + ifstream( const std::filesystem::path& file ); + ifstream( const std::filesystem::path& file, info_type::container_type container, size_t stream_index = 0 ); ifstream( ifstream&& ); ifstream& operator=( ifstream&& ); diff --git a/audiostream/inc/ni/media/audio/ifstream_support.h b/audiostream/inc/ni/media/audio/ifstream_support.h index 96ac5da9..895b4e87 100644 --- a/audiostream/inc/ni/media/audio/ifstream_support.h +++ b/audiostream/inc/ni/media/audio/ifstream_support.h @@ -24,16 +24,16 @@ #include +#include #include -#include namespace audio { // a map of extension => container type -using ifstream_container_map = std::map; +using ifstream_container_map = std::map; auto ifstream_supported_formats() -> const ifstream_container_map&; - + } // namespace audio diff --git a/audiostream/inc/ni/media/audio/wav/wav_ofstream.h b/audiostream/inc/ni/media/audio/wav/wav_ofstream.h index 4c137d2d..bbe67e81 100644 --- a/audiostream/inc/ni/media/audio/wav/wav_ofstream.h +++ b/audiostream/inc/ni/media/audio/wav/wav_ofstream.h @@ -25,6 +25,8 @@ #include #include +#include + namespace audio { @@ -39,7 +41,7 @@ class wav_ofstream : public ofstream wav_ofstream( wav_ofstream&& ); wav_ofstream& operator=( wav_ofstream&& ); - wav_ofstream( const std::string& file, const info_type& info ); + wav_ofstream( const std::filesystem::path& file, const info_type& info ); const info_type& info() const override; }; diff --git a/audiostream/src/ni/media/audio/aiff/aiff_file_sink.h b/audiostream/src/ni/media/audio/aiff/aiff_file_sink.h index be2d96a3..94f549b8 100644 --- a/audiostream/src/ni/media/audio/aiff/aiff_file_sink.h +++ b/audiostream/src/ni/media/audio/aiff/aiff_file_sink.h @@ -26,15 +26,15 @@ #include -#include +#include class aiff_file_sink : public aiff_sink { using base_type = aiff_sink; public: - explicit aiff_file_sink( const info_type& info, const std::string& path ) - : base_type( info, boost::filesystem::path( path ), BOOST_IOS::binary | BOOST_IOS::out ) + explicit aiff_file_sink( const info_type& info, const std::filesystem::path& path ) + : base_type( info, path, BOOST_IOS::binary | BOOST_IOS::out ) { } }; diff --git a/audiostream/src/ni/media/audio/aiff/aiff_file_source.h b/audiostream/src/ni/media/audio/aiff/aiff_file_source.h index 3bcc2082..b2e656c7 100644 --- a/audiostream/src/ni/media/audio/aiff/aiff_file_source.h +++ b/audiostream/src/ni/media/audio/aiff/aiff_file_source.h @@ -26,15 +26,15 @@ #include -#include +#include class aiff_file_source : public aiff_source { using base_type = aiff_source; public: - explicit aiff_file_source( const std::string& path ) - : base_type( boost::filesystem::path( path ), BOOST_IOS::binary | BOOST_IOS::in ) + explicit aiff_file_source( const std::filesystem::path& path ) + : base_type( path, BOOST_IOS::binary | BOOST_IOS::in ) { } }; diff --git a/audiostream/src/ni/media/audio/aiff/aiff_ofstream.cpp b/audiostream/src/ni/media/audio/aiff/aiff_ofstream.cpp index 161d3c6c..472993bb 100644 --- a/audiostream/src/ni/media/audio/aiff/aiff_ofstream.cpp +++ b/audiostream/src/ni/media/audio/aiff/aiff_ofstream.cpp @@ -51,7 +51,7 @@ aiff_ofstream& aiff_ofstream::operator=( aiff_ofstream&& other ) //---------------------------------------------------------------------------------------------------------------------- -aiff_ofstream::aiff_ofstream( const std::string& file, const info_type& info ) +aiff_ofstream::aiff_ofstream( const std::filesystem::path& file, const info_type& info ) : ofstream( make_stream_buffer( aiff_file_sink( info, file ) ), make_info( info ) ) { } diff --git a/audiostream/src/ni/media/audio/flac/flac_file_source.h b/audiostream/src/ni/media/audio/flac/flac_file_source.h index 5066bcd1..82ca6c1c 100644 --- a/audiostream/src/ni/media/audio/flac/flac_file_source.h +++ b/audiostream/src/ni/media/audio/flac/flac_file_source.h @@ -27,16 +27,15 @@ #include -#include +#include class flac_file_source : public source_impl> { using base_type = source_impl>; public: - explicit flac_file_source( const std::string& path ) - : base_type( - boost::iostreams::file_descriptor_source( boost::filesystem::path( path ), BOOST_IOS::binary | BOOST_IOS::in ) ) + explicit flac_file_source( const std::filesystem::path& path ) + : base_type( boost::iostreams::file_descriptor_source( path, BOOST_IOS::binary | BOOST_IOS::in ) ) { } }; diff --git a/audiostream/src/ni/media/audio/ifstream.cpp b/audiostream/src/ni/media/audio/ifstream.cpp index fc6241f0..43665da4 100644 --- a/audiostream/src/ni/media/audio/ifstream.cpp +++ b/audiostream/src/ni/media/audio/ifstream.cpp @@ -47,13 +47,13 @@ ifstream::ifstream( std::unique_ptr sb, std::unique_ptr in //---------------------------------------------------------------------------------------------------------------------- -ifstream::ifstream( const std::string& file ) +ifstream::ifstream( const std::filesystem::path& file ) : ifstream() { #if NIMEDIA_ENABLE_ITUNES_DECODING if ( is_itunes_url( file ) ) { - auto source = avassetreader_source( file, 0 ); + auto source = avassetreader_source( file.string(), 0 ); auto info = source.info(); *this = ifstream( make_stream_buffer( std::move( source ) ), std::make_unique( std::move( info ) ) ); return; @@ -69,7 +69,7 @@ ifstream::ifstream( const std::string& file ) //---------------------------------------------------------------------------------------------------------------------- -ifstream::ifstream( const std::string& file, ifstream_info::container_type container, size_t stream_index ) +ifstream::ifstream( const std::filesystem::path& file, ifstream_info::container_type container, size_t stream_index ) : ifstream() { using container_type = ifstream_info::container_type; diff --git a/audiostream/src/ni/media/audio/iotools.cpp b/audiostream/src/ni/media/audio/iotools.cpp index dfb8200f..4bdf5b80 100644 --- a/audiostream/src/ni/media/audio/iotools.cpp +++ b/audiostream/src/ni/media/audio/iotools.cpp @@ -27,7 +27,6 @@ #include #include -#include #include namespace audio @@ -97,13 +96,13 @@ auto ofstream_map() -> const std::map -auto container_of( const std::string& url, const Map& map ) -> boost::optional +auto container_of( const std::filesystem::path& url, const Map& map ) -> boost::optional { - auto extension = extension_from_url( url ); + const auto extension = extension_from_url( url ); if ( extension.empty() ) return {}; - auto it = map.find( boost::to_lower_copy( extension ) ); + const auto it = map.find( boost::to_lower_copy( extension.string() ) ); if ( it == map.end() ) return {}; @@ -114,15 +113,15 @@ auto container_of( const std::string& url, const Map& map ) -> boost::optional boost::optional +auto ifstream_container( const std::filesystem::path& url ) -> boost::optional { return container_of( url, ifstream_supported_formats() ); } @@ -149,21 +147,21 @@ auto ifstream_container( const std::string& url ) -> boost::optional boost::optional +auto ofstream_container( const std::filesystem::path& url ) -> boost::optional { return container_of( url, ofstream_map() ); } //---------------------------------------------------------------------------------------------------------------------- -bool can_read_file( const std::string& url ) +bool can_read_file( const std::filesystem::path& url ) { return ifstream_container( url ) != boost::none; } //---------------------------------------------------------------------------------------------------------------------- -bool can_read_file( const std::string& url, std::set supported_containers ) +bool can_read_file( const std::filesystem::path& url, std::set supported_containers ) { if ( auto container = ifstream_container( url ) ) return supported_containers.find( *container ) != supported_containers.end(); diff --git a/audiostream/src/ni/media/audio/iotools.h b/audiostream/src/ni/media/audio/iotools.h index 120d3baf..8e14fe03 100644 --- a/audiostream/src/ni/media/audio/iotools.h +++ b/audiostream/src/ni/media/audio/iotools.h @@ -27,21 +27,22 @@ #include +#include #include #include namespace audio { -auto ifstream_container( const std::string& url ) -> boost::optional; -auto ofstream_container( const std::string& url ) -> boost::optional; +auto ifstream_container( const std::filesystem::path& url ) -> boost::optional; +auto ofstream_container( const std::filesystem::path& url ) -> boost::optional; -auto is_itunes_url( const std::string& url ) -> bool; -auto extension_from_url( const std::string& url ) -> std::string; +auto is_itunes_url( const std::filesystem::path& url ) -> bool; +auto extension_from_url( const std::filesystem::path& url ) -> std::filesystem::path; -bool can_read_file( const std::string& url ); -bool can_read_file( const std::string& url, std::set supported_containers ); +bool can_read_file( const std::filesystem::path& url ); +bool can_read_file( const std::filesystem::path& url, std::set supported_containers ); -bool can_write_file( const std::string& url ); -bool can_write_file( const std::string& url, std::set supported_containers ); +bool can_write_file( const std::filesystem::path& url ); +bool can_write_file( const std::filesystem::path& url, std::set supported_containers ); } diff --git a/audiostream/src/ni/media/audio/mp3/mp3_file_source.h b/audiostream/src/ni/media/audio/mp3/mp3_file_source.h index 4eaffdee..98b1a4ec 100644 --- a/audiostream/src/ni/media/audio/mp3/mp3_file_source.h +++ b/audiostream/src/ni/media/audio/mp3/mp3_file_source.h @@ -26,17 +26,16 @@ #include // basic_file -#include +#include class mp3_file_source : public os_source { using base_type = os_source; public: - explicit mp3_file_source( const std::string& path ) - : base_type( - boost::iostreams::file_descriptor_source( boost::filesystem::path( path ), BOOST_IOS::binary | BOOST_IOS::in ), - audio::ifstream_info::container_type::mp3 ) + explicit mp3_file_source( const std::filesystem::path& path ) + : base_type( boost::iostreams::file_descriptor_source( path, BOOST_IOS::binary | BOOST_IOS::in ), + audio::ifstream_info::container_type::mp3 ) { } }; diff --git a/audiostream/src/ni/media/audio/mp4/mp4_file_source.h b/audiostream/src/ni/media/audio/mp4/mp4_file_source.h index f0c43dd6..e13ca788 100644 --- a/audiostream/src/ni/media/audio/mp4/mp4_file_source.h +++ b/audiostream/src/ni/media/audio/mp4/mp4_file_source.h @@ -26,18 +26,17 @@ #include -#include +#include class mp4_file_source : public os_source { using base_type = os_source; public: - explicit mp4_file_source( const std::string& path, size_t stream = 0 ) - : base_type( - boost::iostreams::file_descriptor_source( boost::filesystem::path( path ), BOOST_IOS::binary | BOOST_IOS::in ), - audio::ifstream_info::container_type::mp4, - stream ) + explicit mp4_file_source( const std::filesystem::path& path, size_t stream = 0 ) + : base_type( boost::iostreams::file_descriptor_source( path, BOOST_IOS::binary | BOOST_IOS::in ), + audio::ifstream_info::container_type::mp4, + stream ) { } }; diff --git a/audiostream/src/ni/media/audio/ogg/ogg_file_source.h b/audiostream/src/ni/media/audio/ogg/ogg_file_source.h index 09afbaf9..e6a0fc62 100644 --- a/audiostream/src/ni/media/audio/ogg/ogg_file_source.h +++ b/audiostream/src/ni/media/audio/ogg/ogg_file_source.h @@ -27,16 +27,15 @@ #include -#include +#include class ogg_file_source : public source_impl> { using base_type = source_impl>; public: - explicit ogg_file_source( const std::string& path ) - : base_type( - boost::iostreams::file_descriptor_source( boost::filesystem::path( path ), BOOST_IOS::binary | BOOST_IOS::in ) ) + explicit ogg_file_source( const std::filesystem::path& path ) + : base_type( boost::iostreams::file_descriptor_source( path, BOOST_IOS::binary | BOOST_IOS::in ) ) { } }; diff --git a/audiostream/src/ni/media/audio/wav/wav_file_sink.h b/audiostream/src/ni/media/audio/wav/wav_file_sink.h index 92dea19e..9613c4a3 100644 --- a/audiostream/src/ni/media/audio/wav/wav_file_sink.h +++ b/audiostream/src/ni/media/audio/wav/wav_file_sink.h @@ -26,15 +26,15 @@ #include -#include +#include class wav_file_sink : public wav_sink { using base_type = wav_sink; public: - explicit wav_file_sink( const info_type& info, const std::string& path ) - : base_type( info, boost::filesystem::path( path ), BOOST_IOS::binary | BOOST_IOS::out ) + explicit wav_file_sink( const info_type& info, const std::filesystem::path& path ) + : base_type( info, path, BOOST_IOS::binary | BOOST_IOS::out ) { } }; diff --git a/audiostream/src/ni/media/audio/wav/wav_file_source.h b/audiostream/src/ni/media/audio/wav/wav_file_source.h index 720c2d12..565daf28 100644 --- a/audiostream/src/ni/media/audio/wav/wav_file_source.h +++ b/audiostream/src/ni/media/audio/wav/wav_file_source.h @@ -26,15 +26,15 @@ #include -#include +#include class wav_file_source : public wav_source { using base_type = wav_source; public: - explicit wav_file_source( const std::string& path ) - : base_type( boost::filesystem::path( path ), BOOST_IOS::binary | BOOST_IOS::in ) + explicit wav_file_source( const std::filesystem::path& path ) + : base_type( path, BOOST_IOS::binary | BOOST_IOS::in ) { } }; diff --git a/audiostream/src/ni/media/audio/wav/wav_ofstream.cpp b/audiostream/src/ni/media/audio/wav/wav_ofstream.cpp index e5d08e6a..5ba3b73f 100644 --- a/audiostream/src/ni/media/audio/wav/wav_ofstream.cpp +++ b/audiostream/src/ni/media/audio/wav/wav_ofstream.cpp @@ -52,7 +52,7 @@ wav_ofstream& wav_ofstream::operator=( wav_ofstream&& other ) //---------------------------------------------------------------------------------------------------------------------- -wav_ofstream::wav_ofstream( const std::string& file, const info_type& info ) +wav_ofstream::wav_ofstream( const std::filesystem::path& file, const info_type& info ) : ofstream( make_stream_buffer( wav_file_sink( info, file ) ), make_info( info ) ) { } diff --git a/audiostream/src/ni/media/audio/wma/wma_file_source.h b/audiostream/src/ni/media/audio/wma/wma_file_source.h index deeaa7a7..e22f4bad 100644 --- a/audiostream/src/ni/media/audio/wma/wma_file_source.h +++ b/audiostream/src/ni/media/audio/wma/wma_file_source.h @@ -25,17 +25,16 @@ #include // basic_file -#include +#include class wma_file_source : public os_source { using base_type = os_source; public: - explicit wma_file_source( const std::string& path ) - : base_type( - boost::iostreams::file_descriptor_source( boost::filesystem::path( path ), BOOST_IOS::binary | BOOST_IOS::in ), - audio::ifstream_info::container_type::wma ) + explicit wma_file_source( const std::filesystem::path& path ) + : base_type( boost::iostreams::file_descriptor_source( path, BOOST_IOS::binary | BOOST_IOS::in ), + audio::ifstream_info::container_type::wma ) { } }; diff --git a/audiostream/test/ni/media/reference_test.h b/audiostream/test/ni/media/reference_test.h index 4505b800..cea077e2 100644 --- a/audiostream/test/ni/media/reference_test.h +++ b/audiostream/test/ni/media/reference_test.h @@ -30,13 +30,13 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -84,7 +84,7 @@ inline constexpr auto epsilon( const pcm::format& fmt ) //---------------------------------------------------------------------------------------------------------------------- template -void reference_test( Stream&& stream, const boost::filesystem::path& file ) +void reference_test( Stream&& stream, const std::filesystem::path& file ) { using value_type = double; diff --git a/audiostream/test/ni/media/sink_test.h b/audiostream/test/ni/media/sink_test.h index 27178c55..e50d0455 100644 --- a/audiostream/test/ni/media/sink_test.h +++ b/audiostream/test/ni/media/sink_test.h @@ -26,10 +26,11 @@ #include +#include //---------------------------------------------------------------------------------------------------------------------- -class sink_test : public ::testing::TestWithParam +class sink_test : public ::testing::TestWithParam { public: @@ -40,17 +41,16 @@ class sink_test : public ::testing::TestWithParam auto output_name() const { - auto output_path = test_files_output_path() / boost::filesystem::path( input_name() ).filename(); - return output_path.string(); + return test_files_output_path() / (input_name().filename()); } protected: void SetUp() override { - if ( boost::filesystem::exists( output_name() ) ) - boost::filesystem::remove( output_name() ); + if ( std::filesystem::exists( output_name() ) ) + std::filesystem::remove( output_name() ); - ASSERT_FALSE( boost::filesystem::exists( output_name() ) ) << "Could not delete output file"; + ASSERT_FALSE( std::filesystem::exists( output_name() ) ) << "Could not delete output file"; } void TearDown() override diff --git a/audiostream/test/ni/media/source_test.cpp b/audiostream/test/ni/media/source_test.cpp index a882f8e5..6daa743a 100644 --- a/audiostream/test/ni/media/source_test.cpp +++ b/audiostream/test/ni/media/source_test.cpp @@ -30,7 +30,8 @@ namespace detail { template -Container read_file_to( std::string file_name, std::ios::openmode mode = std::ios::in | std::ios::binary ) +Container read_file_to( const std::filesystem::path& file_name, + std::ios::openmode mode = std::ios::in | std::ios::binary ) { std::filebuf fb; fb.open( file_name, mode ); @@ -53,7 +54,7 @@ struct stream_opener; template <> struct stream_opener { - static auto open( const std::string& file_name ) -> audio::ifstream + static auto open( const std::filesystem::path& file_name ) -> audio::ifstream { return {file_name}; } @@ -65,7 +66,7 @@ struct stream_opener template <> struct stream_opener { - static auto open( const std::string& file_name ) -> audio::ivectorstream + static auto open( const std::filesystem::path& file_name ) -> audio::ivectorstream { return {stream_opener::open( file_name )}; } @@ -76,7 +77,7 @@ struct stream_opener template <> struct stream_opener { - static auto open( const std::string& file_name ) -> audio::ifvectorstream + static auto open( const std::filesystem::path& file_name ) -> audio::ifvectorstream { auto vec = read_file_to>( file_name ); auto container = audio::ifstream_container( file_name ); @@ -90,7 +91,7 @@ struct stream_opener //---------------------------------------------------------------------------------------------------------------------- template -void open_file_impl( Stream& stream, const std::string& filename ) +void open_file_impl( Stream& stream, const std::filesystem::path& filename ) { std::string error; diff --git a/audiostream/test/ni/media/source_test.h b/audiostream/test/ni/media/source_test.h index a079f2dc..35a2489c 100644 --- a/audiostream/test/ni/media/source_test.h +++ b/audiostream/test/ni/media/source_test.h @@ -31,13 +31,14 @@ #include #include +#include #include #include #include //---------------------------------------------------------------------------------------------------------------------- -class source_test : public ::testing::TestWithParam +class source_test : public ::testing::TestWithParam { public: auto file_name() const diff --git a/audiostream/test/ni/media/test_helper.cpp b/audiostream/test/ni/media/test_helper.cpp index b1bd124a..9c489da4 100644 --- a/audiostream/test/ni/media/test_helper.cpp +++ b/audiostream/test/ni/media/test_helper.cpp @@ -43,34 +43,33 @@ namespace bool init() { #if BOOST_OS_WINDOWS - boost::filesystem::path::imbue( std::locale( std::locale(), new std::codecvt_utf8_utf16() ) ); + std::filesystem::path::imbue( std::locale( std::locale(), new std::codecvt_utf8_utf16() ) ); #endif return true; } const bool initialized = init(); -auto supported_files( const boost::filesystem::path& root_path, +auto supported_files( const std::filesystem::path& root_path, boost::optional container ) { using namespace boost::adaptors; - using namespace boost::filesystem; + using namespace std::filesystem; auto can_read_file = [container]( const auto& p ) { return container ? audio::can_read_file( p, {*container} ) : audio::can_read_file( p ); }; recursive_directory_iterator beg( root_path ), end; - return boost::make_iterator_range( beg, end ) | transformed( []( const path& p ) { return p.string(); } ) - | filtered( can_read_file ); + return boost::make_iterator_range( beg, end ) | filtered( can_read_file ); } //---------------------------------------------------------------------------------------------------------------------- -std::vector collect_supported_files( const boost::filesystem::path& root_path, +std::vector collect_supported_files( const std::filesystem::path& root_path, boost::optional container ) { - using Files = std::vector; + using Files = std::vector; return boost::copy_range( supported_files( root_path, container ) ); } @@ -79,14 +78,14 @@ std::vector collect_supported_files( const boost::filesystem::path& //---------------------------------------------------------------------------------------------------------------------- -boost::filesystem::path test_files_input_path() +std::filesystem::path test_files_input_path() { return {BOOST_PP_STRINGIZE( NI_MEDIA_TEST_FILES_PATH )}; } //---------------------------------------------------------------------------------------------------------------------- -boost::filesystem::path test_files_output_path() +std::filesystem::path test_files_output_path() { return {BOOST_PP_STRINGIZE( NI_MEDIA_OUTPUT_FILES_PATH )}; } diff --git a/audiostream/test/ni/media/test_helper.h b/audiostream/test/ni/media/test_helper.h index b3b9fe49..48b1aa0c 100644 --- a/audiostream/test/ni/media/test_helper.h +++ b/audiostream/test/ni/media/test_helper.h @@ -26,17 +26,17 @@ #include -#include #include #include +#include #include #include -using TestFiles = decltype( ::testing::ValuesIn( std::declval>() ) ); +using TestFiles = decltype( ::testing::ValuesIn( std::declval>() ) ); -boost::filesystem::path test_files_input_path(); -boost::filesystem::path test_files_output_path(); +std::filesystem::path test_files_input_path(); +std::filesystem::path test_files_output_path(); TestFiles user_files( boost::optional container = boost::none ); TestFiles reference_files( boost::optional container = boost::none ); @@ -46,11 +46,11 @@ TestFiles fuzz_files( boost::optional cont struct ParamToString { template - std::string operator()( const T& info ) + std::filesystem::path operator()( const T& info ) { - auto filename = boost::filesystem::path( info.param ).filename().string(); + auto filename = std::filesystem::path( info.param ).filename().string(); std::replace_if( filename.begin(), filename.end(), []( unsigned char c ) { return !std::isalnum( c ); }, '_' ); - return std::to_string( info.index ) + "_" + filename; + return {std::to_string( info.index ) + "_" + filename}; } };