Disk ARchive 2.7.16
Full featured and portable backup and archiving tool
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
libdar::mem_ui Class Reference

class mem_ui to keep a copy of a user_interaction object More...

#include <mem_ui.hpp>

+ Inheritance diagram for libdar::mem_ui:
+ Collaboration diagram for libdar::mem_ui:

Public Member Functions

 mem_ui (const std::shared_ptr< user_interaction > &dialog)
 constructor More...
 
 mem_ui (const mem_ui &ref)=default
 the copy constructor More...
 
 mem_ui (mem_ui &&ref) noexcept=default
 the move constructor
 
mem_uioperator= (const mem_ui &ref)=default
 assignement operator More...
 
mem_uioperator= (mem_ui &&ref) noexcept=default
 move operator
 
virtual ~mem_ui () noexcept(false)
 destructor More...
 

Protected Member Functions

user_interactionget_ui () const
 get access to the user_interaction object More...
 
std::shared_ptr< user_interactionget_pointer () const
 get access to the shared_ptr pointing to the user_interaction More...
 

Private Attributes

std::shared_ptr< user_interactionui
 

Detailed Description

class mem_ui to keep a copy of a user_interaction object

this class is targeted for inheritance (it is advised to use a "protected" inheritance, not a "public" one). Instead of having all the stuf of managing, cloning, releasing a pointer on user_interaction a class simply put itslef as inherited from mem_ui to take the benefit of this implementation, once and for all. Use this class with caution espetially for class which will generate a ton of objects, as this will duplicate the user_interaction object in the same number. sometimes it is more efficient to have the user_interaction object as parameter of the constructor, using it if necessary while constructing the object only. In that situation, if the user_interaction is not need any further after construction, no need to make the class inherit from mem_ui.

Definition at line 54 of file mem_ui.hpp.

Constructor & Destructor Documentation

◆ mem_ui() [1/2]

libdar::mem_ui::mem_ui ( const std::shared_ptr< user_interaction > &  dialog)

constructor

Parameters
[in]dialogthe user_interaction object to clone and store If you plan to use mem_ui, you should pass the user_interaction to its constructor for you later be able to call get_ui() at any time from the inherited class

◆ mem_ui() [2/2]

libdar::mem_ui::mem_ui ( const mem_ui ref)
default

the copy constructor

need to be called from the copy constructor of any inherited class that explicitely define one

◆ ~mem_ui()

virtual libdar::mem_ui::~mem_ui ( )
inlinevirtualnoexcept

destructor

it is declared as virtual, for precaution, as it may not be very frequent to release an object having just a mem_ui pointer on it.

Definition at line 87 of file mem_ui.hpp.

Member Function Documentation

◆ get_pointer()

std::shared_ptr< user_interaction > libdar::mem_ui::get_pointer ( ) const
inlineprotected

get access to the shared_ptr pointing to the user_interaction

Definition at line 97 of file mem_ui.hpp.

◆ get_ui()

user_interaction & libdar::mem_ui::get_ui ( ) const
inlineprotected

get access to the user_interaction object

Returns
a reference to the clone object.

Definition at line 94 of file mem_ui.hpp.

Referenced by libdar::crypto_asym::get_ui().

◆ operator=()

mem_ui & libdar::mem_ui::operator= ( const mem_ui ref)
default

assignement operator

you need to call it from the inherited class assignement operator if the inherited class explicitely defines its own one.

Member Data Documentation

◆ ui

std::shared_ptr<user_interaction> libdar::mem_ui::ui
private

Definition at line 100 of file mem_ui.hpp.


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