Mapper  0.9.0
API documentation
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
OpenOrienteering::Autosave Class Referenceabstract

Class Autosave implements autosaving behaviour. More...

#include <autosave.h>

Inheritance diagram for OpenOrienteering::Autosave:
Inheritance graph
[legend]

Public Types

enum  AutosaveResult { Success, PermanentFailure, TemporaryFailure }
 Possible results of autosave attempts. More...
 

Public Member Functions

virtual QString autosavePath (const QString &path) const
 Returns the autosave file path for the given path. More...
 
virtual AutosaveResult autosave ()=0
 Performs an autosave, if possible. More...
 
void setAutosaveNeeded (bool)
 Informs Autosave whether autosaving is needed or not. More...
 
bool autosaveNeeded () const
 Returns true if autosave is known to be needed. More...
 

Protected Member Functions

 Autosave ()
 Initializes the autosave feature. More...
 
virtual ~Autosave ()
 Destructs the autosave feature. More...
 

Friends

class AutosavePrivate
 

Detailed Description

Class Autosave implements autosaving behaviour.

Autosaving means that data which has been modified is automatically saved after some period of time if no regular saving (typically triggered by the user) happens before.

Classes which wish to implement autosaving may inherit from this class. Inheriting classes must implement autosave(). Furthermore, they must call setAutosaveNeeded() when changes need to be taken care of by Autosave, or when normal saving has terminated the need to perform autosaving.

Autosaving, as implemented by autosave(), may succeed, fail temporarily (e.g. during editing), or fail permanently (e.g. for lack of disk space). On success or permanent failure, autosave() will be called again after the regular autosaving period. On temporary failure, autosave() will be called again after five seconds.

The autosave period (in minutes) is taken from the setting Settings::General_AutosaveInterval.

Member Enumeration Documentation

◆ AutosaveResult

Possible results of autosave attempts.

Enumerator
Success 

Autosaving succeeded.

PermanentFailure 

Autosaving failed for some persistent reason.

TemporaryFailure 

Autosaving failed for some transient reason and shall be retried soon.

Constructor & Destructor Documentation

◆ Autosave()

OpenOrienteering::Autosave::Autosave ( )
protected

Initializes the autosave feature.

◆ ~Autosave()

OpenOrienteering::Autosave::~Autosave ( )
protectedvirtualdefault

Destructs the autosave feature.

Member Function Documentation

◆ autosave()

virtual AutosaveResult OpenOrienteering::Autosave::autosave ( )
pure virtual

Performs an autosave, if possible.

Implemented in AutosaveTestDocument.

◆ autosaveNeeded()

bool OpenOrienteering::Autosave::autosaveNeeded ( ) const

Returns true if autosave is known to be needed.

◆ autosavePath()

QString OpenOrienteering::Autosave::autosavePath ( const QString path) const
virtual

Returns the autosave file path for the given path.

◆ setAutosaveNeeded()

void OpenOrienteering::Autosave::setAutosaveNeeded ( bool  needed)

Informs Autosave whether autosaving is needed or not.

Friends And Related Function Documentation

◆ AutosavePrivate

friend class AutosavePrivate
friend

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