GNU Octave 7.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
oct-lvalue.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 1996-2022 The Octave Project Developers
4//
5// See the file COPYRIGHT.md in the top-level directory of this
6// distribution or <https://octave.org/copyright/>.
7//
8// This file is part of Octave.
9//
10// Octave is free software: you can redistribute it and/or modify it
11// under the terms of the GNU General Public License as published by
12// the Free Software Foundation, either version 3 of the License, or
13// (at your option) any later version.
14//
15// Octave is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18// GNU General Public License for more details.
19//
20// You should have received a copy of the GNU General Public License
21// along with Octave; see the file COPYING. If not, see
22// <https://www.gnu.org/licenses/>.
23//
24////////////////////////////////////////////////////////////////////////
25
26#if ! defined (octave_oct_lvalue_h)
27#define octave_oct_lvalue_h 1
28
29#include "octave-config.h"
30
31#include <string>
32
33#include "ovl.h"
34#include "stack-frame.h"
35#include "symrec.h"
36
37namespace octave
38{
40 {
41 public:
42
44 const std::shared_ptr<stack_frame>& frame)
45 : m_sym (sr), m_frame (frame), m_black_hole (false),
46 m_type (), m_idx ()
47 { }
48
49 octave_lvalue (const octave_lvalue&) = default;
50
52
53 ~octave_lvalue (void) = default;
54
55 bool is_black_hole (void) const { return m_black_hole; }
56
57 void mark_black_hole (void) { m_black_hole = true; }
58
59 bool is_defined (void) const;
60
61 bool is_undefined (void) const;
62
63 bool isstruct (void) const { return value().isstruct (); }
64
65 void define (const octave_value& v);
66
68
69 octave_idx_type numel (void) const;
70
71 void set_index (const std::string& t, const std::list<octave_value_list>& i);
72
73 void clear_index (void) { m_type = ""; m_idx.clear (); }
74
75 std::string index_type (void) const { return m_type; }
76
77 bool index_is_empty (void) const;
78
79 bool index_is_colon (void) const;
80
82
83#if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
84 OCTAVE_DEPRECATED (7, "use 'octave_lvalue::unary_op' instead")
85 void do_unary_op (octave_value::unary_op op)
86 {
87 return unary_op (op);
88 }
89#endif
90
91 octave_value value (void) const;
92
93 private:
94
96 eval_for_numel (const std::string& type,
97 const std::list<octave_value_list>& idx) const;
98
100
101 std::shared_ptr<stack_frame> m_frame;
102
104
105 std::string m_type;
106
107 std::list<octave_value_list> m_idx;
108
110 };
111}
112
113#endif
bool isstruct(void) const
Definition: oct-lvalue.h:63
bool index_is_empty(void) const
Definition: oct-lvalue.cc:181
std::list< octave_value_list > m_idx
Definition: oct-lvalue.h:107
void assign(octave_value::assign_op, const octave_value &)
Definition: oct-lvalue.cc:55
void set_index(const std::string &t, const std::list< octave_value_list > &i)
Definition: oct-lvalue.cc:171
~octave_lvalue(void)=default
bool is_black_hole(void) const
Definition: oct-lvalue.h:55
octave_value value(void) const
Definition: oct-lvalue.cc:215
void define(const octave_value &v)
Definition: oct-lvalue.cc:50
symbol_record m_sym
Definition: oct-lvalue.h:99
octave_idx_type numel(void) const
Definition: oct-lvalue.cc:62
octave_lvalue(const octave_lvalue &)=default
std::string index_type(void) const
Definition: oct-lvalue.h:75
octave_value eval_for_numel(const std::string &type, const std::list< octave_value_list > &idx) const
Definition: oct-lvalue.cc:222
octave_lvalue(const symbol_record &sr, const std::shared_ptr< stack_frame > &frame)
Definition: oct-lvalue.h:43
void clear_index(void)
Definition: oct-lvalue.h:73
std::shared_ptr< stack_frame > m_frame
Definition: oct-lvalue.h:101
bool is_undefined(void) const
Definition: oct-lvalue.cc:45
std::string m_type
Definition: oct-lvalue.h:105
bool index_is_colon(void) const
Definition: oct-lvalue.cc:195
octave_idx_type m_nel
Definition: oct-lvalue.h:109
void unary_op(octave_value::unary_op op)
Definition: oct-lvalue.cc:209
bool is_defined(void) const
Definition: oct-lvalue.cc:40
void mark_black_hole(void)
Definition: oct-lvalue.h:57
octave_lvalue & operator=(const octave_lvalue &)=delete
unary_op
Definition: ov.h:77
assign_op
Definition: ov.h:132
bool isstruct(void) const
Definition: ov.h:694