diff --git a/action_skel_code/commandline.hpp b/action_skel_code/commandline.hpp index 7de8ede..55fcada 100644 --- a/action_skel_code/commandline.hpp +++ b/action_skel_code/commandline.hpp @@ -19,7 +19,6 @@ #define id1B7A42F6E46547A6AB0F914E2A91399F #include "dindexer-common/validationerror.hpp" -#include "dindexer-common/mediatypes.hpp" #include namespace din { diff --git a/include/dindexer-machinery/guess_content_type.hpp b/include/dindexer-machinery/guess_content_type.hpp index 673205e..fb2da6b 100644 --- a/include/dindexer-machinery/guess_content_type.hpp +++ b/include/dindexer-machinery/guess_content_type.hpp @@ -18,9 +18,9 @@ #ifndef id17F1582F16C8478E8D9795BECBF275A3 #define id17F1582F16C8478E8D9795BECBF275A3 -#include "dindexer-common/mediatypes.hpp" +#include "dindexer-machinery/mediatypes.hpp" #include "dindexer-machinery/recorddata.hpp" -#include "dindexer-common/compatibility.h" +#include "helpers/compatibility.h" #include namespace mchlib { @@ -36,8 +36,8 @@ namespace mchlib { template class SetListingView; - ContentTypes guess_content_type ( dinlib::MediaTypes parMediaType, const SetListingView& parContent, std::size_t parEntriesCount=0 ); - ContentTypes guess_content_type ( dinlib::MediaTypes parMediaType, const std::vector& parContent ); + ContentTypes guess_content_type ( MediaTypes parMediaType, const SetListingView& parContent, std::size_t parEntriesCount=0 ); + ContentTypes guess_content_type ( MediaTypes parMediaType, const std::vector& parContent ); char content_type_to_char ( ContentTypes parCType ) a_pure; ContentTypes char_to_content_type ( char parCType ) a_pure; diff --git a/include/dindexer-machinery/mediatype.hpp b/include/dindexer-machinery/mediatype.hpp index 3307084..a013e25 100644 --- a/include/dindexer-machinery/mediatype.hpp +++ b/include/dindexer-machinery/mediatype.hpp @@ -20,11 +20,11 @@ #include #include -#include "dindexer-common/mediatypes.hpp" +#include "dindexer-machinery/mediatypes.hpp" namespace mchlib { #if defined(WITH_MEDIA_AUTODETECT) - dinlib::MediaTypes guess_media_type ( std::string&& parPath ); + MediaTypes guess_media_type ( std::string&& parPath ); class UnknownMediaTypeException : std::runtime_error { public: diff --git a/include/dindexer-common/mediatypes.hpp b/include/dindexer-machinery/mediatypes.hpp similarity index 93% rename from include/dindexer-common/mediatypes.hpp rename to include/dindexer-machinery/mediatypes.hpp index d78bba6..6b69d6c 100644 --- a/include/dindexer-common/mediatypes.hpp +++ b/include/dindexer-machinery/mediatypes.hpp @@ -18,10 +18,10 @@ #ifndef id700AFD0F33634ACC88079BB8853A9E13 #define id700AFD0F33634ACC88079BB8853A9E13 -#include "dindexer-common/compatibility.h" +#include "helpers/compatibility.h" #include -namespace dinlib { +namespace mchlib { enum MediaTypes { MediaType_CDRom = 'C', MediaType_Directory = 'D', @@ -35,6 +35,6 @@ namespace dinlib { const std::string& media_type_to_str ( MediaTypes parType ); MediaTypes char_to_media_type ( char parMType ) a_pure; -} //namespace dinlib +} //namespace mchlib #endif diff --git a/include/dindexer-machinery/scantask/mediatype.hpp b/include/dindexer-machinery/scantask/mediatype.hpp index 17a9a86..a459a9d 100644 --- a/include/dindexer-machinery/scantask/mediatype.hpp +++ b/include/dindexer-machinery/scantask/mediatype.hpp @@ -19,21 +19,21 @@ #define id25B0BCA6D9464754920E1BC7C5D9DB57 #include "dindexer-machinery/scantask/base.hpp" -#include "dindexer-common/mediatypes.hpp" +#include "dindexer-machinery/mediatypes.hpp" #include namespace mchlib { namespace scantask { - class MediaType : Base { + class MediaType : Base { public: MediaType ( char parDefault, bool parForce, std::string parSearchPath ); virtual ~MediaType ( void ) noexcept = default; private: - virtual void on_data_destroy ( dinlib::MediaTypes& parData ); - virtual void on_data_create ( dinlib::MediaTypes& parData ); + virtual void on_data_destroy ( MediaTypes& parData ); + virtual void on_data_create ( MediaTypes& parData ); - dinlib::MediaTypes m_default; + MediaTypes m_default; #if defined(WITH_MEDIA_AUTODETECT) std::string m_search_path; bool m_force; diff --git a/include/dindexer-common/compatibility.h b/include/helpers/compatibility.h similarity index 100% rename from include/dindexer-common/compatibility.h rename to include/helpers/compatibility.h diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 22fe9a1..45a96fe 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -2,7 +2,6 @@ project(${bare_name}-common CXX C) add_library(${PROJECT_NAME} commandline.cpp - mediatypes.cpp settings.cpp validationerror.cpp common_info.cpp diff --git a/src/delete/commandline.hpp b/src/delete/commandline.hpp index c4fe196..5a0cef6 100644 --- a/src/delete/commandline.hpp +++ b/src/delete/commandline.hpp @@ -19,7 +19,6 @@ #define idB6191389C4AD4EE5862CCF1591BE6CE5 #include "dindexer-common/validationerror.hpp" -#include "dindexer-common/mediatypes.hpp" #include namespace din { diff --git a/src/locate/commandline.hpp b/src/locate/commandline.hpp index 7de8ede..55fcada 100644 --- a/src/locate/commandline.hpp +++ b/src/locate/commandline.hpp @@ -19,7 +19,6 @@ #define id1B7A42F6E46547A6AB0F914E2A91399F #include "dindexer-common/validationerror.hpp" -#include "dindexer-common/mediatypes.hpp" #include namespace din { diff --git a/src/machinery/CMakeLists.txt b/src/machinery/CMakeLists.txt index e671b57..7482548 100644 --- a/src/machinery/CMakeLists.txt +++ b/src/machinery/CMakeLists.txt @@ -11,6 +11,7 @@ add_library(${PROJECT_NAME} SHARED filesearcher.cpp discinfo.cpp mediatype.cpp + mediatypes.cpp machinery_info.cpp guess_content_type.cpp set_listing.cpp @@ -28,7 +29,6 @@ target_include_directories(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME} PRIVATE ${bare_name}-if PRIVATE ${MAGIC_LIBRARIES} - PUBLIC ${bare_name}-common ) target_include_directories(${PROJECT_NAME} diff --git a/src/machinery/guess_content_type.cpp b/src/machinery/guess_content_type.cpp index 0b8f791..285a547 100644 --- a/src/machinery/guess_content_type.cpp +++ b/src/machinery/guess_content_type.cpp @@ -42,7 +42,7 @@ namespace mchlib { }; struct EntryChecking { - typedef bool(*CheckerFunction)(dinlib::MediaTypes, const ConstSetListingView&, const std::vector&); + typedef bool(*CheckerFunction)(MediaTypes, const ConstSetListingView&, const std::vector&); std::size_t max_total_entries; CheckerFunction checker_func; @@ -87,8 +87,8 @@ namespace mchlib { return std::move(retval); } - bool identify_video_dvd (dinlib::MediaTypes parMediaType, const ConstSetListingView& parContent, const std::vector& parFlatContent ) { - if (parMediaType != dinlib::MediaType_DVD and parMediaType != dinlib::MediaType_Directory) + bool identify_video_dvd (MediaTypes parMediaType, const ConstSetListingView& parContent, const std::vector& parFlatContent ) { + if (parMediaType != MediaType_DVD and parMediaType != MediaType_Directory) return false; const auto items_count = count_listing_items(parContent); @@ -103,8 +103,8 @@ namespace mchlib { return check_missing_content(parFlatContent, should_have).empty(); } - bool identify_video_cd (dinlib::MediaTypes parMediaType, const ConstSetListingView& parContent, const std::vector& parFlatContent) { - if (parMediaType != dinlib::MediaType_CDRom and parMediaType != dinlib::MediaType_Directory) + bool identify_video_cd (MediaTypes parMediaType, const ConstSetListingView& parContent, const std::vector& parFlatContent) { + if (parMediaType != MediaType_CDRom and parMediaType != MediaType_Directory) return false; const auto items_count = count_listing_items(parContent); @@ -121,7 +121,7 @@ namespace mchlib { } } //unnamed namespace - ContentTypes guess_content_type (dinlib::MediaTypes parMediaType, const ConstSetListingView& parContent, std::size_t parEntriesCount) { + ContentTypes guess_content_type (MediaTypes parMediaType, const ConstSetListingView& parContent, std::size_t parEntriesCount) { if (boost::empty(parContent)) return ContentType_Empty; @@ -145,7 +145,7 @@ namespace mchlib { return ContentType_Generic; } - ContentTypes guess_content_type (dinlib::MediaTypes parMediaType, const std::vector& parContent) { + ContentTypes guess_content_type (MediaTypes parMediaType, const std::vector& parContent) { if (parContent.empty()) return ContentType_Empty; diff --git a/src/machinery/mediatype.cpp b/src/machinery/mediatype.cpp index 3f6fff9..4a3feb3 100644 --- a/src/machinery/mediatype.cpp +++ b/src/machinery/mediatype.cpp @@ -40,23 +40,23 @@ namespace mchlib { { } - dinlib::MediaTypes guess_media_type (std::string&& parPath) { + MediaTypes guess_media_type (std::string&& parPath) { DiscInfo info(std::move(parPath)); const DriveTypes drive_type = info.drive_type(); if (DriveType_HardDisk == drive_type) { if (info.mountpoint() == PathName(info.original_path()).path()) - return dinlib::MediaType_HardDisk; + return MediaType_HardDisk; else - return dinlib::MediaType_Directory; + return MediaType_Directory; } else if (DriveType_Optical == drive_type) { switch (info.optical_type()) { case OpticalType_DVD: - return dinlib::MediaType_DVD; + return MediaType_DVD; case OpticalType_CDRom: - return dinlib::MediaType_CDRom; + return MediaType_CDRom; case OpticalType_BluRay: - return dinlib::MediaType_BluRay; + return MediaType_BluRay; default: throw UnknownMediaTypeException("Set autodetect failed because this media type is unknown, please specify the set type manually"); } diff --git a/src/common/mediatypes.cpp b/src/machinery/mediatypes.cpp similarity index 94% rename from src/common/mediatypes.cpp rename to src/machinery/mediatypes.cpp index e4b97e3..cb28c0a 100644 --- a/src/common/mediatypes.cpp +++ b/src/machinery/mediatypes.cpp @@ -15,11 +15,11 @@ * along with "dindexer". If not, see . */ -#include "dindexer-common/mediatypes.hpp" +#include "dindexer-machinery/mediatypes.hpp" #include #include -namespace dinlib { +namespace mchlib { const std::string& media_type_to_str (MediaTypes parType) { static const std::map types { {MediaType_CDRom, "CD-Rom"}, @@ -43,4 +43,4 @@ namespace dinlib { MediaTypes char_to_media_type (char parMType) { return static_cast(parMType); } -} //namespace dinlib +} //namespace mchlib diff --git a/src/machinery/scantask/mediatype.cpp b/src/machinery/scantask/mediatype.cpp index a3767d8..194b7b5 100644 --- a/src/machinery/scantask/mediatype.cpp +++ b/src/machinery/scantask/mediatype.cpp @@ -25,7 +25,7 @@ namespace mchlib { namespace scantask { MediaType::MediaType (char parDefault, bool parForce, std::string parSearchPath) : - m_default(dinlib::char_to_media_type(parDefault)) + m_default(char_to_media_type(parDefault)) #if defined(WITH_MEDIA_AUTODETECT) , m_search_path(std::move(parSearchPath)) , m_force(parForce) @@ -37,11 +37,11 @@ namespace mchlib { #endif } - void MediaType::on_data_destroy (dinlib::MediaTypes& parData) { - parData = dinlib::MediaType_Other; + void MediaType::on_data_destroy (MediaTypes& parData) { + parData = MediaType_Other; } - void MediaType::on_data_create (dinlib::MediaTypes& parData) { + void MediaType::on_data_create (MediaTypes& parData) { #if defined(WITH_MEDIA_AUTODETECT) if (m_force) { parData = m_default; diff --git a/src/navigate/commandline.hpp b/src/navigate/commandline.hpp index 7de8ede..55fcada 100644 --- a/src/navigate/commandline.hpp +++ b/src/navigate/commandline.hpp @@ -19,7 +19,6 @@ #define id1B7A42F6E46547A6AB0F914E2A91399F #include "dindexer-common/validationerror.hpp" -#include "dindexer-common/mediatypes.hpp" #include namespace din { diff --git a/src/query/commandline.hpp b/src/query/commandline.hpp index 9dca461..e63b167 100644 --- a/src/query/commandline.hpp +++ b/src/query/commandline.hpp @@ -19,7 +19,6 @@ #define id259FD7C96B5049ECB50386F25455FBB2 #include "dindexer-common/validationerror.hpp" -#include "dindexer-common/mediatypes.hpp" #include namespace din { diff --git a/src/scan/commandline.cpp b/src/scan/commandline.cpp index b4649a0..92d04cb 100644 --- a/src/scan/commandline.cpp +++ b/src/scan/commandline.cpp @@ -27,14 +27,14 @@ namespace po = boost::program_options; namespace din { namespace { const char g_allowed_types[] = { - static_cast(dinlib::MediaType_CDRom), - static_cast(dinlib::MediaType_Directory), - static_cast(dinlib::MediaType_DVD), - static_cast(dinlib::MediaType_BluRay), - static_cast(dinlib::MediaType_FloppyDisk), - static_cast(dinlib::MediaType_HardDisk), - static_cast(dinlib::MediaType_IomegaZip), - static_cast(dinlib::MediaType_Other) + static_cast(mchlib::MediaType_CDRom), + static_cast(mchlib::MediaType_Directory), + static_cast(mchlib::MediaType_DVD), + static_cast(mchlib::MediaType_BluRay), + static_cast(mchlib::MediaType_FloppyDisk), + static_cast(mchlib::MediaType_HardDisk), + static_cast(mchlib::MediaType_IomegaZip), + static_cast(mchlib::MediaType_Other) }; } //unnamed namespace diff --git a/src/scan/commandline.hpp b/src/scan/commandline.hpp index de60e57..9738167 100644 --- a/src/scan/commandline.hpp +++ b/src/scan/commandline.hpp @@ -19,6 +19,7 @@ #define id1B7A42F6E46547A6AB0F914E2A91399F #include +#include "dindexer-machinery/mediatypes.hpp" #include "dindexer-machinery/mediatype.hpp" namespace din { diff --git a/test/unit/test_guess_content_type.cpp b/test/unit/test_guess_content_type.cpp index 672c25c..1cf18ab 100644 --- a/test/unit/test_guess_content_type.cpp +++ b/test/unit/test_guess_content_type.cpp @@ -23,7 +23,7 @@ namespace { template - void detect_type (mchlib::FileRecordData (&parTestData)[N], mchlib::ContentTypes parExpected, dinlib::MediaTypes parMediaType) { + void detect_type (mchlib::FileRecordData (&parTestData)[N], mchlib::ContentTypes parExpected, mchlib::MediaTypes parMediaType) { using mchlib::SetListing; using mchlib::FileRecordData; @@ -52,7 +52,7 @@ TEST(machinery, guess_content_type) { FileRecordData("VIDEO_TS/VTS_01_0.VOB",0,0,2,false,false), FileRecordData("VIDEO_TS/VIDEO_TS.VOB",0,0,2,false,false) }; - detect_type(test_data, mchlib::ContentType_VideoDVD, dinlib::MediaType_DVD); + detect_type(test_data, mchlib::ContentType_VideoDVD, mchlib::MediaType_DVD); } { @@ -63,7 +63,7 @@ TEST(machinery, guess_content_type) { FileRecordData("some_file.bin",0,0,1,false,false), FileRecordData("another_dir/VTS_01_0.BUP",0,0,2,false,false) }; - detect_type(test_data, mchlib::ContentType_Generic, dinlib::MediaType_Directory); + detect_type(test_data, mchlib::ContentType_Generic, mchlib::MediaType_Directory); } { @@ -81,6 +81,6 @@ TEST(machinery, guess_content_type) { FileRecordData("CDI",0,0,1,true,false), FileRecordData("KARAOKE",0,0,1,true,false) }; - detect_type(test_data, mchlib::ContentType_VideoCD, dinlib::MediaType_CDRom); + detect_type(test_data, mchlib::ContentType_VideoCD, mchlib::MediaType_CDRom); } }