43 #ifndef USER_INTERACTION_HPP 44 #define USER_INTERACTION_HPP 46 #include "../my_config.h" 110 virtual void pause(
const std::string & message)
124 virtual bool pause2(
const std::string & message)
125 {
throw Elibcall(
"user_interaction::pause2",
"user_interaction::pause() or pause2() must be overwritten !"); };
133 void warning(
const std::string & message);
140 virtual std::string
get_string(
const std::string & message,
bool echo) = 0;
168 virtual void listing(
const std::string & flag,
169 const std::string & perm,
170 const std::string & uid,
171 const std::string & gid,
172 const std::string & size,
173 const std::string & date,
174 const std::string & filename,
208 const std::string & chemin,
209 const std::string & archive_name);
244 const std::string & data_date,
245 const std::string & data_presence,
246 const std::string & ea_date,
247 const std::string & ea_presence);
258 void printf(
const char *format, ...);
323 bool use_dar_manager_show_files;
324 bool use_dar_manager_contents;
325 bool use_dar_manager_statistics;
326 bool use_dar_manager_show_version;
354 bool (*x_answer_callback)(
const std::string &x,
void *context),
355 std::string (*x_string_callback)(
const std::string &x,
bool echo,
void *context),
356 secu_string (*x_secu_string_callback)(
const std::string &x,
bool echo,
void *context),
357 void *context_value);
360 void pause(
const std::string & message);
362 std::string
get_string(
const std::string & message,
bool echo);
366 void listing(
const std::string & flag,
367 const std::string & perm,
368 const std::string & uid,
369 const std::string & gid,
370 const std::string & size,
371 const std::string & date,
372 const std::string & filename,
383 const std::string & chemin,
384 const std::string & archive_name);
395 const std::string & data_date,
396 const std::string & data_presence,
397 const std::string & ea_date,
398 const std::string & ea_presence);
406 const std::string & perm,
407 const std::string & uid,
408 const std::string & gid,
409 const std::string & size,
410 const std::string & date,
411 const std::string & filename,
416 tar_listing_callback = callback;
422 void set_dar_manager_show_files_callback(
void (*callback)(
const std::string & filename,
427 dar_manager_show_files_callback = callback;
431 void set_dar_manager_contents_callback(
void (*callback)(U_I number,
432 const std::string & chemin,
433 const std::string & archive_name,
436 dar_manager_contents_callback = callback;
440 void set_dar_manager_statistics_callback(
void (*callback)(U_I number,
447 dar_manager_statistics_callback = callback;
451 void set_dar_manager_show_version_callback(
void (*callback)(U_I number,
452 const std::string & data_date,
453 const std::string & data_presence,
454 const std::string & ea_date,
455 const std::string & ea_presence,
458 dar_manager_show_version_callback = callback;
471 void (*warning_callback)(
const std::string & x,
void *context);
472 bool (*answer_callback)(
const std::string & x,
void *context);
473 std::string (*string_callback)(
const std::string & x,
bool echo,
void *context);
474 secu_string (*secu_string_callback)(
const std::string & x,
bool echo,
void *context);
475 void (*tar_listing_callback)(
const std::string & flags,
476 const std::string & perm,
477 const std::string & uid,
478 const std::string & gid,
479 const std::string & size,
480 const std::string & date,
481 const std::string & filename,
485 void (*dar_manager_show_files_callback)(
const std::string & filename,
489 void (*dar_manager_contents_callback)(U_I number,
490 const std::string & chemin,
491 const std::string & archive_name,
493 void (*dar_manager_statistics_callback)(U_I number,
499 void (*dar_manager_show_version_callback)(U_I number,
500 const std::string & data_date,
501 const std::string & data_presence,
502 const std::string & ea_date,
503 const std::string & ea_presence,
515 bool pause2(
const std::string & message) {
return false; };
517 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
virtual user_interaction * clone() const =0
make a newly allocated object which has the same properties as "this".
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)
virtual void dar_manager_statistics(U_I number, const infinint &data_count, const infinint &total_data, const infinint &ea_count, const infinint &total_ea)
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...
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.
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...
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.
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.
full implemented class for user_interaction based on callback functions.
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)
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.
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
virtual void inherited_warning(const std::string &message)=0
need to be overwritten in place of the warning() method since API 3.1.x
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...
libdar namespace encapsulate all libdar symbols