Disk ARchive: mem_ui.hpp Source File

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

Loading...
Searching...
No Matches
mem_ui.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2025 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 MEM_UI_HPP
27#define MEM_UI_HPP
28
29#include "../my_config.h"
30
31#include "user_interaction.hpp"
32#include <memory>
33
34namespace libdar
35{
36
39
41
53
54 class mem_ui
55 {
56 public:
57
59
63 mem_ui(const std::shared_ptr<user_interaction> & dialog);
64
66
68 mem_ui(const mem_ui & ref) = default;
69
71 mem_ui(mem_ui && ref) noexcept = default;
72
74
77 mem_ui & operator = (const mem_ui & ref) = default;
78
80 mem_ui & operator = (mem_ui && ref) noexcept = default;
81
82
84
87 virtual ~mem_ui() noexcept(false) {};
88
89
90 protected:
92
94 user_interaction & get_ui() const { return *ui; };
95
97 std::shared_ptr<user_interaction> get_pointer() const { return ui; };
98
100 void change_ui(const std::shared_ptr<user_interaction> & new_dialog) { if(!new_dialog) throw SRC_BUG; ui = new_dialog; };
101
102 private:
103 std::shared_ptr<user_interaction> ui;
104 };
105
107
108} // end of namespace
109
110
111#endif
libdar::mem_ui::change_ui
void change_ui(const std::shared_ptr< user_interaction > &new_dialog)
change the user_interaction object
Definition mem_ui.hpp:100
libdar::mem_ui::operator=
mem_ui & operator=(const mem_ui &ref)=default
assignement operator
libdar::mem_ui::get_pointer
std::shared_ptr< user_interaction > get_pointer() const
get access to the shared_ptr pointing to the user_interaction
Definition mem_ui.hpp:97
libdar::mem_ui::mem_ui
mem_ui(const std::shared_ptr< user_interaction > &dialog)
constructor
libdar::mem_ui::~mem_ui
virtual ~mem_ui() noexcept(false)
destructor
Definition mem_ui.hpp:87
libdar::mem_ui::mem_ui
mem_ui(const mem_ui &ref)=default
the copy constructor
libdar::mem_ui::get_ui
user_interaction & get_ui() const
get access to the user_interaction object
Definition mem_ui.hpp:94
libdar::mem_ui::mem_ui
mem_ui(mem_ui &&ref) noexcept=default
the move constructor
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:58
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47
user_interaction.hpp
defines the interaction interface between libdar and users.