![]() |
Disk ARchive 2.8.0
Full featured and portable backup and archiving tool
|
This is a pure virtual class that is used by libdar when interaction with the user is required. More...
#include <user_interaction.hpp>
Public Member Functions | |
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) |
virtual void | printf (const char *format,...) |
libdar uses this call to format output before sending to the message() method. More... | |
bool | cancellation_requested () const |
known whether cancellation was requested for the current thread or an added thread | |
void | add_thread_to_monitor (pthread_t tid) |
add a thread to monitor More... | |
void | remove_thread_from_monitor (pthread_t tid) |
remove a thread from monitoring | |
Protected Member Functions | |
virtual void | inherited_message (const std::string &message)=0 |
virtual bool | inherited_pause (const std::string &message)=0 |
method used to ask a boolean question to the user. More... | |
virtual std::string | inherited_get_string (const std::string &message, bool echo)=0 |
method used to ask a question that needs an arbitrary answer. More... | |
virtual secu_string | inherited_get_secu_string (const std::string &message, bool echo)=0 |
same a get_string() but uses libdar::secu_string instead of std::string More... | |
This is a pure virtual class that is used by libdar when interaction with the user is required.
You can base your own class on it using C++ inheritance or use the predifined inherited classes user_interaction_callback which implements the interaction based on callback functions.
Definition at line 57 of file user_interaction.hpp.
|
inline |
Definition at line 60 of file user_interaction.hpp.
void libdar::user_interaction::add_thread_to_monitor | ( | pthread_t | tid | ) |
add a thread to monitor
when a thread cancellation is requested for a thread libdar do no more pause() but assume negative answer and invoke message() with the context and question. However the user_interaction object may run in a different thread than a libdar thread, it is thus necessary to inform the user interaction object of the additional thread_id to monitor for thread cancellation request and adapt the behavior of this object. This is the purpose of this call, in addition to the thread the user_interaction is running in, at the time of any pause() request the user_interaction will call message() if the current thread or any of the added thread_id are under a cancellation request
|
protectedpure virtual |
same a get_string() but uses libdar::secu_string instead of std::string
[in] | message | is the question to display to the user. |
[in] | echo | is set to false is the answer must not be shown while the user answers. |
Implemented in libdar::user_interaction_blind, and libdar::user_interaction_callback.
|
protectedpure virtual |
method used to ask a question that needs an arbitrary answer.
[in] | message | is the question to display to the user. |
[in] | echo | is set to false is the answer must not be shown while the user answers. |
Implemented in libdar::user_interaction_blind, and libdar::user_interaction_callback.
|
protectedpure virtual |
method used to display a warning or a message to the user.
[in] | message | is the message to display. |
Implemented in libdar::user_interaction_blind, and libdar::user_interaction_callback.
|
protectedpure virtual |
method used to ask a boolean question to the user.
[in] | message | The boolean question to ask to the user |
Implemented in libdar::user_interaction_blind, and libdar::user_interaction_callback.
|
virtual |
libdar uses this call to format output before sending to the message() method.
This is not a virtual method, it has not to be overwritten, it is just a sublayer over warning() Supported masks for the format string are: