COMMIT class: removed m_committed flag, added clear() and Empty() methods.
This commit is contained in:
parent
b815ea7865
commit
940765f4b3
|
@ -27,13 +27,10 @@
|
|||
|
||||
COMMIT::COMMIT()
|
||||
{
|
||||
m_committed = false;
|
||||
}
|
||||
|
||||
|
||||
COMMIT::~COMMIT()
|
||||
{
|
||||
if( !m_committed )
|
||||
{
|
||||
for( COMMIT_LINE& ent : m_changes )
|
||||
{
|
||||
|
@ -41,7 +38,6 @@ COMMIT::~COMMIT()
|
|||
delete ent.m_copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
COMMIT& COMMIT::Stage( EDA_ITEM* aItem, CHANGE_TYPE aChangeType )
|
||||
|
|
|
@ -89,6 +89,11 @@ public:
|
|||
///> Revertes the commit by restoring the modifed items state.
|
||||
virtual void Revert() = 0;
|
||||
|
||||
bool Empty() const
|
||||
{
|
||||
return m_changes.empty();
|
||||
}
|
||||
|
||||
protected:
|
||||
struct COMMIT_LINE
|
||||
{
|
||||
|
@ -97,14 +102,19 @@ protected:
|
|||
CHANGE_TYPE m_type;
|
||||
};
|
||||
|
||||
// Should be called in Push() & Revert() methods
|
||||
void clear()
|
||||
{
|
||||
m_changedItems.clear();
|
||||
m_changes.clear();
|
||||
}
|
||||
|
||||
virtual void makeEntry( EDA_ITEM* aItem, CHANGE_TYPE aType, EDA_ITEM* aCopy = NULL );
|
||||
|
||||
virtual EDA_ITEM* parentObject( EDA_ITEM* aItem ) const = 0;
|
||||
|
||||
CHANGE_TYPE convert( UNDO_REDO_T aType ) const;
|
||||
|
||||
bool m_committed;
|
||||
|
||||
std::set<EDA_ITEM*> m_changedItems;
|
||||
std::vector<COMMIT_LINE> m_changes;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue