Mercurial > octave
annotate liboctave/util/action-container.h @ 23927:e3a36f84d01d
provide variable-editor widget for the GUI
This patch is the work of
RĂ¼diger Sonderfeld <ruediger on savannah>
Philip Nienhuis
Michael Barnes <mjbcode@runbox.com>
jwe
* libgui/src/variable-editor.cc, libgui/src/variable-editor.h,
libgui/src/variable-editor-model.cc,
libgui/src/variable-editor-model.h:: New files.
* libgui/src/module.mk: Update.
* main-window.cc, main-window.h (main_window::main_window):
Initialize variable_editor_window.
(main_window::~main_window): Delete variable_editor_window.
(main_window::connect_uiwidget_links): Connect variable window signals
to octave_qt_link slots and callbacks. Add variable editor to menus.
(main_window::variable_editor_callback,
main_window::force_refresh_workspace, main_window::edit_variable,
main_window::clear_variable_editor_cache): New functions.
(main_window::configure_shortcuts): Also configure variable editor
shortcuts.
* resource-manager.cc, resource-manager.h (varedit_color_chars,
varedit_color_names, varedit_default_colors): New functions.
* settings-dialog.ui: New configuration info for variable editor.
* settings-dialog.cc, settings-dialog.h
(settings_dialog::read_varedit_colors,
settings_dialog::write_varedit_colors): New functions.
(settings_dialog::settings_dialog,
settings_dialog::write_changed_settings): Also handle settings for
variable editor.
* workspace-model.h (workspace_model::prompt_variable_editor):
New signal.
* workspace-view.cc, workspace-view.h
(workspace_view::workspace_view): Also connect eidt_variable_signal to
edit_variable slot.
(workspace_view::contextmenu_requested): Handle opening variabl in
variable editor.
(workspace_view::handle_contextmenu_edit): New function.
(workspace_view::edit_variable_signal): New signal.
* octave-link.cc, octave-link.h (Fopenvar): New function.
(octave_link::post_event, octave_link::do_post_event): New variants
for methods with two, three, or four arguments.
(octave_link::set_workspace): New argument, update_variable_editor.
(octave_link::openvar): New function.
(octave_link::do_openvar): New pure virtual.
* octave-qt-link.cc, octave-qt-link.h
(octave_qt_link::do_set_workspace): New argument,
update_variable_editor.
(octave_qt_link::do_set_workspace): Optionally emit
refresh_variable_editor signal
(octave_qt_link::do_openvar): New function.
(octave_qt_link::open_variable,
octave_qt_link::refresh_variable_editor): New signals.
* gui.txi: Document openvar.
* variables.cc, variables.h (symbol_exist): New function.
* action-container.h (action_container::method_arg2_elem,
action_container::method_arg3_elem,
action_container::method_arg4_elem): New classes.
(action_container::add_method): New variants for two, three, or four
arguments.
author | Michael Barnes <mjbcode@runbox.com> |
---|---|
date | Fri, 19 May 2017 18:15:48 +0200 |
parents | 0b4d1575a2e2 |
children | 08f19fd144f4 |
rev | line source |
---|---|
15396 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 1993-2017 John W. Eaton |
15396 | 4 Copyright (C) 2009-2010 VZLU Prague |
5 | |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
9 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
10 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
11 (at your option) any later version. |
15396 | 12 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
13 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
14 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
16 GNU General Public License for more details. |
15396 | 17 |
18 You should have received a copy of the GNU General Public License | |
19 along with Octave; see the file COPYING. If not, see | |
20 <http://www.gnu.org/licenses/>. | |
21 | |
22 */ | |
23 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
24 #if ! defined (octave_action_container_h) |
15396 | 25 #define octave_action_container_h 1 |
26 | |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
27 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21139
diff
changeset
|
28 |
23442
53f5f8231c37
allow most header files to be compiled separately
John W. Eaton <jwe@octave.org>
parents:
23437
diff
changeset
|
29 #include <cstddef> |
53f5f8231c37
allow most header files to be compiled separately
John W. Eaton <jwe@octave.org>
parents:
23437
diff
changeset
|
30 |
15396 | 31 // This class allows registering actions in a list for later |
32 // execution, either explicitly or when the container goes out of | |
33 // scope. | |
34 | |
17769
49a5a4be04a1
maint: Use GNU style coding conventions for code in liboctave/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
35 // FIXME: is there a better name for this class? |
15396 | 36 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
37 namespace octave |
15396 | 38 { |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
39 class |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
40 action_container |
15396 | 41 { |
42 public: | |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
43 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
44 // A generic unwind_protect element. Knows how to run itself and |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
45 // discard itself. Also, contains a pointer to the next element. |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
46 class elem |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
47 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
48 public: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
49 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
50 friend class action_container; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
51 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
52 elem (void) { } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
53 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
54 // No copying! |
15396 | 55 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
56 elem (const elem&) = delete; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
57 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
58 elem& operator = (const elem&) = delete; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
59 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
60 virtual ~elem (void) = default; |
15396 | 61 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
62 virtual void run (void) { } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
63 }; |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
64 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
65 // An element that merely runs a void (*)(void) function. |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
66 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
67 class fcn_elem : public elem |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
68 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
69 public: |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
70 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
71 fcn_elem (void (*fptr) (void)) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
72 : e_fptr (fptr) { } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
73 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
74 void run (void) { e_fptr (); } |
15396 | 75 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
76 private: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
77 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
78 void (*e_fptr) (void); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
79 }; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
80 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
81 // An element that stores a variable of type T along with a void (*) (T) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
82 // function pointer, and calls the function with the parameter. |
15396 | 83 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
84 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
85 class fcn_arg_elem : public elem |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
86 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
87 public: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
88 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
89 fcn_arg_elem (void (*fcn) (T), T arg) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
90 : e_fcn (fcn), e_arg (arg) { } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
91 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
92 // No copying! |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
93 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
94 fcn_arg_elem (const fcn_arg_elem&) = delete; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
95 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
96 fcn_arg_elem& operator = (const fcn_arg_elem&) = delete; |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
97 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
98 void run (void) { e_fcn (e_arg); } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
99 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
100 private: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
101 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
102 void (*e_fcn) (T); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
103 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
104 T e_arg; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
105 }; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
106 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
107 // An element that stores a variable of type T along with a |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
108 // void (*) (const T&) function pointer, and calls the function with |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
109 // the parameter. |
15396 | 110 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
111 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
112 class fcn_crefarg_elem : public elem |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
113 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
114 public: |
23437
442fe5b5afb5
new action_container constructors for unwind_protect
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
115 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
116 fcn_crefarg_elem (void (*fcn) (const T&), const T& arg) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
117 : e_fcn (fcn), e_arg (arg) { } |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
118 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
119 void run (void) { e_fcn (e_arg); } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
120 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
121 private: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
122 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
123 void (*e_fcn) (const T&); |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
124 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
125 T e_arg; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
126 }; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
127 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
128 // An element for calling a member function. |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
129 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
130 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
131 class method_elem : public elem |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
132 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
133 public: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
134 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
135 method_elem (T *obj, void (T::*method) (void)) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
136 : e_obj (obj), e_method (method) { } |
15396 | 137 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
138 method_elem (T& obj, void (T::*method) (void)) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
139 : e_obj (&obj), e_method (method) { } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
140 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
141 // No copying! |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
142 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
143 method_elem (const method_elem&) = delete; |
15396 | 144 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
145 method_elem operator = (const method_elem&) = delete; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
146 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
147 void run (void) { (e_obj->*e_method) (); } |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
148 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
149 private: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
150 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
151 T *e_obj; |
15396 | 152 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
153 void (T::*e_method) (void); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
154 }; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
155 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
156 // An element for calling a member function with a single argument |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
157 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
158 template <typename T, typename A> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
159 class method_arg_elem : public elem |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
160 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
161 public: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
162 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
163 method_arg_elem (T *obj, void (T::*method) (A), A arg) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
164 : e_obj (obj), e_method (method), e_arg (arg) { } |
15396 | 165 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
166 method_arg_elem (T& obj, void (T::*method) (A), A arg) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
167 : e_obj (&obj), e_method (method), e_arg (arg) { } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
168 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
169 // No copying! |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
170 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
171 method_arg_elem (const method_arg_elem&) = delete; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
172 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
173 method_arg_elem operator = (const method_arg_elem&) = delete; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
174 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
175 void run (void) { (e_obj->*e_method) (e_arg); } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
176 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
177 private: |
15396 | 178 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
179 T *e_obj; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
180 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
181 void (T::*e_method) (A); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
182 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
183 A e_arg; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
184 }; |
23437
442fe5b5afb5
new action_container constructors for unwind_protect
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
185 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
186 // An element for calling a member function with a single argument |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
187 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
188 template <typename T, typename A> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
189 class method_crefarg_elem : public elem |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
190 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
191 public: |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
192 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
193 method_crefarg_elem (T *obj, void (T::*method) (const A&), const A& arg) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
194 : e_obj (obj), e_method (method), e_arg (arg) { } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
195 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
196 method_crefarg_elem (T& obj, void (T::*method) (const A&), const A& arg) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
197 : e_obj (&obj), e_method (method), e_arg (arg) { } |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
198 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
199 // No copying! |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
200 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
201 method_crefarg_elem (const method_crefarg_elem&) = delete; |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
202 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
203 method_crefarg_elem operator = (const method_crefarg_elem&) = delete; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
204 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
205 void run (void) { (e_obj->*e_method) (e_arg); } |
15396 | 206 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
207 private: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
208 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
209 T *e_obj; |
15396 | 210 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
211 void (T::*e_method) (const A&); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
212 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
213 A e_arg; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
214 }; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
215 |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
216 /// An element for calling a member function with two arguments |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
217 template <class T, class A, class B> |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
218 class method_arg2_elem : public elem |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
219 { |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
220 public: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
221 method_arg2_elem (T *obj, void (T::*method) (A, B), |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
222 A arg_a, B arg_b) |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
223 : e_obj (obj), e_method (method), |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
224 e_arg_a (arg_a), e_arg_b (arg_b) { } |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
225 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
226 void run (void) { (e_obj->*e_method) (e_arg_a, e_arg_b); } |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
227 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
228 private: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
229 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
230 T *e_obj; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
231 void (T::*e_method) (A, B); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
232 A e_arg_a; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
233 B e_arg_b; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
234 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
235 // No copying! |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
236 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
237 method_arg2_elem (const method_arg2_elem&); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
238 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
239 method_arg2_elem operator = (const method_arg2_elem&); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
240 }; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
241 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
242 /// An element for calling a member function with three arguments |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
243 template <class T, class A, class B, class C> |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
244 class method_arg3_elem : public elem |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
245 { |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
246 public: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
247 method_arg3_elem (T *obj, void (T::*method) (A, B, C), |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
248 A arg_a, B arg_b, C arg_c) |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
249 : e_obj (obj), e_method (method), |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
250 e_arg_a (arg_a), e_arg_b (arg_b), e_arg_c (arg_c) |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
251 { } |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
252 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
253 void run (void) { (e_obj->*e_method) (e_arg_a, e_arg_b, e_arg_c); } |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
254 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
255 private: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
256 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
257 T *e_obj; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
258 void (T::*e_method) (A, B, C); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
259 A e_arg_a; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
260 B e_arg_b; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
261 C e_arg_c; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
262 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
263 // No copying! |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
264 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
265 method_arg3_elem (const method_arg3_elem&); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
266 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
267 method_arg3_elem operator = (const method_arg3_elem&); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
268 }; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
269 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
270 /// An element for calling a member function with three arguments |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
271 template <class T, class A, class B, class C, class D> |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
272 class method_arg4_elem : public elem |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
273 { |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
274 public: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
275 method_arg4_elem (T *obj, void (T::*method) (A, B, C, D), |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
276 A arg_a, B arg_b, C arg_c, D arg_d) |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
277 : e_obj (obj), e_method (method), |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
278 e_arg_a (arg_a), e_arg_b (arg_b), e_arg_c (arg_c), e_arg_d (arg_d) |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
279 { } |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
280 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
281 void run (void) { |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
282 (e_obj->*e_method) (e_arg_a, e_arg_b, e_arg_c, e_arg_d); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
283 } |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
284 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
285 private: |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
286 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
287 T *e_obj; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
288 void (T::*e_method) (A, B, C, D); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
289 A e_arg_a; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
290 B e_arg_b; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
291 C e_arg_c; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
292 D e_arg_d; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
293 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
294 // No copying! |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
295 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
296 method_arg4_elem (const method_arg4_elem&); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
297 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
298 method_arg4_elem operator = (const method_arg4_elem&); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
299 }; |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
300 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
301 // An element that stores arbitrary variable, and restores it. |
15396 | 302 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
303 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
304 class restore_var_elem : public elem |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
305 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
306 public: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
307 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
308 restore_var_elem (T& ref, const T& val) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
309 : e_ptr (&ref), e_val (val) { } |
15396 | 310 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
311 // No copying! |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
312 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
313 restore_var_elem (const restore_var_elem&) = delete; |
15396 | 314 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
315 restore_var_elem& operator = (const restore_var_elem&) = delete; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
316 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
317 void run (void) { *e_ptr = e_val; } |
15396 | 318 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
319 private: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
320 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
321 T *e_ptr, e_val; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
322 }; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
323 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
324 // Deletes a class allocated using new. |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
325 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
326 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
327 class delete_ptr_elem : public elem |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
328 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
329 public: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
330 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
331 delete_ptr_elem (T *ptr) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
332 : e_ptr (ptr) { } |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
333 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
334 // No copying! |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
335 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
336 delete_ptr_elem (const delete_ptr_elem&) = delete; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
337 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
338 delete_ptr_elem operator = (const delete_ptr_elem&) = delete; |
15396 | 339 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
340 void run (void) { delete e_ptr; } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
341 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
342 private: |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
343 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
344 T *e_ptr; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
345 }; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
346 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
347 action_container (void) { } |
23437
442fe5b5afb5
new action_container constructors for unwind_protect
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
348 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
349 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
350 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
351 action_container (const action_container&) = delete; |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
352 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
353 action_container& operator = (const action_container&) = delete; |
15396 | 354 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
355 virtual ~action_container (void) = default; |
15396 | 356 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
357 virtual void add (elem *new_elem) = 0; |
15396 | 358 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
359 // Call to void func (void). |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
360 void add_fcn (void (*fcn) (void)) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
361 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
362 add (new fcn_elem (fcn)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
363 } |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
364 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
365 // Call to void func (T). |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
366 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
367 void add_fcn (void (*action) (T), T val) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
368 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
369 add (new fcn_arg_elem<T> (action, val)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
370 } |
15396 | 371 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
372 // Call to void func (const T&). |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
373 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
374 void add_fcn (void (*action) (const T&), const T& val) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
375 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
376 add (new fcn_crefarg_elem<T> (action, val)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
377 } |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
378 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
379 // Call to T::method (void). |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
380 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
381 void add_method (T *obj, void (T::*method) (void)) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
382 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
383 add (new method_elem<T> (obj, method)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
384 } |
15396 | 385 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
386 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
387 void add_method (T& obj, void (T::*method) (void)) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
388 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
389 add (new method_elem<T> (obj, method)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
390 } |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
391 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
392 // Call to T::method (A). |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
393 template <typename T, typename A> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
394 void add_method (T *obj, void (T::*method) (A), A arg) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
395 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
396 add (new method_arg_elem<T, A> (obj, method, arg)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
397 } |
15396 | 398 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
399 template <typename T, typename A> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
400 void add_method (T& obj, void (T::*method) (A), A arg) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
401 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
402 add (new method_arg_elem<T, A> (obj, method, arg)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
403 } |
15396 | 404 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
405 // Call to T::method (const A&). |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
406 template <typename T, typename A> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
407 void add_method (T *obj, void (T::*method) (const A&), const A& arg) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
408 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
409 add (new method_crefarg_elem<T, A> (obj, method, arg)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
410 } |
15396 | 411 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
412 template <typename T, typename A> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
413 void add_method (T& obj, void (T::*method) (const A&), const A& arg) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
414 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
415 add (new method_crefarg_elem<T, A> (obj, method, arg)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
416 } |
15396 | 417 |
23927
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
418 // Call to T::method (A, B). |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
419 template <class T, class A, class B> |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
420 void add_method (T *obj, void (T::*method) (A, B), |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
421 A arg_a, B arg_b) |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
422 { |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
423 add (new method_arg2_elem<T, A, B> (obj, method, arg_a, arg_b)); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
424 } |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
425 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
426 // Call to T::method (A, B, C). |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
427 template <class T, class A, class B, class C> |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
428 void add_method (T *obj, void (T::*method) (A, B, C), |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
429 A arg_a, B arg_b, C arg_c) |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
430 { |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
431 add (new method_arg3_elem<T, A, B, C> (obj, method, arg_a, |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
432 arg_b, arg_c)); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
433 } |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
434 |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
435 // Call to T::method (A, B, C, D). |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
436 template <class T, class A, class B, class C, class D> |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
437 void add_method (T *obj, void (T::*method) (A, B, C, D), |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
438 A arg_a, B arg_b, |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
439 C arg_c, D arg_d) |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
440 { |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
441 add (new method_arg4_elem<T, A, B, C, D> (obj, method, arg_a, |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
442 arg_b, arg_c, arg_d)); |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
443 } |
e3a36f84d01d
provide variable-editor widget for the GUI
Michael Barnes <mjbcode@runbox.com>
parents:
23747
diff
changeset
|
444 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
445 // Call to delete (T*). |
23437
442fe5b5afb5
new action_container constructors for unwind_protect
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
446 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
447 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
448 void add_delete (T *obj) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
449 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
450 add (new delete_ptr_elem<T> (obj)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
451 } |
15396 | 452 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
453 // Protect any variable. |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
454 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
455 void protect_var (T& var) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
456 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
457 add (new restore_var_elem<T> (var, var)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
458 } |
15396 | 459 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
460 // Protect any variable, value given. |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
461 template <typename T> |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
462 void protect_var (T& var, const T& val) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
463 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
464 add (new restore_var_elem<T> (var, val)); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
465 } |
23437
442fe5b5afb5
new action_container constructors for unwind_protect
John W. Eaton <jwe@octave.org>
parents:
23220
diff
changeset
|
466 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
467 operator bool (void) const { return ! empty (); } |
15396 | 468 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
469 virtual void run_first (void) = 0; |
15396 | 470 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
471 void run (size_t num) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
472 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
473 if (num > size ()) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
474 num = size (); |
15396 | 475 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
476 for (size_t i = 0; i < num; i++) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
477 run_first (); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
478 } |
15396 | 479 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
480 void run (void) { run (size ()); } |
15396 | 481 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
482 virtual void discard_first (void) = 0; |
15396 | 483 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
484 void discard (size_t num) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
485 { |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
486 if (num > size ()) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
487 num = size (); |
15396 | 488 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
489 for (size_t i = 0; i < num; i++) |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
490 discard_first (); |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
491 } |
15396 | 492 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
493 void discard (void) { discard (size ()); } |
15396 | 494 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
495 virtual size_t size (void) const = 0; |
15396 | 496 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
497 bool empty (void) const { return size () == 0; } |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
498 }; |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
499 } |
15396 | 500 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
501 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) |
15396 | 502 |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
503 OCTAVE_DEPRECATED (4.4, "use 'octave::action_container' instead") |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
504 typedef octave::action_container action_container; |
15396 | 505 |
506 #endif | |
23747
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
507 |
0b4d1575a2e2
move action_container and event_queue classes inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
23442
diff
changeset
|
508 #endif |