Loading...
Searching...
No Matches
libdar5::user_interaction_callback Class Reference
API5

full implemented class for user_interaction based on callback functions. More...

`#include <user_interaction_callback5.hpp>`

Inherits libdar5::user_interaction.

## Public Member Functions

| 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.
| user_interaction_callback (const user_interaction_callback &ref)=default
| user_interaction_callback (user_interaction_callback &&ref) noexcept=default
user_interaction_callback & | operator= (const user_interaction_callback &ref)=default
user_interaction_callback & | operator= (user_interaction_callback &&ref) noexcept=default
virtual void | pause (const std::string &message) override
| overwritting method from parent class.
virtual std::string | get_string (const std::string &message, bool echo) override
| overwritting method from parent class.
virtual secu_string | get_secu_string (const std::string &message, bool echo) override
| overwritting method from parent class.
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) override
| overwritting method from parent class.
virtual void | dar_manager_show_files (const std::string &filename, bool available_data, bool available_ea) override
| overwritting method from parent class
virtual void | dar_manager_contents (U_I number, const std::string &chemin, const std::string &archive_name) override
| overwritting method from parent class
virtual void | dar_manager_statistics (U_I number, const infinint &data_count, const infinint &total_data, const infinint &ea_count, const infinint &total_ea) override
| overwritting method from parent class
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) override
| 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.
void | set_dar_manager_show_files_callback (void(*callback)(const std::string &filename, bool available_data, bool available_ea, void *context))
| You can set a dar_manager_show_files callback thanks to this method.
void | set_dar_manager_contents_callback (void(*callback)(U_I number, const std::string &chemin, const std::string &archive_name, void *context))
void | set_dar_manager_statistics_callback (void(*callback)(U_I number, const infinint &data_count, const infinint &total_data, const infinint &ea_count, const infinint &total_ea, void *context))
void | set_dar_manager_show_version_callback (void(*callback)(U_I number, const std::string &data_date, const std::string &data_presence, const std::string &ea_date, const std::string &ea_presence, void *context))
virtual user_interaction * | clone () const override
| overwritting method from parent class.
Public Member Functions inherited from libdar5::user_interaction
| user_interaction ()
| class constructor.
| user_interaction (const user_interaction &ref)=default
| user_interaction (user_interaction &&ref) noexcept=default
user_interaction & | operator= (const user_interaction &ref)=default
user_interaction & | operator= (user_interaction &&ref) noexcept=default
void | warning (const std::string &msg)
| method added for backward compatibility with API v5
virtual bool | pause2 (const std::string &message)
| alternative method to the pause() method
bool | get_use_listing () const
| this is not a virtual method, it has not to be overwritten in inherited classes.
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_contents () 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.
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 | printf (const char *format,...) override
| libdar uses this call to format output before send to message() method.
void | warning_with_more (U_I num)
| make a pause each N line of output when calling the warning method
Public Member Functions inherited from libdar::user_interaction
| user_interaction (const user_interaction &ref)=default
| user_interaction (user_interaction &&ref) noexcept=default
user_interaction & | operator= (const user_interaction &ref)=default
user_interaction & | operator= (user_interaction &&ref) noexcept=default
void | message (const std::string &message)
void | pause (const std::string &message)
std::string | get_string (const std::string &message, bool echo)
secu_string | get_secu_string (const std::string &message, bool echo)

## Protected Member Functions

void | change_context_value (void *new_value)
| change the context value of the object that will be given to callback functions
virtual void | inherited_warning (const std::string &message) override
| overwritting method from parent class.
Protected Member Functions inherited from libdar5::user_interaction
void | set_use_listing (bool val)
| method to be called with true as argument if you have defined a listing() method.
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 | 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 | 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.
virtual void | inherited_message (const std::string &message) override
| need to be overwritten in place of the warning() method since API 3.1.x
virtual bool | inherited_pause (const std::string &message) override
| method used to ask a boolean question to the user.
virtual std::string | inherited_get_string (const std::string &message, bool echo) override
| method used to ask a question that needs an arbitrary answer.
virtual secu_string | inherited_get_secu_string (const std::string &message, bool echo) override
| same a get_string() but uses libdar::secu_string instead of std::string

## Private Attributes

void(* | warning_callback )(const std::string &x, void *context)
bool(* | answer_callback )(const std::string &x, void *context)
std::string(* | string_callback )(const std::string &x, bool echo, void *context)
secu_string(* | secu_string_callback )(const std::string &x, bool echo, void *context)
void(* | tar_listing_callback )(const std::string &flags, 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)
void(* | dar_manager_show_files_callback )(const std::string &filename, bool available_data, bool available_ea, void *context)
void(* | dar_manager_contents_callback )(U_I number, const std::string &chemin, const std::string &archive_name, void *context)
void(* | dar_manager_statistics_callback )(U_I number, const infinint &data_count, const infinint &total_data, const infinint &ea_count, const infinint &total_ea, void *context)
void(* | dar_manager_show_version_callback )(U_I number, const std::string &data_date, const std::string &data_presence, const std::string &ea_date, const std::string &ea_presence, void *context)
void * | context_val

## Detailed Description

full implemented class for user_interaction based on callback functions.

this class is an inherited class of user_interaction it is used by dar command line programs, but you can use it if you wish.

Definition at line 46 of file user_interaction_callback5.hpp.

## Constructor & Destructor Documentation

## user_interaction_callback()

libdar5::user_interaction_callback::user_interaction_callback | ( | void(*)(const std::string &x, void *context) | x_warning_callback,
|  | bool(*)(const std::string &x, void *context) | x_answer_callback,
|  | std::string(*)(const std::string &x, bool echo, void *context) | x_string_callback,
|  | secu_string(*)(const std::string &x, bool echo, void *context) | x_secu_string_callback,
|  | void * | context_value
| ) |  |

constructor which receive the callback functions.

Parameters

  [in] | x_warning_callback | is used by warning() method
  [in] | x_answer_callback | is used by the pause() method
  [in] | x_string_callback | is used by get_string() method
  [in] | x_secu_string_callback | is used by get_secu_string() method
  [in] | context_value | will be passed as last argument of callbacks when called from this object.

Note
  The context argument of each callback is set with the context_value given in the user_interaction_callback object constructor. The value can can be any arbitrary value (nullptr is valid), and can be used as you wish. Note that the listing callback is not defined here, but thanks to a specific method

## Member Function Documentation

## change_context_value()

void libdar5::user_interaction_callback::change_context_value | ( | void * | new_value | ) |

inline protected

change the context value of the object that will be given to callback functions

Definition at line 181 of file user_interaction_callback5.hpp.

## clone()

virtual user_interaction * libdar5::user_interaction_callback::clone | ( |  | ) | const

override virtual

overwritting method from parent class.

Implements libdar5::user_interaction.

## dar_manager_contents()

virtual void libdar5::user_interaction_callback::dar_manager_contents | ( | U_I | number,
|  | const std::string & | chemin,
|  | const std::string & | archive_name
| ) |  |

override virtual

overwritting method from parent class

Reimplemented from libdar5::user_interaction.

## dar_manager_show_files()

virtual void libdar5::user_interaction_callback::dar_manager_show_files | ( | const std::string & | filename,
|  | bool | available_data,
|  | bool | available_ea
| ) |  |

override virtual

overwritting method from parent class

Reimplemented from libdar5::user_interaction.

## dar_manager_show_version()

virtual void libdar5::user_interaction_callback::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
| ) |  |

override virtual

overwritting method from parent class

Reimplemented from libdar5::user_interaction.

## dar_manager_statistics()

virtual void libdar5::user_interaction_callback::dar_manager_statistics | ( | U_I | number,
|  | const infinint & | data_count,
|  | const infinint & | total_data,
|  | const infinint & | ea_count,
|  | const infinint & | total_ea
| ) |  |

override virtual

overwritting method from parent class

Reimplemented from libdar5::user_interaction.

## get_secu_string()

virtual secu_string libdar5::user_interaction_callback::get_secu_string | ( | const std::string & | message,
|  | bool | echo
| ) |  |

override virtual

overwritting method from parent class.

Implements libdar5::user_interaction.

## get_string()

virtual std::string libdar5::user_interaction_callback::get_string | ( | const std::string & | message,
|  | bool | echo
| ) |  |

override virtual

overwritting method from parent class.

Implements libdar5::user_interaction.

## inherited_warning()

virtual void libdar5::user_interaction_callback::inherited_warning | ( | const std::string & | message | ) |

override protected virtual

overwritting method from parent class.

Implements libdar5::user_interaction.

## listing()

virtual void libdar5::user_interaction_callback::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
| ) |  |

override virtual

overwritting method from parent class.

Reimplemented from libdar5::user_interaction.

## pause()

virtual void libdar5::user_interaction_callback::pause | ( | const std::string & | message | ) |

override virtual

overwritting method from parent class.

Reimplemented from libdar5::user_interaction.

## set_dar_manager_contents_callback()

void libdar5::user_interaction_callback::set_dar_manager_contents_callback | ( | void(*)(U_I number, const std::string &chemin, const std::string &archive_name, void *context) | callback | ) |

inline

Definition at line 144 of file user_interaction_callback5.hpp.

## set_dar_manager_show_files_callback()

void libdar5::user_interaction_callback::set_dar_manager_show_files_callback | ( | void(*)(const std::string &filename, bool available_data, bool available_ea, void *context) | callback | ) |

inline

You can set a dar_manager_show_files callback thanks to this method.

Definition at line 135 of file user_interaction_callback5.hpp.

References libdar5::user_interaction::set_use_dar_manager_show_files().

## set_dar_manager_show_version_callback()

void libdar5::user_interaction_callback::set_dar_manager_show_version_callback | ( | void(*)(U_I number, const std::string &data_date, const std::string &data_presence, const std::string &ea_date, const std::string &ea_presence, void *context) | callback | ) |

inline

Definition at line 164 of file user_interaction_callback5.hpp.

## set_dar_manager_statistics_callback()

void libdar5::user_interaction_callback::set_dar_manager_statistics_callback | ( | void(*)(U_I number, const infinint &data_count, const infinint &total_data, const infinint &ea_count, const infinint &total_ea, void *context) | callback | ) |

inline

Definition at line 153 of file user_interaction_callback5.hpp.

## set_listing_callback()

void libdar5::user_interaction_callback::set_listing_callback | ( | void(*)(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) | callback | ) |

inline

You can set a listing callback thanks to this method.

If set, when file listing will this callback function will be used instead of the x_warning_callback given as argument of the constructor.

Definition at line 119 of file user_interaction_callback5.hpp.

References libdar5::user_interaction::set_use_listing().

## Member Data Documentation

## answer_callback

bool(* libdar5::user_interaction_callback::answer_callback) (const std::string &x, void *context)

private

Definition at line 188 of file user_interaction_callback5.hpp.

## context_val

void* libdar5::user_interaction_callback::context_val

private

Definition at line 222 of file user_interaction_callback5.hpp.

## dar_manager_contents_callback

void(* libdar5::user_interaction_callback::dar_manager_contents_callback) (U_I number, const std::string &chemin, const std::string &archive_name, void *context)

private

Definition at line 205 of file user_interaction_callback5.hpp.

## dar_manager_show_files_callback

void(* libdar5::user_interaction_callback::dar_manager_show_files_callback) (const std::string &filename, bool available_data, bool available_ea, void *context)

private

Definition at line 201 of file user_interaction_callback5.hpp.

## dar_manager_show_version_callback

void(* libdar5::user_interaction_callback::dar_manager_show_version_callback) (U_I number, const std::string &data_date, const std::string &data_presence, const std::string &ea_date, const std::string &ea_presence, void *context)

private

Definition at line 215 of file user_interaction_callback5.hpp.

## dar_manager_statistics_callback

void(* libdar5::user_interaction_callback::dar_manager_statistics_callback) (U_I number, const infinint &data_count, const infinint &total_data, const infinint &ea_count, const infinint &total_ea, void *context)

private

Definition at line 209 of file user_interaction_callback5.hpp.

## secu_string_callback

secu_string(* libdar5::user_interaction_callback::secu_string_callback) (const std::string &x, bool echo, void *context)

private

Definition at line 190 of file user_interaction_callback5.hpp.

## string_callback

std::string(* libdar5::user_interaction_callback::string_callback) (const std::string &x, bool echo, void *context)

private

Definition at line 189 of file user_interaction_callback5.hpp.

## tar_listing_callback

void(* libdar5::user_interaction_callback::tar_listing_callback) (const std::string &flags, 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)

private

Definition at line 191 of file user_interaction_callback5.hpp.

## warning_callback

void(* libdar5::user_interaction_callback::warning_callback) (const std::string &x, void *context)

private

Definition at line 187 of file user_interaction_callback5.hpp.

The documentation for this class was generated from the following file:

- user_interaction_callback5.hpp