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

Turn around Set's tasks so that they provide a SetRecordDataFull.

This commit is contained in:
King_DuckZ 2016-03-09 21:26:43 +01:00
parent fd5be6216a
commit fe7e9c4af9
10 changed files with 138 additions and 26 deletions

View file

@ -35,6 +35,7 @@ namespace mchlib {
const std::string& media_type_to_str ( MediaTypes parType );
MediaTypes char_to_media_type ( char parMType ) a_pure;
char media_type_to_char ( MediaTypes parMType ) a_pure;
} //namespace mchlib
#endif

View file

@ -18,27 +18,30 @@
#ifndef id148DBED10A0B45238E810683656BA7D5
#define id148DBED10A0B45238E810683656BA7D5
#include "dindexer-machinery/scantask/leanbase.hpp"
#include "dindexer-machinery/scantask/base.hpp"
#include "dindexer-machinery/guess_content_type.hpp"
#include "dindexer-machinery/mediatypes.hpp"
#include <memory>
#include <vector>
namespace mchlib {
struct FileRecordData;
struct SetRecordDataFull;
namespace scantask {
class ContentType : public Base<mchlib::ContentTypes> {
class ContentType : public LeanBase<SetRecordDataFull> {
public:
using DirTreeTaskPtr = std::shared_ptr<Base<std::vector<FileRecordData>>>;
using MediaTypeTaskPtr = std::shared_ptr<Base<mchlib::MediaTypes>>;
using MediaTypeTaskPtr = std::shared_ptr<LeanBase<SetRecordDataFull>>;
using SetTaskType = std::shared_ptr<LeanBase<SetRecordDataFull>>;
ContentType ( DirTreeTaskPtr parDirTree, MediaTypeTaskPtr parMediaType );
ContentType ( SetTaskType parSet, DirTreeTaskPtr parDirTree, MediaTypeTaskPtr parMediaType );
private:
virtual void on_data_destroy ( mchlib::ContentTypes& parData ) override;
virtual void on_data_create ( mchlib::ContentTypes& parData ) override;
virtual void on_data_fill ( void ) override;
virtual SetRecordDataFull& on_data_get ( void ) override;
SetTaskType m_set_task;
DirTreeTaskPtr m_dir_tree;
MediaTypeTaskPtr m_media_type;
};

View file

@ -18,21 +18,28 @@
#ifndef id25B0BCA6D9464754920E1BC7C5D9DB57
#define id25B0BCA6D9464754920E1BC7C5D9DB57
#include "dindexer-machinery/scantask/leanbase.hpp"
#include "dindexer-machinery/scantask/base.hpp"
#include "dindexer-machinery/mediatypes.hpp"
#include <string>
#include <memory>
namespace mchlib {
struct SetRecordDataFull;
namespace scantask {
class MediaType : public Base<mchlib::MediaTypes> {
class MediaType : public LeanBase<SetRecordDataFull> {
public:
MediaType ( char parDefault, bool parForce, std::string parSearchPath );
using SetTaskType = std::shared_ptr<LeanBase<SetRecordDataFull>>;
MediaType ( SetTaskType parSet, char parDefault, bool parForce, std::string parSearchPath );
virtual ~MediaType ( void ) noexcept = default;
private:
virtual void on_data_destroy ( MediaTypes& parData ) override;
virtual void on_data_create ( MediaTypes& parData ) override;
virtual void on_data_fill ( void ) override;
virtual SetRecordDataFull& on_data_get ( void ) override;
SetTaskType m_set_task;
MediaTypes m_default;
#if defined(WITH_MEDIA_AUTODETECT)
std::string m_search_path;

View file

@ -0,0 +1,42 @@
/* Copyright 2015, 2016, Michele Santullo
* This file is part of "dindexer".
*
* "dindexer" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "dindexer" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "dindexer". If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef idB323CEFC89C2468CA0A341C312C6C2C0
#define idB323CEFC89C2468CA0A341C312C6C2C0
#include "dindexer-machinery/scantask/base.hpp"
#include "dindexer-machinery/recorddata.hpp"
#include <string>
namespace mchlib {
namespace scantask {
class SetBasic : public Base<SetRecordDataFull> {
typedef Base<SetRecordDataFull> ParentType;
public:
explicit SetBasic ( std::string&& parName );
virtual ~SetBasic ( void ) noexcept;
private:
virtual void on_data_destroy ( SetRecordDataFull& parData ) override;
virtual void on_data_create ( SetRecordDataFull& parData ) override;
std::string m_set_name;
};
} //namespace scantask
} //namespace mchlib
#endif