26 #ifndef FILESYSTEM_SPECIFIC_ATTRIBUTE_HPP 27 #define FILESYSTEM_SPECIFIC_ATTRIBUTE_HPP 29 #include "../my_config.h" 34 #include <sys/types.h> 105 virtual std::string
show_val()
const = 0;
117 void set_family(
const fsa_family & val) { fam = val; };
118 void set_nature(
const fsa_nature & val) { nat = val; };
130 class filesystem_specific_attribute_list :
public on_pool
133 filesystem_specific_attribute_list() {};
134 filesystem_specific_attribute_list(
const filesystem_specific_attribute_list & ref) { copy_from(ref); };
135 const filesystem_specific_attribute_list & operator = (
const filesystem_specific_attribute_list & ref) { clear(); copy_from(ref);
return *
this; };
136 ~filesystem_specific_attribute_list() { clear(); };
142 void add(
const filesystem_specific_attribute & fsa);
145 fsa_scope get_fsa_families()
const {
return familes; };
148 bool is_included_in(
const filesystem_specific_attribute_list & ref,
const fsa_scope & scope)
const;
151 void read(generic_file & f, archive_version ver);
154 void write(generic_file & f)
const;
157 void get_fsa_from_filesystem_for(user_interaction & ui,
158 const std::string & target,
159 const fsa_scope & scope,
161 bool auto_zeroing_neg_dates);
169 bool set_fsa_to_filesystem_for(
const std::string & target,
170 const fsa_scope & scope,
171 user_interaction & ui)
const;
174 bool empty()
const {
return fsa.empty(); };
178 U_I size()
const {
return fsa.size(); };
182 const filesystem_specific_attribute & operator [] (U_I arg)
const;
185 infinint storage_size()
const;
191 filesystem_specific_attribute_list operator + (
const filesystem_specific_attribute_list & arg)
const;
201 std::vector<filesystem_specific_attribute *> fsa;
204 void copy_from(
const filesystem_specific_attribute_list & ref);
205 void update_familes();
206 void priv_add(
const filesystem_specific_attribute & ref);
209 void fill_extX_FSA_with(
const std::string & target, mode_t itype);
210 void fill_HFS_FSA_with(user_interaction & ui,
211 const std::string & target,
213 bool auto_zeroing_neg_dates);
216 bool set_extX_FSA_to(user_interaction & ui,
const std::string & target)
const;
219 bool set_hfs_FSA_to(user_interaction & ui,
const std::string & target)
const;
221 static std::string family_to_signature(
fsa_family f);
222 static std::string nature_to_signature(
fsa_nature n);
223 static fsa_family signature_to_family(
const std::string & sig);
224 static fsa_nature signature_to_nature(
const std::string & sig);
229 template <
class T> T *cloner(
const T *x, memory_pool *p)
233 T *ret =
new (p) T(*x);
235 throw Ememory(
"cloner template");
242 class fsa_bool :
public filesystem_specific_attribute
248 bool get_value()
const {
return val; };
251 virtual std::string show_val()
const {
return val ? gettext(
"true") : gettext(
"false"); };
252 virtual void write(generic_file & f)
const { f.write(val ?
"T" :
"F", 1); };
253 virtual infinint storage_size()
const {
return 1; };
257 virtual bool equal_value_to(
const filesystem_specific_attribute & ref)
const;
265 class fsa_infinint :
public filesystem_specific_attribute
271 const infinint & get_value()
const {
return val; };
274 virtual std::string show_val()
const;
275 virtual void write(generic_file & f)
const { val.dump(f); };
276 virtual infinint storage_size()
const {
return val.get_storage_size(); };
280 virtual bool equal_value_to(
const filesystem_specific_attribute & ref)
const;
288 class fsa_time :
public filesystem_specific_attribute
294 const datetime & get_value()
const {
return val; };
297 virtual std::string show_val()
const;
298 virtual void write(generic_file & f)
const { val.dump(f); };
299 virtual infinint storage_size()
const {
return val.get_storage_size(); };
303 virtual bool equal_value_to(
const filesystem_specific_attribute & ref)
const;
filesystem specific attributes available families and fsa_scope definition
memory_pool * get_pool() const
are defined here basic integer types that tend to be portable
class crc definition, used to handle Cyclic Redundancy Checks
fsa_family get_family() const
obtain the family of the FSA
filesystem_specific_attribute(fsa_family f)
constructor used to before reading the FSA from filesystem
bool operator<(const filesystem_specific_attribute &ref) const
used to provided a sorted list of FSA
fsa_nature get_nature() const
obtain the nature of the FSA
virtual void write(generic_file &f) const =0
write down to libdar archive
exception used to signal a bug. A bug is triggered when reaching some code that should never be reach...
this is the interface class from which all other data transfer classes inherit
this is the base class of object that can be allocated on a memory pool
virtual infinint storage_size() const =0
give the storage size for the FSA
virtual bool equal_value_to(const filesystem_specific_attribute &ref) const =0
should return true if the value of the argument is equal to the one of 'this' false in any other case...
the arbitrary large positive integer class
bool is_same_type_as(const filesystem_specific_attribute &ref) const
provide a mean to compare objects types
virtual std::string show_val() const =0
provides a human readable value of the FSA
virtual bool operator==(const filesystem_specific_attribute &ref) const
provides a mean to compare objects values
libdar namespace encapsulate all libdar symbols
filesystem_specific_attribute(generic_file &f, fsa_family xfam, fsa_nature xnat)
constructor used to read a FSA from a libdar archive
virtual filesystem_specific_attribute * clone() const =0
provides a way to copy objects without having to know the more specific class of the object ...
virtual ~filesystem_specific_attribute()
virtual destructor for inherited classes