50 #include "BaseBackup.hh"
51 #include <OpenFlipper/common/BackupData.hh>
55 static int maxBackupId_ = 0;
59 BaseBackup::BaseBackup(QString _name) : object_(0), name_(_name), id_(maxBackupId_++)
65 BaseBackup::BaseBackup(
BaseObjectData* _object, QString _name,
UpdateType _type) : object_(_object), name_(_name), id_(maxBackupId_++)
73 QMap<QString, PerObjectData*>::const_iterator mapIter;
75 for ( mapIter = dataMap.constBegin(); mapIter != dataMap.constEnd(); ++mapIter){
77 if ( mapIter.key() == OBJECT_BACKUPS )
continue;
83 objectDatas_.push_back( std::make_pair( mapIter.key(),copiedData ) );
85 std::cerr <<
"Failed to copy per Object Data: " << mapIter.key().toStdString() << std::endl;
91 BaseBackup::~BaseBackup(){
113 QMapIterator<QString, PerObjectData* > i(dataMap);
114 while (i.hasNext()) {
116 if ( i.key() == OBJECT_BACKUPS )
117 backupData = i.value();
124 if (backupData == 0){
125 std::cerr <<
"Cannot apply backup. BackupData not found!!" << std::endl;
130 dataMap.insert( OBJECT_BACKUPS, backupData);
157 return !links_.empty();
165 for(
int i=_objectIDs.size()-1; i >= 0; --i )
167 _objectIDs.erase( _objectIDs.begin() + i );
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.
virtual PerObjectData * copyPerObjectData()
Copy Function.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
QString name()
Get the backups name)
int id()
get id of this backup
bool blocked()
Returns if this backup is blocked.
virtual void apply()
Revert this backup.