32 #include "../my_config.h"
66 mask(
mask && ref) noexcept =
default;
67 mask & operator = (
const mask & ref) =
default;
68 mask & operator = (
mask && ref) noexcept =
default;
69 virtual ~
mask() =
default;
76 virtual bool is_covered(
const std::string &expression)
const = 0;
89 virtual std::string
dump(
const std::string & prefix =
"")
const = 0;
116 bool is_covered(
const std::string & expression)
const override {
return val; };
118 std::string
dump(
const std::string & prefix)
const override {
return prefix + (val ? gettext(
"TRUE") : gettext(
"FALSE")); };
138 simple_mask(
const std::string & wilde_card_expression,
bool case_sensit);
157 bool is_covered(
const std::string &expression)
const override;
160 std::string
dump(
const std::string & prefix)
const override;
166 std::string the_mask;
200 bool is_covered(
const std::string & expression)
const override;
203 std::string
dump(
const std::string & prefix)
const override;
213 void set_preg(
const std::string & wilde_card_expression,
218 void detruit() noexcept { regfree(&preg); };
254 std::string
dump(
const std::string & prefix)
const override;
262 void nullifyptr() noexcept { ref =
nullptr; };
264 void copy_from(
const mask &m);
265 void move_from(
not_mask && ref) noexcept;
307 bool is_covered(
const std::string & expression)
const override {
return t_is_covered(expression); };
308 bool is_covered(
const path & chemin)
const override {
return t_is_covered(chemin); };
309 std::string
dump(
const std::string & prefix)
const override {
return dump_logical(prefix, gettext(
"AND")); };
318 U_I
size()
const {
return lst.size(); };
328 std::deque<mask *> lst;
330 std::string dump_logical(
const std::string & prefix,
const std::string & boolop)
const;
333 void copy_from(
const et_mask & m);
334 void move_from(
et_mask && m) noexcept;
337 template<
class T>
bool t_is_covered(
const T & expression)
const
339 std::deque<mask *>::const_iterator it = lst.begin();
342 throw Erange(
"et_mask::is_covered",
dar_gettext(
"No mask in the list of mask to operate on"));
344 while(it != lst.end() && (*it)->is_covered(expression))
347 return it == lst.end();
370 bool is_covered(
const std::string & expression)
const override {
return t_is_covered(expression); };
371 bool is_covered(
const path & chemin)
const override {
return t_is_covered(chemin); };
372 std::string
dump(
const std::string & prefix)
const override {
return dump_logical(prefix, gettext(
"OR")); };
377 template<
class T>
bool t_is_covered(
const T & expression)
const
379 std::deque<mask *>::const_iterator it = lst.begin();
382 throw Erange(
"et_mask::is_covered",
dar_gettext(
"No mask to operate on in the list of mask"));
384 while(it != lst.end() && ! (*it)->is_covered(expression))
387 return it != lst.end();
411 bool is_covered(
const std::string & expression)
const override {
throw SRC_BUG; };
413 std::string
dump(
const std::string & prefix)
const override;
433 same_path_mask(
const std::string &p,
bool case_sensit) { chemin = p; case_s = case_sensit; };
444 std::string
dump(
const std::string & prefix)
const override;
464 exclude_dir_mask(
const std::string &p,
bool case_sensit) { chemin = p; case_s = case_sensit;};
472 bool is_covered(
const std::string &expression)
const override {
throw SRC_BUG; }
474 std::string
dump(
const std::string & prefix)
const override;
exception used to signal range error
boolean mask, either always true or false
mask * clone() const override
inherited from the mask class
bool is_covered(const std::string &expression) const override
inherited from the mask class
std::string dump(const std::string &prefix) const override
dump in human readable form the nature of the mask
bool is_covered(const path &chemin) const override
check whether the given path is covered by the mask
bool_mask(bool always)
the constructor
makes an AND operator between two or more masks
bool is_covered(const path &chemin) const override
check whether the given path is covered by the mask
void add_mask(const mask &toadd)
add a mask to the operator
void clear()
clear the mask
bool is_covered(const std::string &expression) const override
inherited from the mask class
std::string dump(const std::string &prefix) const override
dump in human readable form the nature of the mask
et_mask(const et_mask &m)
copy constructor
et_mask(et_mask &&m) noexcept
move constructor
mask * clone() const override
inherited from the mask class
et_mask & operator=(const et_mask &m)
assignment operator
et_mask()
the constructor to be used by libdar external programs
U_I size() const
the number of mask on which is done the AND operator
matches if string is the given constructor string or a sub directory of it
std::string dump(const std::string &prefix) const override
dump in human readable form the nature of the mask
mask * clone() const override
inherited from the mask class
exclude_dir_mask(const std::string &p, bool case_sensit)
the constructor to be used by libdar external programs
bool is_covered(const path &chemin) const override
check whether the given path is covered by the mask
bool is_covered(const std::string &expression) const override
inherited from the mask class
the generic class, parent of all masks
virtual bool is_covered(const std::string &expression) const =0
check wether the given string is covered by the mask
virtual mask * clone() const =0
virtual std::string dump(const std::string &prefix="") const =0
dump in human readable form the nature of the mask
virtual bool is_covered(const path &chemin) const
check whether the given path is covered by the mask
not_mask(const not_mask &m)
copy constructor
mask * clone() const override
inherited from the mask class
std::string dump(const std::string &prefix) const override
dump in human readable form the nature of the mask
not_mask(not_mask &&m) noexcept
move constructor
not_mask & operator=(const not_mask &m)
assignment operator
bool is_covered(const path &chemin) const override
check whether the given path is covered by the mask
bool is_covered(const std::string &expression) const override
inherited from the mask class
not_mask(const mask &m)
the constructor to be used by libdar external programs
makes the OR operator between two or more masks
bool is_covered(const std::string &expression) const override
inherited from the mask class
std::string dump(const std::string &prefix) const override
dump in human readable form the nature of the mask
mask * clone() const override
inherited from the mask class
bool is_covered(const path &chemin) const override
check whether the given path is covered by the mask
the class path is here to manipulate paths in the Unix notation: using'/'
bool is_subdir_of(const path &p, bool case_sensit) const
test whether the current object is a subdir of the method's argument
std::string display() const
convert back a path to a string
matches regular expressions (see "man 7 regex")
regular_mask(const std::string &wilde_card_expression, bool x_case_sensit)
the constructor to be used by libdar external programs
std::string dump(const std::string &prefix) const override
inherited from the mask class
std::string mask_exp
used only by the copy constructor
mask * clone() const override
inherited from the mask class
regular_mask(regular_mask &&ref) noexcept
the move constructor
virtual ~regular_mask()
destructor
regular_mask & operator=(const regular_mask &ref)
the assignment operator
regular_mask(const regular_mask &ref)
the copy constructor
bool case_sensit
used only by the copy constructor
bool is_covered(const std::string &expression) const override
inherited from the mask class
matches if string is exactly the given mask (no wilde card expression)
bool is_covered(const std::string &chemin) const override
inherited from the mask class
same_path_mask(const std::string &p, bool case_sensit)
the constructor to be used by libdar external programs
mask * clone() const override
inherited from the mask class
std::string dump(const std::string &prefix) const override
inherited from the mask class
matches as done on shell command lines (see "man 7 glob")
bool is_covered(const std::string &expression) const override
inherited from the mask class
mask * clone() const override
inherited from the mask class
simple_mask(const std::string &wilde_card_expression, bool case_sensit)
the constructor to use by libdar external programs
~simple_mask()=default
default destructor
simple_mask(simple_mask &&ref) noexcept=default
move constructor
simple_mask & operator=(const simple_mask &m)=default
assignment operator
std::string dump(const std::string &prefix) const override
inherited from the mask class
simple_mask(const simple_mask &m)=default
copy constructor
string matches if it is subdir of mask or mask is a subdir of expression
std::string dump(const std::string &prefix) const override
dump in human readable form the nature of the mask
simple_path_mask(const path &p, bool case_sensit)
the constructor to be used by libdar external programs
mask * clone() const override
inherited from the mask class
bool is_covered(const std::string &expression) const override
inherited from the mask class
bool is_covered(const path &chemin) const override
check whether the given path is covered by the mask
contains all the excetion class thrown by libdar
const char * dar_gettext(const char *)
a routine to change NLS domaine forth and back for inline routines
libdar namespace encapsulate all libdar symbols
here is the definition of the path class