GNU Octave  8.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-2023 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 
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 
51  octave_lvalue& operator = (const octave_lvalue&) = delete;
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 
67  void assign (octave_value::assign_op, const octave_value&);
68 
69  octave_idx_type numel (void) const;
70 
71  void set_index (const std::string& t,
72  const std::list<octave_value_list>& i);
73 
74  void clear_index (void) { m_type = ""; m_idx.clear (); }
75 
76  std::string index_type (void) const { return m_type; }
77 
78  bool index_is_empty (void) const;
79 
80  bool index_is_colon (void) const;
81 
83 
84 #if defined (OCTAVE_PROVIDE_DEPRECATED_SYMBOLS)
85  OCTAVE_DEPRECATED (7, "use 'octave_lvalue::unary_op' instead")
86  void do_unary_op (octave_value::unary_op op)
87  {
88  return unary_op (op);
89  }
90 #endif
91 
92  octave_value value (void) const;
93 
94 private:
95 
97  eval_for_numel (const std::string& type,
98  const std::list<octave_value_list>& idx) const;
99 
101 
102  std::shared_ptr<stack_frame> m_frame;
103 
105 
106  std::string m_type;
107 
108  std::list<octave_value_list> m_idx;
109 };
110 
112 
113 #endif
OCTAVE_END_NAMESPACE(octave)
void mark_black_hole(void)
Definition: oct-lvalue.h:57
std::list< octave_value_list > m_idx
Definition: oct-lvalue.h:108
octave_lvalue(const octave_lvalue &)=default
bool isstruct(void) const
Definition: oct-lvalue.h:63
bool is_black_hole(void) const
Definition: oct-lvalue.h:55
~octave_lvalue(void)=default
std::string index_type(void) const
Definition: oct-lvalue.h:76
void clear_index(void)
Definition: oct-lvalue.h:74
symbol_record m_sym
Definition: oct-lvalue.h:100
octave_lvalue(const symbol_record &sr, const std::shared_ptr< stack_frame > &frame)
Definition: oct-lvalue.h:43
bool m_black_hole
Definition: oct-lvalue.h:104
std::string m_type
Definition: oct-lvalue.h:106
std::shared_ptr< stack_frame > m_frame
Definition: oct-lvalue.h:102
unary_op
Definition: ov.h:77
assign_op
Definition: ov.h:132
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
T::size_type numel(const T &str)
Definition: oct-string.cc:71
OCTINTERP_API octave_value unary_op(type_info &ti, octave_value::unary_op op, const octave_value &a)