Remove unused method PBD::sys::path::branch_path
[ardour.git] / libs / pbd / pbd / command.h
1
2 /* 
3     Copyright (C) 2006 Paul Davis
4     Author: Hans Fugal
5
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20 */
21
22 #ifndef __lib_pbd_command_h__
23 #define __lib_pbd_command_h__
24
25 #include <string>
26
27 #include "pbd/signals.h"
28 #include "pbd/statefuldestructible.h"
29
30 class Command : public PBD::StatefulDestructible, public PBD::ScopedConnectionList
31 {
32 public:
33         virtual ~Command() { /* NOTE: derived classes must call drop_references() */ }
34
35         virtual void operator() () = 0;
36         
37         void set_name (const std::string& str) { _name = str; }
38         const std::string& name() const { return _name; }
39
40         virtual void undo() = 0;
41         virtual void redo() { (*this)(); }
42         
43         virtual XMLNode &get_state();
44         virtual int set_state(const XMLNode&, int /*version*/) { /* noop */ return 0; }
45
46         virtual bool empty () const {
47                 return false;
48         }
49
50 protected:
51         Command() {}
52         Command(const std::string& name) : _name(name) {}
53
54         std::string _name;
55 };
56
57 #endif // __lib_pbd_command_h_