26#ifndef USER_INTERACTION_HPP
27#define USER_INTERACTION_HPP
29#include "//include/dar/libdar_my_config.h"
34#if LIBDAR_HAS_PTHREAD_H
42#include "//include/dar/secu_string.hpp"
43#include "//include/dar/infinint.hpp"
44#include "//include/dar/thread_cancellation.hpp"
57 class user_interaction
60 user_interaction() {};
61 user_interaction(
const user_interaction & ref) =
default;
62 user_interaction(user_interaction && ref)
noexcept =
default;
63 user_interaction & operator = (
const user_interaction & ref) =
default;
64 user_interaction & operator = (user_interaction && ref)
noexcept =
default;
65 virtual ~user_interaction() =
default;
70 void message(
const std::string & message);
71 void pause(
const std::string & message);
72 std::string get_string(
const std::string & message,
bool echo);
73 secu_string get_secu_string(
const std::string & message,
bool echo);
84 virtual void printf(
const char *format, ...);
149#if LIBDAR_MUTEX_WORKS
150#if LIBDAR_HAS_PTHREAD_H
153 std::list<pthread_t> monitoring;
class to be used as parent to provide checkpoints to inherited classes
virtual bool inherited_pause(const std::string &message)=0
method used to ask a boolean question to the user.
virtual void inherited_message(const std::string &message)=0
virtual std::string inherited_get_string(const std::string &message, bool echo)=0
method used to ask a question that needs an arbitrary answer.
void add_thread_to_monitor(pthread_t tid)
add a thread to monitor
virtual void printf(const char *format,...)
libdar uses this call to format output before sending to the message() method.
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
void remove_thread_from_monitor(pthread_t tid)
remove a thread from monitoring
bool cancellation_requested() const
known whether cancellation was requested for the current thread or an added thread
libdar namespace encapsulate all libdar symbols