libdar::user_interaction Class Referenceabstract
API

This is a pure virtual class that is used by libdar when interaction with the user is required. More...

`#include <user_interaction.hpp>`

Inherited by libdar5::user_interaction, libdar::shell_interaction, libdar::user_interaction_blind, and libdar::user_interaction_callback.

## 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 send to message() method. More...

## 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...

## Detailed Description

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 46 of file user_interaction.hpp.

## Member Function Documentation

## inherited_get_secu_string()

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

protectedpure virtual

same a get_string() but uses libdar::secu_string instead of std::string

Parameters

  [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.

Returns
  the user's answer.

Note
  messages passed by libdar are not ending with a newline by default its up to the implementation to separate messages by the adequate mean

Implemented in libdar5::user_interaction, libdar::user_interaction_blind, and libdar::user_interaction_callback.

## inherited_get_string()

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

protectedpure virtual

method used to ask a question that needs an arbitrary answer.

Parameters

  [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.

Returns
  the user's answer.

Note
  messages passed by libdar are not ending with a newline by default its up to the implementation to separate messages by the adequate mean

Implemented in libdar5::user_interaction, libdar::user_interaction_blind, and libdar::user_interaction_callback.

## inherited_message()

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

protectedpure virtual

method used to display a warning or a message to the user.

Parameters

  [in] | message | is the message to display.

Note
  messages passed by libdar are not ending with a newline by default its up to the implementation to separate messages by the adequate mean

Implemented in libdar5::user_interaction, libdar::user_interaction_blind, and libdar::user_interaction_callback.

## inherited_pause()

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

protectedpure virtual

method used to ask a boolean question to the user.

Parameters

  [in] | message | The boolean question to ask to the user

Returns
  the answer of the user (true/yes or no/false)

Note
  messages passed by libdar are not ending with a newline by default its up to the implementation to separate messages by the adequate mean

Implemented in libdar5::user_interaction, libdar::user_interaction_blind, and libdar::user_interaction_callback.

## printf()

virtual void libdar::user_interaction::printf | ( | const char * | format,
|  |  | ...
| ) |  |

virtual

libdar uses this call to format output before send to 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:

- %s %c %d %% (normal behavior)
- %i (matches infinint *)
- %S (matches std::string *)

Reimplemented in libdar5::user_interaction.

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

- user_interaction.hpp