annotate examples/code/structdemo.cc @ 33636:3ec6fcce7715 default tip @

gui: Avoid using HAVE_QSCINTILLA in more header files. * gui-settings.h, settings-dialog.h: Don't include QScintilla header. Forward-declare QSciLexer class instead if necessary. Declare all member functions unconditionally. * gui-settings.cc (gui_settings::get_valid_lexer_styles, gui_settings::read_lexer_settings), settings-dialog.cc (settings_dialog::update_lexer, settings_dialog::get_lexer_settings, settings_dialog::write_lexer_settings): Define functions unconditionally. * gui-preferences-ed.h: Don't include QScintilla header. Remove definition of local variable os_eol_mode from header. * gui-preferences-ed.cc (os_eol_mode): Move definition of local variable here.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 28 May 2024 14:54:58 +0200
parents 7ed6b258db91
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
1 #include <octave/oct.h>
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
2 #include <octave/ov-struct.h>
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
3
16867
be41c30bcb44 Re-write documentation and all examples of dynamically linked functions.
Rik <rik@octave.org>
parents: 12174
diff changeset
4 DEFUN_DLD (structdemo, args, , "Struct Demo")
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
5 {
20546
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
6 if (args.length () != 2)
11051
2204120e38d2 structdemo.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents: 9932
diff changeset
7 print_usage ();
2204120e38d2 structdemo.cc: use octave_scalar_map instead of Octave_map
John W. Eaton <jwe@octave.org>
parents: 9932
diff changeset
8
23584
7ed6b258db91 maint: Deprecate is_map and replace with isstruct.
Rik <rik@octave.org>
parents: 20546
diff changeset
9 if (! args(0).isstruct ())
20546
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
10 error ("structdemo: ARG1 must be a struct");
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
11
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
12 octave_scalar_map arg0 = args(0).scalar_map_value ();
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
13 //octave_map arg0 = args(0).map_value ();
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
14
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
15 if (! args(1).is_string ())
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
16 error ("structdemo: ARG2 must be a character string");
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
17
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
18 std::string arg1 = args(1).string_value ();
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
19
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
20 octave_value tmp = arg0.contents (arg1);
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
21 //octave_value tmp = arg0.contents (arg1)(0);
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
22
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
23 if (! tmp.is_defined ())
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
24 error ("structdemo: struct does not have a field named '%s'\n",
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
25 arg1.c_str ());
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
26
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
27 octave_scalar_map st;
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
28
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
29 st.assign ("selected", tmp);
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
30
2f8500ca91d3 eliminate error_state from example files
John W. Eaton <jwe@octave.org>
parents: 19033
diff changeset
31 return octave_value (st);
6572
8e7148b84b59 [project @ 2007-04-25 04:13:44 by jwe]
jwe
parents:
diff changeset
32 }