Loading...
Searching...
No Matches
libdar::user_interaction_callback Class Reference
API

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

`#include <user_interaction_callback.hpp>`

Inherits libdar::user_interaction.

## 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.
| 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
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)
virtual void | printf (const char *format,...)
| libdar uses this call to format output before sending to the message() method.
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
void | remove_thread_from_monitor (pthread_t tid)
| remove a thread from monitoring

## Protected Member Functions

virtual void | inherited_message (const std::string &message) override
| listing callback can be now passed directly to archive::get_children_of()
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.

## Member Typedef Documentation

## get_secu_string_callback

using libdar::user_interaction_callback::get_secu_string_callback = secu_string (*)(const std::string &x, bool echo, void *context)

Definition at line 64 of file user_interaction_callback.hpp.

## get_string_callback

using libdar::user_interaction_callback::get_string_callback = std::string (*)(const std::string &x, bool echo, void *context)

Definition at line 63 of file user_interaction_callback.hpp.

## message_callback

using libdar::user_interaction_callback::message_callback = void (*)(const std::string &x, void *context)

Definition at line 61 of file user_interaction_callback.hpp.

## pause_callback

using libdar::user_interaction_callback::pause_callback = bool (*)(const std::string &x, void *context)

Definition at line 62 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_callback | is used by message() 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

References user_interaction_callback().

Referenced by user_interaction_callback().

## Member Function Documentation

## change_context_value()

void libdar::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 114 of file user_interaction_callback.hpp.

## inherited_get_secu_string()

virtual secu_string libdar::user_interaction_callback::inherited_get_secu_string | ( | const std::string & | message,
|  | bool | echo )

override protected virtual

overwritting method from parent class.

Implements libdar::user_interaction.

## inherited_get_string()

virtual std::string libdar::user_interaction_callback::inherited_get_string | ( | const std::string & | message,
|  | bool | echo )

override protected virtual

overwritting method from parent class.

Implements libdar::user_interaction.

## inherited_message()

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

override protected virtual

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.

## inherited_pause()

virtual bool libdar::user_interaction_callback::inherited_pause | ( | const std::string & | message | ) |

override protected virtual

overwritting method from parent class.

Implements libdar::user_interaction.

## Member Data Documentation

## context_val

void* libdar::user_interaction_callback::context_val

private

Definition at line 121 of file user_interaction_callback.hpp.

## get_secu_string_cb

get_secu_string_callback libdar::user_interaction_callback::get_secu_string_cb

private

Definition at line 120 of file user_interaction_callback.hpp.

## get_string_cb

get_string_callback libdar::user_interaction_callback::get_string_cb

private

Definition at line 119 of file user_interaction_callback.hpp.

## message_cb

message_callback libdar::user_interaction_callback::message_cb

private

Definition at line 117 of file user_interaction_callback.hpp.

## pause_cb

pause_callback libdar::user_interaction_callback::pause_cb

private

Definition at line 118 of file user_interaction_callback.hpp.

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

- user_interaction_callback.hpp