GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
ov-cs-list.h
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////
2//
3// Copyright (C) 2002-2025 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
47{
48public:
49
51 : octave_base_value (), m_list () { }
52
54 : octave_base_value (), m_list (l) { }
55
56 octave_cs_list (const Cell& c);
57
59 : octave_base_value (), m_list (l.m_list) { }
60
61 ~octave_cs_list () = default;
62
63 octave_base_value * clone () const { return new octave_cs_list (*this); }
64 octave_base_value * empty_clone () const { return new octave_cs_list (); }
65
66 dim_vector dims () const { return dim_vector (1, m_list.length ()); }
67
68 bool is_defined () const { return true; }
69
70 bool is_constant () const { return true; }
71
72 bool is_cs_list () const { return true; }
73
74 octave_value_list list_value () const { return m_list; }
75
76 // We don't need to override all three forms of subsref. The using
77 // declaration will avoid warnings about partially-overloaded virtual
78 // functions.
80
81 OCTINTERP_API octave_value
82 subsref (const std::string& type, const std::list<octave_value_list>& idx);
83
84 OCTINTERP_API octave_value_list
85 subsref (const std::string& type, const std::list<octave_value_list>& idx,
86 int);
87
88private:
89
90 // The list of Octave values.
91 octave_value_list m_list;
92
94};
95
96#endif
Definition Cell.h:41
Vector representing the dimensions (size) of an Array.
Definition dim-vector.h:90
virtual octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition ov-base.cc:245
bool is_defined() const
Definition ov-cs-list.h:68
dim_vector dims() const
Definition ov-cs-list.h:66
octave_cs_list(const octave_value_list &l)
Definition ov-cs-list.h:53
bool is_constant() const
Definition ov-cs-list.h:70
~octave_cs_list()=default
bool is_cs_list() const
Definition ov-cs-list.h:72
octave_value_list list_value() const
Definition ov-cs-list.h:74
octave_base_value * clone() const
Definition ov-cs-list.h:63
octave_base_value * empty_clone() const
Definition ov-cs-list.h:64
octave_value subsref(const std::string &type, const std::list< octave_value_list > &idx)
Definition ov-cs-list.cc:46
octave_cs_list(const octave_cs_list &l)
Definition ov-cs-list.h:58
octave_idx_type length() const
Definition ovl.h:111
#define DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA_API(API)
Definition ov-base.h:185