GNU Octave  6.2.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-2021 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 (), lst () { }
53 
55  : octave_base_value (), lst (l) { }
56 
57  octave_cs_list (const Cell& c);
58 
60  : octave_base_value (), lst (l.lst) { }
61 
62  ~octave_cs_list (void) = default;
63 
64  octave_base_value * clone (void) const { return new octave_cs_list (*this); }
65  octave_base_value * empty_clone (void) const { return new octave_cs_list (); }
66 
67  dim_vector dims (void) const { return dim_vector (1, lst.length ()); }
68 
69  bool is_defined (void) const { return true; }
70 
71  bool is_constant (void) const { return true; }
72 
73  bool is_cs_list (void) const { return true; }
74 
75  octave_value_list list_value (void) const { return lst; }
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  octave_value subsref (const std::string& type,
83  const std::list<octave_value_list>& idx);
84 
85  octave_value_list subsref (const std::string& type,
86  const std::list<octave_value_list>& idx, int);
87 
88 private:
89 
90  // The list of Octave values.
92 
94 };
95 
96 #endif
Definition: Cell.h:43
Vector representing the dimensions (size) of an Array.
Definition: dim-vector.h:95
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition: ov-base.cc:201
octave_base_value * clone(void) const
Definition: ov-cs-list.h:64
bool is_defined(void) const
Definition: ov-cs-list.h:69
octave_cs_list(const octave_value_list &l)
Definition: ov-cs-list.h:54
octave_cs_list(void)
Definition: ov-cs-list.h:51
~octave_cs_list(void)=default
dim_vector dims(void) const
Definition: ov-cs-list.h:67
octave_value_list lst
Definition: ov-cs-list.h:91
octave_base_value * empty_clone(void) const
Definition: ov-cs-list.h:65
bool is_cs_list(void) const
Definition: ov-cs-list.h:73
bool is_constant(void) const
Definition: ov-cs-list.h:71
octave_value_list list_value(void) 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:158