Loading...
Searching...
No Matches
mem_ui.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2026 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#ifndef MEM_UI_HPP
#define MEM_UI_HPP
#include "../my_config.h"
#include "user_interaction.hpp"
#include <memory>
namespace libdar
{
class mem_ui
{
public:
mem_ui(const std::shared_ptr<user_interaction> & dialog);
mem_ui(const mem_ui & ref) = default;
mem_ui(mem_ui && ref) noexcept = default;
mem_ui & operator = (const mem_ui & ref) = default;
mem_ui & operator = (mem_ui && ref) noexcept = default;
virtual ~mem_ui() noexcept(false) {};
protected:
user_interaction & get_ui() const { return *ui; };
std::shared_ptr<user_interaction> get_pointer() const { return ui; };
void change_ui(const std::shared_ptr<user_interaction> & new_dialog) { if(!new_dialog) throw SRC_BUG; ui = new_dialog; };
private:
std::shared_ptr<user_interaction> ui;
};
} // end of namespace
#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.