diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-03-03 22:34:50 +0100 |
---|---|---|
committer | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-07 00:13:35 +0200 |
commit | 30c7499a3c656784cc45825b4b1b2fca61081308 (patch) | |
tree | 32f8ad2c085e3a1706ed0994c0f39eadde39830d /commands/command_base.h | |
parent | 3aa1bb5bfae9a7ebf8f5e6cdbf751afcafdb4baf (diff) | |
download | subsurface-30c7499a3c656784cc45825b4b1b2fca61081308.tar.gz |
undo: implement addBookmark undo command
Create a new translation unit for event-related undo commands.
Create a base class of commands that add events and one subclass
that adds a bookmark event.
Use this command in the profile-widget.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'commands/command_base.h')
-rw-r--r-- | commands/command_base.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/commands/command_base.h b/commands/command_base.h index ffc6c4e91..be725d6a5 100644 --- a/commands/command_base.h +++ b/commands/command_base.h @@ -141,7 +141,7 @@ // We put everything in a namespace, so that we can shorten names without polluting the global namespace namespace Command { -// Classes used to automatically call free_dive()/free_trip for owning pointers that go out of scope. +// Classes used to automatically call the appropriate free_*() function for owning pointers that go out of scope. struct DiveDeleter { void operator()(dive *d) { free_dive(d); } }; @@ -151,11 +151,15 @@ struct TripDeleter { struct DiveSiteDeleter { void operator()(dive_site *ds) { free_dive_site(ds); } }; +struct EventDeleter { + void operator()(event *ev) { free(ev); } +}; -// Owning pointers to dive and dive_trip objects. +// Owning pointers to dive, dive_trip, dive_site and event objects. typedef std::unique_ptr<dive, DiveDeleter> OwningDivePtr; typedef std::unique_ptr<dive_trip, TripDeleter> OwningTripPtr; typedef std::unique_ptr<dive_site, DiveSiteDeleter> OwningDiveSitePtr; +typedef std::unique_ptr<event, EventDeleter> OwningEventPtr; // This is the base class of all commands. // It defines the Qt-translation functions @@ -182,4 +186,3 @@ QString getListOfDives(QVector<struct dive *> dives); } // namespace Command #endif // COMMAND_BASE_H - |