1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2025-07-02 14:04:22 +00:00

Add stub code to detect VCDs, plus unit test.

This commit is contained in:
King_DuckZ 2016-02-19 21:57:43 +01:00
parent 7da13f6677
commit f31463480f
5 changed files with 179 additions and 16 deletions

View file

@ -28,12 +28,13 @@ namespace mchlib {
ContentType_Backup,
ContentType_VideoDVD,
ContentType_VideoBD,
ContentType_VideoCD,
ContentType_Unknown
};
template <bool> class SetListingView;
ContentTypes guess_content_type ( dinlib::MediaTypes parMediaType, const SetListingView<true>& parContent );
ContentTypes guess_content_type ( dinlib::MediaTypes parMediaType, const SetListingView<true>& parContent, std::size_t parEntriesCount=0 );
} //namespace mchlib
#endif

View file

@ -61,16 +61,25 @@ namespace mchlib {
template <bool Const>
inline
std::size_t count_listing_items (const SetListingView<Const>& /*parList*/) {
assert(false);
return 0;
//return std::count_if(
// parList.cbegin(),
// parList.cend(),
// [] (const FileRecordData&) {
// return true;
// }
//);
std::size_t count_listing_items (const SetListingView<Const>& parList) {
return std::count_if(
parList.cbegin(),
parList.cend(),
[] (const FileRecordData&) {
return true;
}
);
}
template <bool Const>
inline
std::size_t count_listing_items_recursive (const SetListingView<Const>& parList) {
std::size_t retval = 0;
for (auto it = parList.begin(), itEND = parList.end(); it != itEND; ++it, ++retval) {
if (it->is_directory)
retval += count_listing_items_recursive(SetListingView<Const>(it));
}
return retval;
}
} //namespace mchlib