Mercurial > octave
annotate libinterp/parse-tree/oct-lvalue.h @ 24991:831389905438 stable
omit argument name from default copy ctors and assignment operators
* thread-manager.h, fcn-info.h, graphics.in.h, load-path.h,
oct-stream.cc, pr-flt-fmt.h, symrec.h, octave.h, oct-lvalue.h,
child-list.h, pathsearch.h, url-transfer.h:
Use "(const foo&)" instead of "(const foo& arg)" for declaration of
default copy constructors and assignment operators.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 26 Mar 2018 13:10:42 -0400 |
parents | 194eb4bd202b |
children | 6652d3823428 |
rev | line source |
---|---|
2979 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 1996-2017 John W. Eaton |
2979 | 4 |
5 This file is part of Octave. | |
6 | |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24362
diff
changeset
|
7 Octave is free software: you can redistribute it and/or modify it |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24362
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
10 (at your option) any later version. |
2979 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22407
diff
changeset
|
15 GNU General Public License for more details. |
2979 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24362
diff
changeset
|
19 <https://www.gnu.org/licenses/>. |
2979 | 20 |
21 */ | |
22 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
20248
diff
changeset
|
23 #if ! defined (octave_oct_lvalue_h) |
17822
ebb3ef964372
maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents:
17787
diff
changeset
|
24 #define octave_oct_lvalue_h 1 |
2979 | 25 |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
27 |
2979 | 28 #include <string> |
29 | |
20940
48b2ad5ee801
maint: Rename oct-obj.[cc|h] to ovl.[cc|h] for clarity.
Rik <rik@octave.org>
parents:
20791
diff
changeset
|
30 #include "ovl.h" |
24362
3fc24b792a24
avoid including symtab.h, symscope.h, or symrec.h unnecessarily
John W. Eaton <jwe@octave.org>
parents:
24356
diff
changeset
|
31 #include "symrec.h" |
2979 | 32 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
33 namespace octave |
2979 | 34 { |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
35 class octave_lvalue |
17787
175b392e91fe
Use GNU style coding conventions for code in libinterp/
Rik <rik@octave.org>
parents:
17744
diff
changeset
|
36 { |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
37 public: |
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
38 |
24356
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
39 octave_lvalue (void) |
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
40 : m_sym (), m_context (0), m_black_hole (false), m_type (), |
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
41 m_idx (), m_nel (1) |
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
42 { } |
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
43 |
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
44 octave_lvalue (const symbol_record& sr, symbol_record::context_id context) |
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
45 : m_sym (sr), m_context (context), m_black_hole (false), |
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
46 m_type (), m_idx (), m_nel (1) |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
47 { } |
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
48 |
24991
831389905438
omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
49 octave_lvalue (const octave_lvalue&) = default; |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
50 |
24991
831389905438
omit argument name from default copy ctors and assignment operators
John W. Eaton <jwe@octave.org>
parents:
24534
diff
changeset
|
51 octave_lvalue& operator = (const octave_lvalue&) = default; |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
52 |
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
53 ~octave_lvalue (void) = default; |
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
54 |
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
55 bool is_black_hole (void) const { return m_black_hole; } |
2979 | 56 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
57 void mark_black_hole (void) { m_black_hole = true; } |
2979 | 58 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
59 bool is_defined (void) const |
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
60 { |
24356
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
61 return ! is_black_hole () && m_sym.is_defined (m_context); |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
62 } |
24037
21915520ac7b
use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
63 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
64 bool is_undefined (void) const |
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
65 { |
24356
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
66 return is_black_hole () || m_sym.is_undefined (m_context); |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
67 } |
10206
37a08e0ce2dc
support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
68 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
69 bool isstruct (void) const { return value().isstruct (); } |
2979 | 70 |
24356
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
71 void define (const octave_value& v) { m_sym.assign (v, m_context); } |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
72 |
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
73 void assign (octave_value::assign_op, const octave_value&); |
2979 | 74 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
75 void numel (octave_idx_type n) { m_nel = n; } |
16442
302157614308
deprecate symbol_table::varref functions
John W. Eaton <jwe@octave.org>
parents:
15195
diff
changeset
|
76 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
77 octave_idx_type numel (void) const { return m_nel; } |
2979 | 78 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
79 void set_index (const std::string& t, const std::list<octave_value_list>& i); |
2979 | 80 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
81 void clear_index (void) { m_type = ""; m_idx.clear (); } |
5846 | 82 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
83 std::string index_type (void) const { return m_type; } |
5846 | 84 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
85 bool index_is_empty (void) const; |
2984 | 86 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
87 void do_unary_op (octave_value::unary_op op); |
20248
011a364b4d78
improve compatibility of indexed assignment (bug #43813)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
88 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
89 octave_value value (void) const; |
20248
011a364b4d78
improve compatibility of indexed assignment (bug #43813)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
90 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
91 private: |
2979 | 92 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
93 symbol_record m_sym; |
2979 | 94 |
24356
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
95 symbol_record::context_id m_context; |
8b14ba8296af
refactor symbol_record object
John W. Eaton <jwe@octave.org>
parents:
24355
diff
changeset
|
96 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
97 bool m_black_hole; |
24037
21915520ac7b
use more direct method for non-local symbol access (bug #38236)
John W. Eaton <jwe@octave.org>
parents:
23693
diff
changeset
|
98 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
99 std::string m_type; |
2979 | 100 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
101 std::list<octave_value_list> m_idx; |
2979 | 102 |
24355
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
103 octave_idx_type m_nel; |
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
104 }; |
cc3b3ceb155c
update octave_lvalue class and move inside octave namespace
John W. Eaton <jwe@octave.org>
parents:
24350
diff
changeset
|
105 } |
2979 | 106 |
107 #endif |