diff options
author | Hans Fugal <hans@fugal.net> | 2006-08-09 14:14:17 +0000 |
---|---|---|
committer | Hans Fugal <hans@fugal.net> | 2006-08-09 14:14:17 +0000 |
commit | a32175bd41eb46f8c544af9f7091c2156035135a (patch) | |
tree | d70418a072771f46047579385e75a4318373aa0c /libs/pbd | |
parent | f07cb624c02c98a5ae375b26cb99c157df64d159 (diff) |
r274@gandalf: fugalh | 2006-08-07 19:53:48 -0600
Nuke Serializable in favor of Stateful. Got rid of some warnings with stub
code.
git-svn-id: svn://localhost/ardour2/branches/undo@767 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd')
-rw-r--r-- | libs/pbd/command.cc | 4 | ||||
-rw-r--r-- | libs/pbd/pbd/command.h | 7 | ||||
-rw-r--r-- | libs/pbd/pbd/memento_command.h | 24 | ||||
-rw-r--r-- | libs/pbd/pbd/serializable.h | 33 | ||||
-rw-r--r-- | libs/pbd/pbd/undo.h | 2 | ||||
-rw-r--r-- | libs/pbd/undo.cc | 3 |
6 files changed, 24 insertions, 49 deletions
diff --git a/libs/pbd/command.cc b/libs/pbd/command.cc index 3f5aca8e51..c0fcf36187 100644 --- a/libs/pbd/command.cc +++ b/libs/pbd/command.cc @@ -1,8 +1,8 @@ #include <pbd/command.h> +#include <pbd/xml++.h> -class XMLNode; -XMLNode &Command::serialize() +XMLNode &Command::get_state() { XMLNode *node = new XMLNode ("Command"); // TODO diff --git a/libs/pbd/pbd/command.h b/libs/pbd/pbd/command.h index 35ae011530..cd9bf0e08a 100644 --- a/libs/pbd/pbd/command.h +++ b/libs/pbd/pbd/command.h @@ -21,16 +21,17 @@ #ifndef __lib_pbd_command_h__ #define __lib_pbd_command_h__ -#include <pbd/serializable.h> +#include <pbd/stateful.h> -class Command : public Serializable +class Command : public Stateful { public: virtual ~Command() {} virtual void operator() () = 0; virtual void undo() = 0; virtual void redo() { (*this)(); } - virtual XMLNode &serialize(); + virtual XMLNode &get_state(); + virtual int set_state(const XMLNode&) { /* noop */ return 0; } }; #endif // __lib_pbd_command_h_ diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h index c8bfe5de4c..a86006a6ae 100644 --- a/libs/pbd/pbd/memento_command.h +++ b/libs/pbd/pbd/memento_command.h @@ -39,12 +39,14 @@ class MementoCommand : public Command : obj(obj), before(before), after(after) {} void operator() () { obj.set_state(after); } void undo() { obj.set_state(before); } - virtual XMLNode &serialize() {} - //{ + virtual XMLNode &get_state() + { + XMLNode *node = new XMLNode("MementoCommand"); // obj.id // key is "MementoCommand" or something // before and after mementos - //} + return *node; + } // TODO does this need a copy constructor? protected: obj_T &obj; @@ -60,12 +62,14 @@ public: : obj(obj), before(before) {} void operator() () { /* noop */ } void undo() { obj.set_state(before); } - virtual XMLNode &serialize() {} - //{ + virtual XMLNode &get_state() + { + XMLNode *node = new XMLNode("MementoUndoCommand"); // XXX // obj.id // key is "MementoCommand" or something // before and after mementos - //} + return *node; + } protected: obj_T &obj; XMLNode &before; @@ -80,12 +84,14 @@ public: : obj(obj), after(after) {} void operator() () { obj.set_state(after); } void undo() { /* noop */ } - virtual XMLNode &serialize() {} - //{ + virtual XMLNode &get_state() + { + XMLNode *node = new XMLNode("MementoUndoCommand"); // obj.id // key is "MementoCommand" or something // before and after mementos - //} + return *node; + } protected: obj_T &obj; XMLNode &after; diff --git a/libs/pbd/pbd/serializable.h b/libs/pbd/pbd/serializable.h deleted file mode 100644 index f6ac4e92fb..0000000000 --- a/libs/pbd/pbd/serializable.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (C) 2006 Paul Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id: /local/undo/libs/pbd3/pbd/undo.h 59 2006-06-15T18:16:20.960977Z fugalh $ -*/ - -#ifndef __lib_pbd_serializable_h__ -#define __lib_pbd_serializable_h__ - -#include <pbd/xml++.h> - -class Serializable -{ -public: - virtual XMLNode &serialize() = 0; - virtual ~Serializable() {} -}; - -#endif // __lib_pbd_serializable_h__ diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h index 33577ed4d7..49ff19ccce 100644 --- a/libs/pbd/pbd/undo.h +++ b/libs/pbd/pbd/undo.h @@ -49,7 +49,7 @@ class UndoTransaction : public Command void undo(); void redo(); - XMLNode &serialize(); + XMLNode &get_state(); void set_name (const string& str) { _name = str; diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc index aa27f95789..a5ca6b713a 100644 --- a/libs/pbd/undo.cc +++ b/libs/pbd/undo.cc @@ -21,6 +21,7 @@ #include <iostream> #include <pbd/undo.h> +#include <pbd/xml++.h> using namespace std; using namespace sigc; @@ -82,7 +83,7 @@ UndoTransaction::redo () (*this)(); } -XMLNode &UndoTransaction::serialize() +XMLNode &UndoTransaction::get_state() { XMLNode *node = new XMLNode ("UndoTransaction"); // TODO |