Disk ARchive  2.7.15
Full featured and portable backup and archiving tool
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
libdar::user_interaction_callback Class Reference

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

#include <user_interaction_callback.hpp>

+ Inheritance diagram for libdar::user_interaction_callback:
+ Collaboration diagram for libdar::user_interaction_callback:

Public Types

using message_callback = void(*)(const std::string &x, void *context)
 
using pause_callback = bool(*)(const std::string &x, void *context)
 
using get_string_callback = std::string(*)(const std::string &x, bool echo, void *context)
 
using get_secu_string_callback = secu_string(*)(const std::string &x, bool echo, void *context)
 

Public Member Functions

 user_interaction_callback (message_callback x_message_callback, pause_callback x_answer_callback, get_string_callback x_string_callback, get_secu_string_callback x_secu_string_callback, void *context_value)
 constructor which receive the callback functions. More...
 
 user_interaction_callback (const user_interaction_callback &ref)=default
 
 user_interaction_callback (user_interaction_callback &&ref) noexcept=default
 
user_interaction_callbackoperator= (const user_interaction_callback &ref)=default
 
user_interaction_callbackoperator= (user_interaction_callback &&ref) noexcept=default
 
- Public Member Functions inherited from libdar::user_interaction
 user_interaction (const user_interaction &ref)=default
 
 user_interaction (user_interaction &&ref) noexcept=default
 
user_interactionoperator= (const user_interaction &ref)=default
 
user_interactionoperator= (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)
 
virtual void printf (const char *format,...)
 libdar uses this call to format output before send to message() method. More...
 

Protected Member Functions

virtual void inherited_message (const std::string &message) override
 listing callback can be now passed directly to archive::get_children_of() More...
 
virtual bool inherited_pause (const std::string &message) override
 overwritting method from parent class.
 
virtual std::string inherited_get_string (const std::string &message, bool echo) override
 overwritting method from parent class.
 
virtual secu_string inherited_get_secu_string (const std::string &message, bool echo) override
 overwritting method from parent class.
 
void change_context_value (void *new_value)
 change the context value of the object that will be given to callback functions
 

Private Attributes

message_callback message_cb
 
pause_callback pause_cb
 
get_string_callback get_string_cb
 
get_secu_string_callback get_secu_string_cb
 
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 57 of file user_interaction_callback.hpp.

Constructor & Destructor Documentation

◆ user_interaction_callback()

libdar::user_interaction_callback::user_interaction_callback ( message_callback  x_message_callback,
pause_callback  x_answer_callback,
get_string_callback  x_string_callback,
get_secu_string_callback  x_secu_string_callback,
void *  context_value 
)

constructor which receive the callback functions.

Parameters
[in]x_message_callbackis used by message() method
[in]x_answer_callbackis used by the pause() method
[in]x_string_callbackis used by get_string() method
[in]x_secu_string_callbackis used by get_secu_string() method
[in]context_valuewill 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

◆ inherited_message()

virtual void libdar::user_interaction_callback::inherited_message ( const std::string &  message)
overrideprotectedvirtual

listing callback can be now passed directly to archive::get_children_of()

dar_manager_show_files callback can now be passed directly to database::get_files() dar_manager_contents callback is not necessary, use database::get_contents() method dar_manager_statistics callback can now be passed directly to database::show_most_recent_stats() dar_manager_get_show_version callback can now be passed directly to database::get_version() overwritting method from parent class.

Implements libdar::user_interaction.


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