InsertDelta.h

Go to the documentation of this file.
00001 
00005 /* Copyright © 2009 James Legg.
00006     This program is free software: you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation, either version 3 of the License, or
00009     (at your option) any later version.
00010 */
00011 
00012 #ifndef LIBTRACK_DOCUMENT_INSERT_DELTA_H
00013 #define LIBTRACK_DOCUMENT_INSERT_DELTA_H
00014 
00015 #include "DocumentDelta.h"
00016 
00017 namespace Document
00018 {
00019 
00025 template <class InsertRemoveIdentifer, class Object>
00026 class InsertDelta
00027     :   public DocumentDelta
00028 {
00029 public:
00032     InsertDelta(const Object & object)
00033         :   object(object)
00034         ,   identifier(object)
00035     {
00036     }
00037     
00038     virtual ~InsertDelta()
00039     {
00040     }
00041     
00043     virtual void apply(Track::Track & track)
00044     {
00045         identifier.insert(track, object);
00046     }
00047     
00049     virtual void unapply(Track::Track & track)
00050     {
00051         identifier.remove(track);
00052     }
00053 protected:
00054     Object object;
00055     InsertRemoveIdentifer identifier;
00056 };
00057 
00058 } // namespace Document
00059 
00060 #endif // LIBTRACK_DOCUMENT_INSERT_DELTA_H

Get Racer at SourceForge.net. Fast, secure and Free Open Source software downloads

Generated at Mon Sep 6 00:41:11 2010 by Doxygen version 1.4.7 for Racer version svn335.