GNU Octave  9.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
ov-cs-list.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2002-2024 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_ov_cs_list_h)
27 #define octave_ov_cs_list_h 1
28 
29 #include "octave-config.h"
30 
31 #include <cstdlib>
32 
33 #include <iosfwd>
34 #include <string>
35 
36 #include "mx-base.h"
37 #include "str-vec.h"
38 
39 #include "Cell.h"
40 #include "error.h"
41 #include "ovl.h"
42 #include "ov-typeinfo.h"
43 
44 // Lists.
45 
46 class
48 {
49 public:
50 
52  : octave_base_value (), m_list () { }
53 
55  : octave_base_value (), m_list (l) { }
56 
57  octave_cs_list (const Cell& c);
58 
60  : octave_base_value (), m_list (l.m_list) { }
61 
62  ~octave_cs_list () = default;
63 
64  octave_base_value * clone () const { return new octave_cs_list (*this); }
65  octave_base_value * empty_clone () const { return new octave_cs_list (); }
66 
67  dim_vector dims () const { return dim_vector (1, m_list.length ()); }
68 
69  bool is_defined () const { return true; }
70 
71  bool is_constant () const { return true; }
72 
73  bool is_cs_list () const { return true; }
74 
75  octave_value_list list_value () const { return m_list; }
76 
77  // We don't need to override all three forms of subsref. The using
78  // declaration will avoid warnings about partially-overloaded virtual
79  // functions.
81 
82  OCTINTERP_API octave_value
83  subsref (const std::string& type, const std::list<octave_value_list>& idx);
84 
85  OCTINTERP_API octave_value_list
86  subsref (const std::string& type, const std::list<octave_value_list>& idx,
87  int);
88 
89 private:
90 
91  // The list of Octave values.
92  octave_value_list m_list;
93 
95 };
96 
97 #endif
Definition: Cell.h:43
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:94
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition: ov-base.cc:248
octave_base_value * empty_clone() const
Definition: ov-cs-list.h:65
bool is_defined() const
Definition: ov-cs-list.h:69
dim_vector dims() const
Definition: ov-cs-list.h:67
octave_cs_list(const octave_value_list &l)
Definition: ov-cs-list.h:54
bool is_constant() const
Definition: ov-cs-list.h:71
octave_base_value * clone() const
Definition: ov-cs-list.h:64
~octave_cs_list()=default
bool is_cs_list() const
Definition: ov-cs-list.h:73
octave_value_list list_value() const
Definition: ov-cs-list.h:75
octave_cs_list(const octave_cs_list &l)
Definition: ov-cs-list.h:59
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA
Definition: ov-base.h:181