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

Add ShortFileRecordData struct to hold the file list in DirTree.

This commit is contained in:
King_DuckZ 2016-03-04 21:57:09 +01:00
parent 1956594c01
commit d579b311f2
6 changed files with 57 additions and 25 deletions

View file

@ -79,6 +79,16 @@ namespace mchlib {
bool hash_valid;
};
struct ShortFileRecordData {
std::string abs_path;
std::string path;
std::time_t atime;
std::time_t mtime;
uint16_t level;
bool is_directory;
bool is_symlink;
};
struct SetRecordData {
boost::string_ref name;
char type;

View file

@ -23,19 +23,19 @@
#include <vector>
namespace mchlib {
struct FileRecordData;
struct ShortFileRecordData;
namespace scantask {
class DirTree : public Base<std::vector<FileRecordData>> {
class DirTree : public Base<std::vector<ShortFileRecordData>> {
public:
typedef std::vector<FileRecordData> PathList;
typedef std::vector<ShortFileRecordData> PathList;
explicit DirTree ( std::string parRoot );
virtual ~DirTree ( void ) noexcept = default;
private:
virtual void on_data_destroy ( PathList& parData );
virtual void on_data_create ( PathList& parData );
virtual void on_data_destroy ( PathList& parData ) override;
virtual void on_data_create ( PathList& parData ) override;
std::string m_root;
};

View file

@ -30,8 +30,8 @@ namespace mchlib {
virtual ~MediaType ( void ) noexcept = default;
private:
virtual void on_data_destroy ( MediaTypes& parData );
virtual void on_data_create ( MediaTypes& parData );
virtual void on_data_destroy ( MediaTypes& parData ) override;
virtual void on_data_create ( MediaTypes& parData ) override;
MediaTypes m_default;
#if defined(WITH_MEDIA_AUTODETECT)

View file

@ -128,6 +128,7 @@ namespace mchlib {
class SetListing {
public:
typedef std::vector<FileRecordData> ListType;
typedef std::vector<ShortFileRecordData> ShortListType;
typedef implem::DirIterator<true> const_iterator;
explicit SetListing ( ListType&& parList, bool parSort=true );
@ -151,6 +152,7 @@ namespace mchlib {
static void sort_list ( ListType& parList );
static ListType::iterator lower_bound ( ListType& parList, const char* parPath, uint16_t parLevel, bool parIsDir );
static ShortListType::iterator lower_bound ( ShortListType& parList, const char* parPath, uint16_t parLevel, bool parIsDir );
private:
ListType m_list;