| Disk ARchive 2.7.14 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
user_interaction.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2024 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
25
26#ifndef USER_INTERACTION_HPP
27#define USER_INTERACTION_HPP
28
29#include "../my_config.h"
30
31#include <string>
32#include "secu_string.hpp"
33#include "infinint.hpp"
34
35 namespace libdar
36{
37
40
42
46 class user_interaction
47 {
48 public:
49 user_interaction() {};
50 user_interaction(const user_interaction & ref) = default;
51 user_interaction(user_interaction && ref) noexcept = default;
52 user_interaction & operator = (const user_interaction & ref) = default;
53 user_interaction & operator = (user_interaction && ref) noexcept = default;
54 virtual ~user_interaction() = default;
55
56 // the following methode are used by libdar and rely in their inherited_* versions
57 // than must be defined in the inherited classes
58
59 void message(const std::string & message);
60 void pause(const std::string & message);
61 std::string get_string(const std::string & message, bool echo);
62 secu_string get_secu_string(const std::string & message, bool echo);
63
65
73 virtual void printf(const char *format, ...);
74
75
76 protected:
82 virtual void inherited_message(const std::string & message) = 0;
83
85
90 virtual bool inherited_pause(const std::string & message) = 0;
91
92
94
100 virtual std::string inherited_get_string(const std::string & message, bool echo) = 0;
101
103
109 virtual secu_string inherited_get_secu_string(const std::string & message, bool echo) = 0;
110
111
112 };
113
115
116} // end of namespace
117
118#endif
libdar::secu_string
class secu_string
Definition secu_string.hpp:54
libdar::user_interaction
This is a pure virtual class that is used by libdar when interaction with the user is required.
Definition user_interaction.hpp:47
libdar::user_interaction::inherited_pause
virtual bool inherited_pause(const std::string &message)=0
method used to ask a boolean question to the user.
libdar::user_interaction::inherited_message
virtual void inherited_message(const std::string &message)=0
libdar::user_interaction::inherited_get_string
virtual std::string inherited_get_string(const std::string &message, bool echo)=0
method used to ask a question that needs an arbitrary answer.
libdar::user_interaction::printf
virtual void printf(const char *format,...)
libdar uses this call to format output before send to message() method.
libdar::user_interaction::inherited_get_secu_string
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
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47
secu_string.hpp
this file contains the definition of secu_string class, a std::string like class but allocated in sec...