Changeset f2efcf for molecuilder/src/Parser/ChangeTracker.cpp
- Timestamp:
- Mar 5, 2010, 12:53:13 PM (15 years ago)
- Children:
- 5aefaa
- Parents:
- 4938aa
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/Parser/ChangeTracker.cpp
r4938aa rf2efcf 10 10 ChangeTracker* ChangeTracker::instance = NULL; 11 11 12 /** 13 * Constructor. Signs on as an observer for the World. 14 */ 12 15 ChangeTracker::ChangeTracker() { 13 16 isConsistent = true; … … 15 18 } 16 19 20 /** 21 * Destructor. Signs off from the World. 22 */ 17 23 ChangeTracker::~ChangeTracker() { 18 24 World::get()->signOff(this); 19 25 } 20 26 27 /** 28 * Returns the change tracker instance. 29 * 30 * \return this 31 */ 21 32 ChangeTracker* ChangeTracker::get() { 22 33 if (instance == NULL) { … … 27 38 } 28 39 40 /** 41 * Destroys the change tracker instance. Be careful, the change tracker is a 42 * singleton and destruction might lead to a loss of consistency. 43 */ 29 44 void ChangeTracker::destroy() { 30 45 delete instance; … … 32 47 } 33 48 49 /** 50 * With this, the World can update the change tracker's state. 51 */ 34 52 void ChangeTracker::update(Observable *publisher) { 35 53 isConsistent = false; 36 54 } 37 55 56 /** 57 * Gets whether there are non-saved changes. 58 * 59 * \param true if there are any changes, false otherwise 60 */ 38 61 bool ChangeTracker::hasChanged() { 39 62 return !isConsistent; 40 63 } 41 64 65 /** 66 * Tells all observers (which are the different parsers) that they are supposed 67 * to save the current state. 68 */ 42 69 void ChangeTracker::saveStatus() { 43 70 if (hasChanged()) {
Note:
See TracChangeset
for help on using the changeset viewer.