42 #include "BaseBackup.hh" 43 #include <OpenFlipper/common/BackupData.hh> 47 static int maxBackupId_ = 0;
51 BaseBackup::BaseBackup(QString _name) : object_(0), name_(_name), id_(maxBackupId_++)
57 BaseBackup::BaseBackup(
BaseObjectData* _object, QString _name,
UpdateType _type) : object_(_object), name_(_name), id_(maxBackupId_++)
65 QMap<QString, PerObjectData*>::const_iterator mapIter;
67 for ( mapIter = dataMap.constBegin(); mapIter != dataMap.constEnd(); ++mapIter){
69 if ( mapIter.key() == OBJECT_BACKUPS )
continue;
75 objectDatas_.push_back( std::make_pair( mapIter.key(),copiedData ) );
77 std::cerr <<
"Failed to copy per Object Data: " << mapIter.key().toStdString() << std::endl;
83 BaseBackup::~BaseBackup(){
105 QMapIterator<QString, PerObjectData* > i(dataMap);
106 while (i.hasNext()) {
108 if ( i.key() == OBJECT_BACKUPS )
109 backupData = i.value();
116 if (backupData == 0){
117 std::cerr <<
"Cannot apply backup. BackupData not found!!" << std::endl;
122 dataMap.insert( OBJECT_BACKUPS, backupData);
149 return !links_.empty();
157 for(
int i=_objectIDs.size()-1; i >= 0; --i )
159 _objectIDs.erase( _objectIDs.begin() + i );
int id()
get id of this backup
QString name()
Get the backups name)
bool blocked()
Returns if this backup is blocked.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
virtual void apply()
Revert this backup.
virtual PerObjectData * copyPerObjectData()
Copy Function.
QMap< QString, PerObjectData * > & getPerObjectDataMap()
get reference to map of all perObject Datas
std::vector< std::pair< QString, PerObjectData * > > objectDatas_
Backup of the perObjectData objects.
void setLinks(IdList _objectIDs)
Set links to corresponding backups.