43 #ifndef USER_INTERACTION_HPP
44 #define USER_INTERACTION_HPP
46 #include "../my_config.h"
111 virtual void pause(
const std::string & message)
125 virtual bool pause2(
const std::string & message)
126 {
throw Elibcall(
"user_interaction::pause2",
"user_interaction::pause() or pause2() must be overwritten !"); };
134 void warning(
const std::string & message);
141 virtual std::string
get_string(
const std::string & message,
bool echo) = 0;
169 virtual void listing(
const std::string & flag,
170 const std::string & perm,
171 const std::string & uid,
172 const std::string & gid,
173 const std::string & size,
174 const std::string & date,
175 const std::string & filename,
209 const std::string & chemin,
210 const std::string & archive_name);
245 const std::string & data_date,
246 const std::string & data_presence,
247 const std::string & ea_date,
248 const std::string & ea_presence);
259 void printf(
const char *format, ...);
324 bool use_dar_manager_show_files;
325 bool use_dar_manager_contents;
326 bool use_dar_manager_statistics;
327 bool use_dar_manager_show_version;
355 bool (*x_answer_callback)(
const std::string &x,
void *context),
356 std::string (*x_string_callback)(
const std::string &x,
bool echo,
void *context),
357 secu_string (*x_secu_string_callback)(
const std::string &x,
bool echo,
void *context),
358 void *context_value);
361 void pause(
const std::string & message);
363 std::string
get_string(
const std::string & message,
bool echo);
367 void listing(
const std::string & flag,
368 const std::string & perm,
369 const std::string & uid,
370 const std::string & gid,
371 const std::string & size,
372 const std::string & date,
373 const std::string & filename,
384 const std::string & chemin,
385 const std::string & archive_name);
396 const std::string & data_date,
397 const std::string & data_presence,
398 const std::string & ea_date,
399 const std::string & ea_presence);
407 const std::string & perm,
408 const std::string & uid,
409 const std::string & gid,
410 const std::string & size,
411 const std::string & date,
412 const std::string & filename,
417 tar_listing_callback = callback;
423 void set_dar_manager_show_files_callback(
void (*callback)(
const std::string & filename,
428 dar_manager_show_files_callback = callback;
432 void set_dar_manager_contents_callback(
void (*callback)(U_I number,
433 const std::string & chemin,
434 const std::string & archive_name,
437 dar_manager_contents_callback = callback;
441 void set_dar_manager_statistics_callback(
void (*callback)(U_I number,
442 const infinint & data_count,
443 const infinint & total_data,
444 const infinint & ea_count,
445 const infinint & total_ea,
448 dar_manager_statistics_callback = callback;
452 void set_dar_manager_show_version_callback(
void (*callback)(U_I number,
453 const std::string & data_date,
454 const std::string & data_presence,
455 const std::string & ea_date,
456 const std::string & ea_presence,
459 dar_manager_show_version_callback = callback;
472 void (*warning_callback)(
const std::string & x,
void *context);
473 bool (*answer_callback)(
const std::string & x,
void *context);
474 std::string (*string_callback)(
const std::string & x,
bool echo,
void *context);
475 secu_string (*secu_string_callback)(
const std::string & x,
bool echo,
void *context);
476 void (*tar_listing_callback)(
const std::string & flags,
477 const std::string & perm,
478 const std::string & uid,
479 const std::string & gid,
480 const std::string & size,
481 const std::string & date,
482 const std::string & filename,
486 void (*dar_manager_show_files_callback)(
const std::string & filename,
490 void (*dar_manager_contents_callback)(U_I number,
491 const std::string & chemin,
492 const std::string & archive_name,
494 void (*dar_manager_statistics_callback)(U_I number,
495 const infinint & data_count,
496 const infinint & total_data,
497 const infinint & ea_count,
498 const infinint & total_ea,
500 void (*dar_manager_show_version_callback)(U_I number,
501 const std::string & data_date,
502 const std::string & data_presence,
503 const std::string & ea_date,
504 const std::string & ea_presence,
516 bool pause2(
const std::string & message) {
return false; };
518 std::string
get_string(
const std::string & message,
bool echo) {
return "user_interaction_blind, is blindly answering no"; };
void warning(const std::string &message)
method used to display a warning or a message to the user.
exception used to signal an error in the argument given to libdar call of the API ...
std::string get_string(const std::string &message, bool echo)
method used to ask a question that needs an arbitrary answer.
void inherited_warning(const std::string &message)
need to be overwritten in place of the warning() method since API 3.1.x
are defined here basic integer types that tend to be portable
void set_use_listing(bool val)
method to be called with true as argument if you have defined a listing() method. ...
virtual void dar_manager_show_version(U_I number, const std::string &data_date, const std::string &data_presence, const std::string &ea_date, const std::string &ea_presence)
void inherited_warning(const std::string &message)
overwritting method from parent class.
std::string get_string(const std::string &message, bool echo)
overwritting method from parent class.
void set_listing_callback(void(*callback)(const std::string &flag, const std::string &perm, const std::string &uid, const std::string &gid, const std::string &size, const std::string &date, const std::string &filename, bool is_dir, bool has_children, void *context))
You can set a listing callback thanks to this method.
virtual void dar_manager_statistics(U_I number, const infinint &data_count, const infinint &total_data, const infinint &ea_count, const infinint &total_ea)
void dar_manager_show_version(U_I number, const std::string &data_date, const std::string &data_presence, const std::string &ea_date, const std::string &ea_presence)
overwritting method from parent class
virtual bool pause2(const std::string &message)
alternative method to the pause() method
virtual void listing(const std::string &flag, const std::string &perm, const std::string &uid, const std::string &gid, const std::string &size, const std::string &date, const std::string &filename, bool is_dir, bool has_children)
This is a pure virtual class that is used by libdar when interaction with the user is required...
virtual user_interaction * clone() const
overwritting method from parent class.
bool get_use_dar_manager_show_version() const
this is not a virtual method, it has not to be overwritten in inherited classes.
virtual void dar_manager_contents(U_I number, const std::string &chemin, const std::string &archive_name)
virtual void pause(const std::string &message)
method used to ask a boolean question to the user.
virtual user_interaction * clone() const =0
make a newly allocated object which has the same properties as "this".
bool get_use_listing() const
this is not a virtual method, it has not to be overwritten in inherited classes.
void set_use_dar_manager_show_files(bool val)
method to be called with true as argument if you have defined a dar_manager_show_files() method...
void pause(const std::string &message)
overwritting method from parent class.
virtual secu_string get_secu_string(const std::string &message, bool echo)=0
same a get_string() but uses secu_string instead
virtual std::string get_string(const std::string &message, bool echo)=0
method used to ask a question that needs an arbitrary answer.
full implemented class for user_interaction based on callback functions.
memory_pool * get_pool() const
bool get_use_dar_manager_contents() const
this is not a virtual method, it has not to be overwritten in inherited classes.
user_interaction * clone() const
make a newly allocated object which has the same properties as "this".
secu_string get_secu_string(const std::string &message, bool echo)
overwritting method from parent class.
void listing(const std::string &flag, const std::string &perm, const std::string &uid, const std::string &gid, const std::string &size, const std::string &date, const std::string &filename, bool is_dir, bool has_children)
overwritting method from parent class.
secu_string get_secu_string(const std::string &message, bool echo)
same a get_string() but uses secu_string instead
virtual void dar_manager_show_files(const std::string &filename, bool data_change, bool ea_change)
exception used when memory has been exhausted
full implementation class for user_interaction, which shows nothing and assumes answer "no" to any qu...
user_interaction()
class constructor.
bool get_use_dar_manager_show_files() const
this is not a virtual method, it has not to be overwritten in inherited classes.
user_interaction_callback(void(*x_warning_callback)(const std::string &x, void *context), bool(*x_answer_callback)(const std::string &x, void *context), std::string(*x_string_callback)(const std::string &x, bool echo, void *context), secu_string(*x_secu_string_callback)(const std::string &x, bool echo, void *context), void *context_value)
constructor which receive the callback functions.
void dar_manager_contents(U_I number, const std::string &chemin, const std::string &archive_name)
overwritting method from parent class
bool get_use_dar_manager_statistics() const
this is not a virtual method, it has not to be overwritten in inherited classes.
contains all the excetion class thrown by libdar
void warning_with_more(U_I num)
make a pause each N line of output when calling the warning method
switch module to limitint (32 ou 64 bits integers) or infinint
void set_use_dar_manager_show_version(bool val)
method to be called with true as argument if you have defined a dar_manager_show_version() method...
bool pause2(const std::string &message)
alternative method to the pause() method
void dar_manager_statistics(U_I number, const infinint &data_count, const infinint &total_data, const infinint &ea_count, const infinint &total_ea)
overwritting method from parent class
virtual void inherited_warning(const std::string &message)=0
need to be overwritten in place of the warning() method since API 3.1.x
void dar_manager_show_files(const std::string &filename, bool available_data, bool available_ea)
overwritting method from parent class
this is the base class of object that can be allocated on a memory pool
exception used to signal that the user has aborted the operation
the arbitrary large positive integer class
void set_use_dar_manager_contents(bool val)
method to be called with true as argument if you have defined a dar_manager_contents() method...
void set_use_dar_manager_statistics(bool val)
method to be called with true as argument if you have defined a dar_manager_statistics() method...
void printf(const char *format,...)
libdar uses this call to format output before send to warning() method.
this file contains the definition of secu_string class, a std::string like class but allocated in sec...