SDFormat Editor
Loading...
Searching...
No Matches
GenericCommand.h
1/*
2* sdformat-editor
3* Copyright 2025 sdformat-editor
4*
5* Licensed under the Apache License, Version 2.0 (the "License");
6* you may not use this file except in compliance with the License.
7* You may obtain a copy of the License at
8*
9* http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS,
13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14* See the License for the specific language governing permissions and
15* limitations under the License.
16*
17* Developer: Zaid Duraid, Ean Wheeler, Evan Vokey
18*/
19
20#ifndef SDFORMAT_EDITOR_GENERIC_COMMAND_HH_
21#define SDFORMAT_EDITOR_GENERIC_COMMAND_HH_
22
23
24#include <interfaces/command_interface.h>
25
26#include <functional>
27
30{
31
35 public: GenericCommand(std::function<void()> function_handle);
36
39 private: bool Execute() override;
40
43 private: bool ExecuteUndo() override;
44
47 private: bool ExecuteRedo() override;
48
51 private: bool IsUndoable() override;
52
55 private: bool IsRedoable() override;
56
61 private: bool IsThreaded(bool& prevent_user_input) override;
62
65 private: bool ChangesProgramStateIrreversibly() override;
66
68 std::function<void()> function_handle;
69
70};
71
72#endif
The command class encapsulates the interactions between the various interfaces of the SDFormat Editor...
Definition command_interface.h:29
Executes a given function handle.
Definition GenericCommand.h:30
std::function< void()> function_handle
Function pointer to hold the command function.
Definition GenericCommand.h:68
bool ChangesProgramStateIrreversibly() override
Implementation of interface method.
Definition GenericCommand.cpp:59
bool Execute() override
Implementation of interface method.
Definition GenericCommand.cpp:27
bool IsThreaded(bool &prevent_user_input) override
Implementation of interface method.
Definition GenericCommand.cpp:53
bool ExecuteUndo() override
Implementation of interface method.
Definition GenericCommand.cpp:33
bool IsRedoable() override
Implementation of interface method.
Definition GenericCommand.cpp:48
bool ExecuteRedo() override
Implementation of interface method.
Definition GenericCommand.cpp:38
bool IsUndoable() override
Implementation of interface method.
Definition GenericCommand.cpp:43