mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-10 13:04:15 -04:00
Extent scripting interface, add options interface
This commit is contained in:
parent
6788ba0d69
commit
fc406dff35
43
include/dwarfs/options_interface.h
Normal file
43
include/dwarfs/options_interface.h
Normal file
@ -0,0 +1,43 @@
|
||||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/**
|
||||
* \author Marcus Holland-Moritz (github@mhxnet.de)
|
||||
* \copyright Copyright (c) Marcus Holland-Moritz
|
||||
*
|
||||
* This file is part of dwarfs.
|
||||
*
|
||||
* dwarfs 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.
|
||||
*
|
||||
* dwarfs 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 dwarfs. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "dwarfs/options.h"
|
||||
|
||||
namespace dwarfs {
|
||||
|
||||
class options_interface {
|
||||
public:
|
||||
enum set_mode { DEFAULT, OVERRIDE };
|
||||
|
||||
virtual ~options_interface() = default;
|
||||
|
||||
virtual void
|
||||
set_order(file_order_mode order_mode, set_mode mode = DEFAULT) = 0;
|
||||
virtual void
|
||||
set_remove_empty_dirs(bool remove_empty, set_mode mode = DEFAULT) = 0;
|
||||
virtual void enable_similarity() = 0;
|
||||
};
|
||||
|
||||
} // namespace dwarfs
|
@ -28,6 +28,7 @@ namespace dwarfs {
|
||||
|
||||
class entry_interface;
|
||||
class inode;
|
||||
class options_interface;
|
||||
|
||||
class script {
|
||||
public:
|
||||
@ -36,9 +37,15 @@ class script {
|
||||
|
||||
virtual ~script() = default;
|
||||
|
||||
virtual bool has_configure() const = 0;
|
||||
virtual bool has_filter() const = 0;
|
||||
virtual bool has_transform() const = 0;
|
||||
virtual bool has_order() const = 0;
|
||||
|
||||
virtual void configure(options_interface const& oi) = 0;
|
||||
virtual bool filter(entry_interface const& ei) = 0;
|
||||
virtual void transform(entry_interface& ei) = 0;
|
||||
virtual void order(inode_vector& iv) = 0;
|
||||
};
|
||||
|
||||
} // namespace dwarfs
|
||||
|
@ -164,6 +164,12 @@ class os_access_mock : public os_access {
|
||||
|
||||
class script_mock : public script {
|
||||
public:
|
||||
bool has_configure() const override { return true; }
|
||||
bool has_filter() const override { return true; }
|
||||
bool has_transform() const override { return true; }
|
||||
bool has_order() const override { return true; }
|
||||
|
||||
void configure(options_interface const& /*oi*/) override {}
|
||||
|
||||
bool filter(entry_interface const& /*ei*/) override { return true; }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user