27 #ifndef LIST_ENTRY_HPP 28 #define LIST_ENTRY_HPP 33 #include "../my_config.h" 74 bool is_eod()
const {
return type ==
'z'; };
79 const std::string & get_name()
const {
return my_name; };
80 unsigned char get_type()
const {
return type; };
81 bool is_dir()
const {
return type ==
'd'; };
82 bool is_file()
const {
return type ==
'f'; };
83 bool is_symlink()
const {
return type ==
'l'; };
84 bool is_char_device()
const {
return type ==
'c'; };
85 bool is_block_device()
const {
return type ==
'b'; };
86 bool is_unix_socket()
const {
return type ==
's'; };
87 bool is_named_pipe()
const {
return type ==
'p'; };
88 bool is_hard_linked()
const {
return hard_link; };
89 bool is_removed_entry()
const {
return type ==
'x'; };
90 bool is_door_inode()
const {
return type ==
'o'; };
91 bool is_empty_dir()
const {
return empty_dir; };
96 std::string get_data_flag()
const;
97 saved_status get_data_status()
const {
return data_status; };
101 std::string get_ea_flag()
const;
106 std::string get_fsa_flag()
const;
108 std::string get_uid(
bool try_resolving_name =
false)
const;
109 std::string get_gid(
bool try_resolving_name =
false)
const;
110 std::string get_perm()
const;
111 std::string get_last_access()
const;
112 std::string get_last_modif()
const;
113 std::string get_last_change()
const;
115 time_t get_last_access_s()
const {
return datetime2time_t(last_access); };
116 time_t get_last_modif_s()
const;
117 time_t get_last_change_s()
const {
return datetime2time_t(last_change); };
125 void get_last_access(datetime::time_unit tu, time_t & second, time_t & fraction)
const 126 { last_access.
get_value(second, fraction, tu); }
129 void get_last_modif(datetime::time_unit tu, time_t & second, time_t & fraction)
const 133 void get_last_change(datetime::time_unit tu, time_t & second, time_t & fraction)
const 134 { last_change.
get_value(second, fraction, tu); }
136 std::string get_file_size(
bool size_in_bytes =
true)
const;
137 std::string get_compression_ratio()
const;
138 std::string get_compression_ratio_flag()
const;
139 bool is_sparse()
const {
return sparse_file; };
140 std::string get_sparse_flag()
const {
return sparse_file ?
"[X]" :
"[ ]"; };
141 std::string get_compression_algo()
const {
return compression2string(compression_algo); };
142 bool is_dirty()
const {
return dirty; };
143 std::string get_link_target()
const {
return target; };
144 std::string get_major()
const;
145 std::string get_minor()
const;
153 bool has_delta_signature()
const {
return delta_sig; };
154 std::string get_delta_flag()
const;
170 std::string get_archive_offset_for_data()
const {
return offset_for_data.
is_zero() ?
"" :
deci(offset_for_data).
human(); };
187 std::string get_archive_offset_for_EA()
const {
return offset_for_EA.
is_zero() ?
"" :
deci(offset_for_EA).
human(); };
192 std::string get_storage_size_for_EA()
const {
return storage_size_for_EA.
is_zero() ?
"" :
deci(storage_size_for_EA).
human(); };
201 std::string get_archive_offset_for_FSA()
const {
return offset_for_FSA.
is_zero() ?
"" :
deci(offset_for_FSA).
human(); };
206 std::string get_storage_size_for_FSA()
const {
return storage_size_for_FSA.
is_zero() ?
"" :
deci(storage_size_for_FSA).
human(); };
226 std::string get_data_crc()
const {
return data_crc; };
227 std::string get_delta_patch_base_crc()
const {
return patch_base_crc; };
228 std::string get_delta_patch_result_crc()
const {
return patch_result_crc; };
232 void set_name(
const std::string & val) { my_name = val; };
233 void set_type(
unsigned char val) { type = val; };
234 void set_removed_type(
unsigned char val);
235 void set_hard_link(
bool val) { hard_link = val; };
236 void set_uid(
const infinint & val) { uid = val; };
237 void set_gid(
const infinint & val) { gid = val; };
238 void set_perm(U_16 val) { perm = val; };
239 void set_last_access(
const datetime & val) { last_access = val; };
241 void set_removal_date(
const datetime & val);
242 void set_saved_status(
saved_status val) { data_status = val; };
244 void set_last_change(
const datetime & val) { last_change = val; };
246 void set_file_size(
const infinint & val) { file_size = val; };
247 void set_is_sparse_file(
bool val) { sparse_file = val; };
248 void set_compression_algo(
compression val) { compression_algo = val; };
249 void set_dirtiness(
bool val) { dirty = val; };
250 void set_link_target(
const std::string & val) {
target = val; };
251 void set_major(
int val) { major = val; };
252 void set_minor(
int val) { minor = val; };
253 void set_slices(
const range & sl) { slices = sl; };
254 void set_delta_sig(
bool val) { delta_sig = val; };
255 void set_archive_offset_for_data(
const infinint & val) { offset_for_data = val; };
256 void set_storage_size_for_data(
const infinint & val) { storage_size_for_data = val; };
257 void set_archive_offset_for_EA(
const infinint & val) { offset_for_EA = val; };
258 void set_storage_size_for_EA(
const infinint & val) { storage_size_for_EA = val; };
259 void set_archive_offset_for_FSA(
const infinint & val) { offset_for_FSA = val; };
260 void set_storage_size_for_FSA(
const infinint & val) { storage_size_for_FSA = val; };
263 void set_fsa_scope(
const fsa_scope & arg) { fsa_sc = arg; };
264 void set_data_crc(
const crc & ptr);
265 void set_delta_patch_base_crc(
const crc & ptr);
266 void set_delta_patch_result_crc(
const crc & ptr);
267 void set_empty_dir(
bool val) {
if(!is_dir())
throw SRC_BUG; empty_dir = val; };
300 std::deque<std::string> ea;
301 mutable std::deque<std::string>::const_iterator it_ea;
303 std::string data_crc;
304 std::string patch_base_crc;
305 std::string patch_result_crc;
308 static time_t datetime2time_t(
const datetime & val);
bool get_ea_read_next(std::string &key) const
read the next Extended Attribute name
filesystem specific attributes available families and fsa_scope definition
are defined here basic integer types that tend to be portable
saved_status
data saved status for an entry
void get_ea_reset_read() const
reset the reading of Extended Attributes names
fsa_scope get_fsa_scope() const
this is the hard-link ID, only valid for hard linked entries
decimal class, convert infinint from and to decimal represention
time_t get_removal_date_s() const
for removed_entry only
void get_last_access(datetime::time_unit tu, time_t &second, time_t &fraction) const
yet an alternative method to get last access time
std::string get_removal_date() const
for removed_entry only
void get_last_modif(datetime::time_unit tu, time_t &second, time_t &fraction) const
yet an alternative method to get the last modification date (see get_last_access() for details) ...
EA were present in the reference version, but not present anymore.
bool get_storage_size_for_FSA(infinint &val) const
amount of byte used to store the file's FSA
fsa_saved_status
FSA saved status for an entry.
infinint etiquette
hard link identification
bool get_archive_offset_for_FSA(infinint &val) const
offset in byte where to find the first byte of Filesystem Specific Attributes
inode is saved in the archive
compression parameters for API
void get_last_change(datetime::time_unit tu, time_t &second, time_t &fraction) const
yet an alternative method to get the last change date (see get_last_access() for details) ...
std::string target
target[0] used to store signature of removed entry for removed entries
std::string compression2string(compression c)
convert a compression to its string representation
stores a range of integers or a set of ranges
the different status of data and EA
no EA present for this inode in filesystem
datetime last_modif
also used to store removal_date for removed entries
std::set< fsa_family > fsa_scope
set of fsa families
switch module to limitint (32 ou 64 bits integers) or infinint
bool get_storage_size_for_data(infinint &val) const
amount of byte used to store the file's data
bool get_storage_size_for_EA(infinint &val) const
amount of byte used to store the file's EA
manages the decimal representation of infinint
ea_saved_status
EA saved status for an entry.
compression
the different compression algorithm available
this file contains the definition of class datetime that stores unix times in a portable way ...
unsigned char get_removed_type() const
valid only for removed_entries
EA present in filesystem and attached to this inode.
bool get_archive_offset_for_EA(infinint &val) const
offset in byte whert to find the first byte of Extended Attributes
the arbitrary large positive integer class
class than provide a way to manipulate and represent range of integer numbers (infinint) ...
inode is saved but as delta binary from the content (delta signature) of what was found in the archiv...
bool is_eod() const
method used to know whether the returned entry signals a End of Directory
bool get_value(time_t &second, time_t &subsecond, time_unit unit) const
return a time as time_t arguments
contains a set of routines to manage EA values associated to a file
the class ea_attributs manages the set of EA that can be associated to an inode
pure virtual class defining interface of a CRC object
const range & get_slices() const
provides slice information
libdar namespace encapsulate all libdar symbols
std::string human() const
this produce a string from the decimal stored in the current object
bool get_archive_offset_for_data(infinint &val) const
offset in byte where to find first byte of data