diff --git a/include/dindexer-machinery/indexer.hpp b/include/dindexer-machinery/indexer.hpp index 1aed76a..337ef92 100644 --- a/include/dindexer-machinery/indexer.hpp +++ b/include/dindexer-machinery/indexer.hpp @@ -40,7 +40,7 @@ namespace dinlib { struct Settings; } //namespace dinlib -namespace din { +namespace mchlib { struct FileRecordData; class Indexer { @@ -72,6 +72,6 @@ namespace din { std::unique_ptr m_local_data; }; -} //namespace din +} //namespace mchlib #endif diff --git a/include/dindexer-machinery/mediatype.hpp b/include/dindexer-machinery/mediatype.hpp index b7dba5b..519998e 100644 --- a/include/dindexer-machinery/mediatype.hpp +++ b/include/dindexer-machinery/mediatype.hpp @@ -22,7 +22,7 @@ #include #include "dindexer-common/mediatypes.hpp" -namespace din { +namespace mchlib { #if defined(WITH_MEDIA_AUTODETECT) dinlib::MediaTypes guess_media_type ( std::string&& parPath ); @@ -38,6 +38,6 @@ namespace din { CantAutodetectException ( const char* parWhat ); }; #endif -} //namespace din +} //namespace mchlib #endif diff --git a/include/dindexer-machinery/recorddata.hpp b/include/dindexer-machinery/recorddata.hpp index e9dd6b2..91a6bbb 100644 --- a/include/dindexer-machinery/recorddata.hpp +++ b/include/dindexer-machinery/recorddata.hpp @@ -26,7 +26,7 @@ #include #include -namespace din { +namespace mchlib { struct FileRecordData { struct MimeStringTagStruct { }; typedef boost::flyweights::tag MimeStringTag; @@ -81,6 +81,6 @@ namespace din { const boost::string_ref name; const char type; }; -} //namespace din +} //namespace mchlib #endif diff --git a/include/dindexer-machinery/tiger.hpp b/include/dindexer-machinery/tiger.hpp index 5ae04c6..f9b48f1 100644 --- a/include/dindexer-machinery/tiger.hpp +++ b/include/dindexer-machinery/tiger.hpp @@ -22,7 +22,7 @@ #include #include -namespace din { +namespace mchlib { struct TigerHash { TigerHash ( void ) = default; @@ -44,6 +44,6 @@ namespace din { std::string tiger_to_string ( const TigerHash& parHash, bool parUpcase=false ); void tiger_data ( const std::string& parData, TigerHash& parHash ); void tiger_data ( const std::vector& parData, TigerHash& parHash ); -} //namespace din +} //namespace mchlib #endif diff --git a/src/machinery/discinfo.cpp b/src/machinery/discinfo.cpp index fc22f29..ba07b74 100644 --- a/src/machinery/discinfo.cpp +++ b/src/machinery/discinfo.cpp @@ -36,7 +36,7 @@ #endif #include -namespace din { +namespace mchlib { namespace { using MountpointsMap = std::map; @@ -329,4 +329,4 @@ namespace din { }; } #endif -} //namespace din +} //namespace mchlib diff --git a/src/machinery/discinfo.hpp b/src/machinery/discinfo.hpp index 1bfb183..9ce42ce 100644 --- a/src/machinery/discinfo.hpp +++ b/src/machinery/discinfo.hpp @@ -20,7 +20,7 @@ #include -namespace din { +namespace mchlib { #if defined(WITH_MEDIA_AUTODETECT) enum OpticalTypes { OpticalType_DVD, @@ -58,6 +58,6 @@ namespace din { std::string m_mountpoint; std::string m_device; }; -} //namespace din +} //namespace mchlib #endif diff --git a/src/machinery/indexer.cpp b/src/machinery/indexer.cpp index 408da5e..34e7aad 100644 --- a/src/machinery/indexer.cpp +++ b/src/machinery/indexer.cpp @@ -41,7 +41,7 @@ #endif #include -namespace din { +namespace mchlib { using HashType = decltype(FileRecordData::hash); namespace { @@ -367,4 +367,4 @@ namespace din { #endif return m_local_data->paths; } -} //namespace din +} //namespace mchlib diff --git a/src/machinery/mediatype.cpp b/src/machinery/mediatype.cpp index b4214eb..0a785ec 100644 --- a/src/machinery/mediatype.cpp +++ b/src/machinery/mediatype.cpp @@ -20,7 +20,7 @@ #include "discinfo.hpp" #include -namespace din { +namespace mchlib { #if defined(WITH_MEDIA_AUTODETECT) UnknownMediaTypeException::UnknownMediaTypeException (const std::string& parWhat) : std::runtime_error(parWhat) @@ -66,4 +66,4 @@ namespace din { } } #endif -} //namespace din +} //namespace mchlib diff --git a/src/machinery/mimetype.cpp b/src/machinery/mimetype.cpp index eeb6b9f..d2b3c2a 100644 --- a/src/machinery/mimetype.cpp +++ b/src/machinery/mimetype.cpp @@ -16,7 +16,7 @@ #include #include -namespace din { +namespace mchlib { using MagicCookie = std::unique_ptr; struct MimeType::LocalData { @@ -109,4 +109,4 @@ namespace din { return retval; } } -} //namespace din +} //namespace mchlib diff --git a/src/machinery/mimetype.hpp b/src/machinery/mimetype.hpp index abe7939..1528ff1 100644 --- a/src/machinery/mimetype.hpp +++ b/src/machinery/mimetype.hpp @@ -23,7 +23,7 @@ #include #include -namespace din { +namespace mchlib { using SplitMime = std::pair; class MimeType { @@ -41,6 +41,6 @@ namespace din { }; SplitMime split_mime ( const std::string& parFull ); -} //namespace din +} //namespace mchlib #endif diff --git a/src/machinery/pathname.cpp b/src/machinery/pathname.cpp index a630f20..69330b1 100644 --- a/src/machinery/pathname.cpp +++ b/src/machinery/pathname.cpp @@ -21,7 +21,7 @@ #include #include -namespace din { +namespace mchlib { const std::string PathName::m_empty_str(""); namespace { @@ -210,4 +210,4 @@ namespace din { } return true; } -} //namespace din +} //namespace mchlib diff --git a/src/machinery/pathname.hpp b/src/machinery/pathname.hpp index 83f141f..365dc97 100644 --- a/src/machinery/pathname.hpp +++ b/src/machinery/pathname.hpp @@ -25,7 +25,7 @@ #include #include -namespace din { +namespace mchlib { class PathName { public: PathName ( PathName&& ) = default; @@ -57,6 +57,6 @@ namespace din { PathName make_relative_path ( const PathName& parBasePath, const PathName& parOtherPath ); std::ostream& operator<< ( std::ostream& parStream, const PathName& parPath ); -} //namespace din +} //namespace mchlib #endif diff --git a/src/machinery/stringpool.hpp b/src/machinery/stringpool.hpp index aba89fb..a410a77 100644 --- a/src/machinery/stringpool.hpp +++ b/src/machinery/stringpool.hpp @@ -28,7 +28,7 @@ #include #include -namespace din { +namespace mchlib { template , typename StrRef=boost::basic_string_ref> class StringPool { typedef std::pair StringListPair; @@ -63,7 +63,7 @@ namespace din { PoolType m_pool; StringListType m_strings; }; -} //namespace din +} //namespace mchlib #include "stringpool.inl" diff --git a/src/machinery/stringpool.inl b/src/machinery/stringpool.inl index 085c20b..e59409e 100644 --- a/src/machinery/stringpool.inl +++ b/src/machinery/stringpool.inl @@ -15,7 +15,7 @@ * along with "dindexer". If not, see . */ -namespace din { +namespace mchlib { namespace implem { template std::pair clone_ifp (const StrRef& parClone, StrRef parSource) { @@ -137,4 +137,4 @@ namespace din { } return; } -} //namespace din +} //namespace mchlib diff --git a/src/machinery/tiger.cpp b/src/machinery/tiger.cpp index 18e43f4..0135613 100644 --- a/src/machinery/tiger.cpp +++ b/src/machinery/tiger.cpp @@ -34,7 +34,7 @@ extern "C" void tiger ( const char* parStr, uint64_t parLength, uint64_t parHash # error "Not implemented without SSE2" #endif -namespace din { +namespace mchlib { namespace { const uint32_t g_buff_size = 1024 * 8; const char g_tiger_padding = 0x80; //0x01 for V1 @@ -139,4 +139,4 @@ namespace din { void tiger_data (const std::vector& parData, TigerHash& parHash) { tiger (parData.data(), parData.size(), parHash.data, g_tiger_padding); } -} //namespace din +} //namespace mchlib diff --git a/src/scan/dbbackend.cpp b/src/scan/dbbackend.cpp index 708b627..77e02f5 100644 --- a/src/scan/dbbackend.cpp +++ b/src/scan/dbbackend.cpp @@ -32,7 +32,7 @@ namespace din { namespace { } //unnamed namespace - bool read_from_db (FileRecordData& parItem, SetRecordDataFull& parSet, const dinlib::SettingsDB& parDB, const TigerHash& parHash) { + bool read_from_db (mchlib::FileRecordData& parItem, mchlib::SetRecordDataFull& parSet, const dinlib::SettingsDB& parDB, const mchlib::TigerHash& parHash) { using boost::lexical_cast; pq::Connection conn(std::string(parDB.username), std::string(parDB.password), std::string(parDB.dbname), std::string(parDB.address), parDB.port); @@ -79,7 +79,7 @@ namespace din { return true; } - void write_to_db (const dinlib::SettingsDB& parDB, const std::vector& parData, const SetRecordData& parSetData) { + void write_to_db (const dinlib::SettingsDB& parDB, const std::vector& parData, const mchlib::SetRecordData& parSetData) { using std::chrono::system_clock; using boost::lexical_cast; diff --git a/src/scan/dbbackend.hpp b/src/scan/dbbackend.hpp index ae80dd8..17ea092 100644 --- a/src/scan/dbbackend.hpp +++ b/src/scan/dbbackend.hpp @@ -26,14 +26,16 @@ namespace dinlib { struct SettingsDB;; } //namespace dinlib -namespace din { +namespace mchlib { struct FileRecordData; struct SetRecordData; struct SetRecordDataFull; struct TigerHash; +} //namespace mchlib - void write_to_db ( const dinlib::SettingsDB& parDB, const std::vector& parData, const SetRecordData& parSetData ); - bool read_from_db ( FileRecordData& parItem, SetRecordDataFull& parSet, const dinlib::SettingsDB& parDB, const TigerHash& parHash ); +namespace din { + void write_to_db ( const dinlib::SettingsDB& parDB, const std::vector& parData, const mchlib::SetRecordData& parSetData ); + bool read_from_db ( mchlib::FileRecordData& parItem, mchlib::SetRecordDataFull& parSet, const dinlib::SettingsDB& parDB, const mchlib::TigerHash& parHash ); } //namespace din #endif diff --git a/src/scan/main.cpp b/src/scan/main.cpp index 02f9292..3e99bb8 100644 --- a/src/scan/main.cpp +++ b/src/scan/main.cpp @@ -39,8 +39,8 @@ #endif namespace { - void run_hash_calculation ( din::Indexer& parIndexer, bool parShowProgress ); - bool add_to_db ( const std::vector& parData, const std::string& parSetName, char parType, const dinlib::SettingsDB& parDBSettings, bool parForce=false ); + void run_hash_calculation ( mchlib::Indexer& parIndexer, bool parShowProgress ); + bool add_to_db ( const std::vector& parData, const std::string& parSetName, char parType, const dinlib::SettingsDB& parDBSettings, bool parForce=false ); } //unnamed namespace int main (int parArgc, char* parArgv[]) { @@ -79,7 +79,7 @@ int main (int parArgc, char* parArgv[]) { if (0 == vm.count("type")) { std::cout << "Analyzing disc... "; try { - const auto guessed_type = din::guess_media_type(std::string(search_path)); + const auto guessed_type = mchlib::guess_media_type(std::string(search_path)); set_type = guessed_type; std::cout << "Setting type to " << set_type << " (" << dinlib::media_type_to_str(guessed_type) << ")\n"; @@ -99,12 +99,12 @@ int main (int parArgc, char* parArgv[]) { std::cout << "constructing...\n"; - din::Indexer indexer; + mchlib::Indexer indexer; indexer.ignore_read_errors(vm.count("ignore-errors") > 0); fastf::FileSearcher searcher(search_path); fastf::FileSearcher::ConstCharVecType ext, ignore; searcher.SetFollowSymlinks(true); - searcher.SetCallback(fastf::FileSearcher::CallbackType(std::bind(&din::Indexer::add_path, &indexer, _1, _2))); + searcher.SetCallback(fastf::FileSearcher::CallbackType(std::bind(&mchlib::Indexer::add_path, &indexer, _1, _2))); searcher.Search(ext, ignore); if (verbose) { std::cout << "Fetching items list...\n"; @@ -127,7 +127,7 @@ int main (int parArgc, char* parArgv[]) { } namespace { - void run_hash_calculation (din::Indexer& parIndexer, bool parShowProgress) { + void run_hash_calculation (mchlib::Indexer& parIndexer, bool parShowProgress) { if (parIndexer.empty()) { return; } @@ -149,7 +149,7 @@ namespace { std::cout << "Processing"; std::cout.flush(); const auto total_items = parIndexer.total_items(); - std::thread hash_thread(&din::Indexer::calculate_hash, &parIndexer); + std::thread hash_thread(&mchlib::Indexer::calculate_hash, &parIndexer); std::mutex progress_print; std::size_t clear_size = 0; const auto digit_count = static_cast(std::log10(static_cast(total_items))) + 1; @@ -180,23 +180,23 @@ namespace { #endif } - bool add_to_db (const std::vector& parData, const std::string& parSetName, char parType, const dinlib::SettingsDB& parDBSettings, bool parForce) { - using din::FileRecordData; - using din::SetRecordDataFull; - using din::SetRecordData; + bool add_to_db (const std::vector& parData, const std::string& parSetName, char parType, const dinlib::SettingsDB& parDBSettings, bool parForce) { + using mchlib::FileRecordData; + using mchlib::SetRecordDataFull; + using mchlib::SetRecordData; if (not parForce) { const auto& first_hash = parData.front().hash; FileRecordData itm; SetRecordDataFull set; - const bool already_in_db = read_from_db(itm, set, parDBSettings, first_hash); + const bool already_in_db = din::read_from_db(itm, set, parDBSettings, first_hash); if (already_in_db) { return false; } } SetRecordData set_data {parSetName, parType}; - write_to_db(parDBSettings, parData, set_data); + din::write_to_db(parDBSettings, parData, set_data); return true; } } //unnamed namespace