Changeset f2efcf for molecuilder/src/Parser
- Timestamp:
- Mar 5, 2010, 12:53:13 PM (16 years ago)
- Children:
- 5aefaa
- Parents:
- 4938aa
- Location:
- molecuilder/src/Parser
- Files:
-
- 3 added
- 5 moved
-
ChangeTracker.cpp (moved) (moved from molecuilder/src/ChangeTracker.cpp ) (4 diffs)
-
ChangeTracker.hpp (moved) (moved from molecuilder/src/ChangeTracker.hpp )
-
FormatParser.cpp (added)
-
FormatParser.hpp (moved) (moved from molecuilder/src/FormatParser.hpp ) (1 diff)
-
TremoloParser.cpp (moved) (moved from molecuilder/src/TremoloParser.cpp )
-
TremoloParser.hpp (moved) (moved from molecuilder/src/TremoloParser.hpp )
-
XyzParser.cpp (added)
-
XyzParser.hpp (added)
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()) { -
molecuilder/src/Parser/FormatParser.hpp
r4938aa rf2efcf 13 13 #include "parser.hpp" 14 14 15 using namespace std; 16 15 /** 16 * General parser which observes the change tracker. 17 */ 17 18 class FormatParser : public Observer { 18 19 public: 19 20 FormatParser(); 20 ~FormatParser(); 21 virtual void save(char* fileName); 22 virtual void load(char* fileName); 21 virtual ~FormatParser(); 22 virtual void save(std::ostream* file)=0; 23 virtual void load(std::istream* file)=0; 24 void setOstream(std::ostream* file); 25 void update(Observable *publisher); 26 void subjectKilled(Observable *publisher); 23 27 24 28 private: 25 MatrixContainer* readData(char* fileName, int skiplines, int skipcolumns); 26 virtual int getHeaderSize(char identifier); 29 std::ostream* saveStream; 27 30 }; 28 31
Note:
See TracChangeset
for help on using the changeset viewer.
