Mercurial > hg > octave-lyh
annotate src/oct-lvalue.h @ 14429:eff4a5933e28
Update %!tests in src/ directory with Octave coding conventions.
* data.cc, defaults.cc, dirfns.cc, file-io.cc, graphics.cc, mappers.cc,
oct-map.cc, octave.cc, ov-base.cc, ov-bool-mat.cc, ov-cell.cc,
ov-fcn-handle.cc, ov-fcn-inline.cc, ov-flt-re-mat.cc, ov-int16.cc, ov-int32.cc,
ov-int64.cc, ov-int8.cc, ov-null-mat.cc, ov-oncleanup.cc, ov-range.cc,
ov-re-mat.cc, ov-struct.cc, ov-typeinfo.cc, ov-uint16.cc, ov-uint32.cc,
ov-uint64.cc, ov-uint8.cc, ov.cc, pr-output.cc, pt-binop.cc, pt-eval.cc,
pt-idx.cc, pt-mat.cc, sighandlers.cc, strfns.cc, symtab.cc, syscalls.cc,
sysdep.cc, toplev.cc, utils.cc, variables.cc: Update %!tests in src/ directory
with Octave coding conventions.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 04 Mar 2012 12:21:10 -0800 |
parents | 72c96de7a403 |
children |
rev | line source |
---|---|
2979 | 1 /* |
2 | |
14138
72c96de7a403
maint: update copyright notices for 2012
John W. Eaton <jwe@octave.org>
parents:
11586
diff
changeset
|
3 Copyright (C) 1996-2012 John W. Eaton |
2979 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
2979 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
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 |
19 <http://www.gnu.org/licenses/>. | |
2979 | 20 |
21 */ | |
22 | |
23 #if !defined (octave_lvalue_h) | |
24 #define octave_lvalue_h 1 | |
25 | |
26 class octave_value; | |
27 class octave_value_list; | |
28 | |
29 #include <string> | |
30 | |
31 #include "oct-obj.h" | |
3929 | 32 #include "pt-idx.h" |
2979 | 33 |
34 class | |
35 octave_lvalue | |
36 { | |
37 public: | |
38 | |
10206
37a08e0ce2dc
support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
39 octave_lvalue (octave_value *v = 0) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
40 : val (v), type (), idx (), nel (1) |
10227
d3fc22c3071c
omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents:
10206
diff
changeset
|
41 { } |
2979 | 42 |
43 octave_lvalue (const octave_lvalue& vr) | |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
44 : val (vr.val), type (vr.type), idx (vr.idx), nel (vr.nel) |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
45 { |
10206
37a08e0ce2dc
support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
46 } |
2979 | 47 |
48 octave_lvalue& operator = (const octave_lvalue& vr) | |
49 { | |
50 if (this != &vr) | |
10313 | 51 { |
52 val = vr.val; | |
53 type = vr.type; | |
54 idx = vr.idx; | |
55 nel = vr.nel; | |
56 } | |
2979 | 57 |
58 return *this; | |
59 } | |
60 | |
61 ~octave_lvalue (void) { } | |
62 | |
10227
d3fc22c3071c
omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents:
10206
diff
changeset
|
63 bool is_black_hole (void) const { return val == 0; } |
10206
37a08e0ce2dc
support Matlab-style empty output/input arguments
Jaroslav Hajek <highegg@gmail.com>
parents:
10160
diff
changeset
|
64 |
10227
d3fc22c3071c
omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents:
10206
diff
changeset
|
65 bool is_defined (void) const { return val && val->is_defined (); } |
d3fc22c3071c
omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents:
10206
diff
changeset
|
66 |
d3fc22c3071c
omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents:
10206
diff
changeset
|
67 bool is_undefined (void) const { return ! val || val->is_undefined (); } |
2979 | 68 |
10227
d3fc22c3071c
omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents:
10206
diff
changeset
|
69 bool is_map (void) const { return val && val->is_map (); } |
2979 | 70 |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
71 void define (const octave_value& v) |
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
72 { |
10227
d3fc22c3071c
omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents:
10206
diff
changeset
|
73 if (val) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
74 *val = v; |
10227
d3fc22c3071c
omit ~ values from multi-assignment return lists
Jaroslav Hajek <highegg@gmail.com>
parents:
10206
diff
changeset
|
75 } |
2979 | 76 |
77 void assign (octave_value::assign_op, const octave_value&); | |
78 | |
5846 | 79 void numel (octave_idx_type n) { nel = n; } |
80 | |
81 octave_idx_type numel (void) const { return nel; } | |
82 | |
4219 | 83 void set_index (const std::string& t, const std::list<octave_value_list>& i); |
2979 | 84 |
3933 | 85 void clear_index (void) { type = std::string (); idx.clear (); } |
2984 | 86 |
3203 | 87 void do_unary_op (octave_value::unary_op op); |
2979 | 88 |
5001 | 89 octave_value value (void); |
2979 | 90 |
4234 | 91 const octave_value *object (void) const { return val; } |
92 | |
2979 | 93 private: |
94 | |
95 octave_value *val; | |
96 | |
3933 | 97 std::string type; |
2979 | 98 |
4219 | 99 std::list<octave_value_list> idx; |
3929 | 100 |
5846 | 101 octave_idx_type nel; |
2979 | 102 }; |
103 | |
104 #endif |