libqicore-api  2.8.7.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Public Member Functions | Protected Types | Protected Member Functions | List of all members
qi::FileOperation Class Reference

#include <fileoperation.hxx>

Classes

struct  Task
 

Public Member Functions

virtual ~FileOperation ()
 
 FileOperation (const FileOperation &)=delete
 
FileOperationoperator= (const FileOperation &)=delete
 
 FileOperation (FileOperation &&other)
 
FileOperationoperator= (FileOperation &&other)
 
qi::Future< void > start ()
 
qi::Future< void > detach ()
 
auto operator() () -> decltype(start())
 Call operator: calls start() More...
 
ProgressNotifierPtr notifier () const
 
bool isValid () const
 
 operator bool () const
 

Protected Types

using TaskPtr = boost::shared_ptr< Task >
 

Protected Member Functions

 FileOperation (TaskPtr task)
 

Detailed Description

Base type for file operation exposing information about its progress state. Exposes a ProgressNotifier, associated to the operation.

Definition at line 18 of file fileoperation.hxx.

Member Typedef Documentation

using qi::FileOperation::TaskPtr = boost::shared_ptr<Task>
protected

Definition at line 189 of file fileoperation.hxx.

Constructor & Destructor Documentation

virtual qi::FileOperation::~FileOperation ( )
inlinevirtual

Destructor. Cancel the operations's task if is still running and this object is valid.

Definition at line 24 of file fileoperation.hxx.

qi::FileOperation::FileOperation ( const FileOperation )
delete
qi::FileOperation::FileOperation ( FileOperation &&  other)
inline

Move construction.

Parameters
otherObject that will be moved-from. Will be in invalid state after this call, until being assigned to a vallid state.

Definition at line 41 of file fileoperation.hxx.

qi::FileOperation::FileOperation ( TaskPtr  task)
inlineexplicitprotected

Definition at line 191 of file fileoperation.hxx.

Member Function Documentation

qi::Future<void> qi::FileOperation::detach ( )
inline

Detach the running operation from this object. Useful to dissociate the on-going operation from the lifetime of the object, in order to allow its continuation after object destruction. The object destructor will cancel any still running operation if not dissociated beforehand.

Once called, this object will be in invalid state. The task must have been started before calling this function, otherwise a std::runtime_exception will be thrown.

Returns
A future corresponding to the end of the operation.

Definition at line 88 of file fileoperation.hxx.

bool qi::FileOperation::isValid ( ) const
inline
Returns
True if this object is in a valid state, false otherwise. In an invalid state, all of this object's member function calls will result in exception thrown except validity checks functions and move-assignation. An invalid object can be re-assigned to a valid state.

Definition at line 120 of file fileoperation.hxx.

ProgressNotifierPtr qi::FileOperation::notifier ( ) const
inline
Returns
A progress notifier associated to the operation if the operation's task is owned and this object is valid, null otherwise.

Definition at line 113 of file fileoperation.hxx.

qi::FileOperation::operator bool ( ) const
inlineexplicit
Returns
True if this object owns the operation's task, false otherwise.

Definition at line 123 of file fileoperation.hxx.

auto qi::FileOperation::operator() ( ) -> decltype(start())
inline

Call operator: calls start()

Definition at line 108 of file fileoperation.hxx.

FileOperation& qi::FileOperation::operator= ( const FileOperation )
delete
FileOperation& qi::FileOperation::operator= ( FileOperation &&  other)
inline

Move assignation.

Parameters
otherObject that will be moved-from. Will be in invalid state after this call, until being assigned to a vallid state.

Definition at line 49 of file fileoperation.hxx.

qi::Future<void> qi::FileOperation::start ( )
inline

Starts the operation's task. This function must be called only once. Throws a std::runtime_error if start() has already been called before at least once or if this object is in an invalid state.

Returns
A future corresponding to the end of the operation.

Definition at line 62 of file fileoperation.hxx.


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