30 #include "../my_config.h" 42 class pile :
public generic_file
51 pile(
const pile & ref) :
generic_file(ref) { copy_from(ref); };
52 const pile & operator = (
const pile & ref) { detruit(); copy_from(ref);
return *
this; };
53 ~pile() { detruit(); };
64 void push(generic_file *f,
const std::string & label =
"");
75 template <
class T>
bool pop_and_close_if_type_is(T *ptr);
78 generic_file *top() {
if(stack.empty())
return NULL;
else return stack.back().ptr; };
81 generic_file *bottom() {
if(stack.empty())
return NULL;
else return stack[0].ptr; };
84 U_I size()
const {
return stack.size(); };
87 bool is_empty()
const {
return stack.empty(); };
90 void clear() { detruit(); };
95 template<
class T>
void find_first_from_top(T * & ref);
98 template<
class T>
void find_first_from_bottom(T * & ref);
120 void clear_label(
const std::string & label);
128 void add_label(
const std::string & label);
135 bool skip(
const infinint & pos);
137 bool skip_relative(S_I x);
138 infinint get_position();
139 void copy_to(generic_file & ref);
140 void copy_to(generic_file & ref,
const infinint & crc_size, crc * & value);
143 U_I inherited_read(
char *a, U_I size);
144 void inherited_write(
const char *a, U_I size);
145 void inherited_sync_write();
146 void inherited_terminate();
152 std::list<std::string> labels;
155 std::vector<face> stack;
157 void copy_from(
const pile & ref)
162 std::vector<face>::iterator look_for_label(
const std::string & label);
166 template <
class T>
bool pile::pop_and_close_if_type_is(T *ptr)
172 top = stack.back().ptr;
173 ptr =
dynamic_cast<T *
>(top);
187 template <
class T>
void pile::find_first_from_top(T * & ref)
190 for(std::vector<face>::reverse_iterator it = stack.rbegin(); it != stack.rend() && ref == NULL; ++it)
191 ref = dynamic_cast<T *>(it->ptr);
195 template <
class T>
void pile::find_first_from_bottom(T * & ref)
198 for(std::vector<face>::iterator it = stack.begin(); it != stack.end() && ref == NULL; ++it)
199 ref = dynamic_cast<T *>(it->ptr);
U_32 copy_to(generic_file &ref, U_32 size)
small copy (up to 4GB) with CRC calculation
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
generic_file(gf_mode m)
main constructor
this is the interface class from which all other data transfer classes inherit
libdar namespace encapsulate all libdar symbols