BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
DatafieldSaveInfo Class Reference

Description

Holds information about last save for items with non-XML data.

Definition at line 26 of file IOHistory.h.

Collaboration diagram for DatafieldSaveInfo:
[legend]

Public Member Functions

 DatafieldSaveInfo ()
 
QString fileName () const
 
const SaveLoadInterfaceitem () const
 
bool wasModifiedSinceLastSave () const
 

Static Public Member Functions

static DatafieldSaveInfo createSaved (const SaveLoadInterface *item)
 Static method to create info for just saved item. More...
 

Private Member Functions

bool wasSavedBefore (const QDateTime &dtime) const
 Returns true if IntensityDataItem was saved before given time. More...
 

Private Attributes

const SaveLoadInterfacem_data
 
QString m_file_name
 
QDateTime m_last_saved
 

Constructor & Destructor Documentation

◆ DatafieldSaveInfo()

DatafieldSaveInfo::DatafieldSaveInfo ( )
inline

Definition at line 28 of file IOHistory.h.

29  : m_data(nullptr)
30  {
31  }
const SaveLoadInterface * m_data
Definition: IOHistory.h:46

Member Function Documentation

◆ createSaved()

DatafieldSaveInfo DatafieldSaveInfo::createSaved ( const SaveLoadInterface item)
static

Static method to create info for just saved item.

Definition at line 22 of file IOHistory.cpp.

23 {
24  ASSERT(item);
25 
26  DatafieldSaveInfo result;
27  result.m_data = item;
28  result.m_file_name = item->fileName();
29  result.m_last_saved = QDateTime::currentDateTime();
30  return result;
31 }
Holds information about last save for items with non-XML data.
Definition: IOHistory.h:26
const SaveLoadInterface * item() const
Definition: IOHistory.h:35
QDateTime m_last_saved
Definition: IOHistory.h:44
QString m_file_name
Definition: IOHistory.h:45
virtual QString fileName() const =0
Reports file name to save/load non-XML data.

References SaveLoadInterface::fileName(), item(), m_data, m_file_name, and m_last_saved.

Referenced by DatafieldDirHistory::markAsSaved().

Here is the call graph for this function:

◆ fileName()

QString DatafieldSaveInfo::fileName ( ) const
inline

Definition at line 37 of file IOHistory.h.

37 { return m_file_name; }

References m_file_name.

◆ item()

const SaveLoadInterface* DatafieldSaveInfo::item ( ) const
inline

Definition at line 35 of file IOHistory.h.

35 { return m_data; }

References m_data.

Referenced by createSaved().

◆ wasModifiedSinceLastSave()

bool DatafieldSaveInfo::wasModifiedSinceLastSave ( ) const

Definition at line 33 of file IOHistory.cpp.

34 {
36 }
bool wasSavedBefore(const QDateTime &dtime) const
Returns true if IntensityDataItem was saved before given time.
Definition: IOHistory.cpp:40
virtual QDateTime lastModified() const =0
Indicates last modification timepoint.

References SaveLoadInterface::lastModified(), m_data, and wasSavedBefore().

Referenced by DatafieldDirHistory::wasModifiedSinceLastSave().

Here is the call graph for this function:

◆ wasSavedBefore()

bool DatafieldSaveInfo::wasSavedBefore ( const QDateTime &  dtime) const
private

Returns true if IntensityDataItem was saved before given time.

Definition at line 40 of file IOHistory.cpp.

41 {
42  // positive number means that m_last_saved is older than dtime
43  return m_last_saved.msecsTo(dtime) > 0;
44 }

References m_last_saved.

Referenced by wasModifiedSinceLastSave().

Member Data Documentation

◆ m_data

const SaveLoadInterface* DatafieldSaveInfo::m_data
private

Definition at line 46 of file IOHistory.h.

Referenced by createSaved(), item(), and wasModifiedSinceLastSave().

◆ m_file_name

QString DatafieldSaveInfo::m_file_name
private

Definition at line 45 of file IOHistory.h.

Referenced by createSaved(), and fileName().

◆ m_last_saved

QDateTime DatafieldSaveInfo::m_last_saved
private

Definition at line 44 of file IOHistory.h.

Referenced by createSaved(), and wasSavedBefore().


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