Mercurial > hg > octave-lyh
annotate src/ov-list.h @ 8500:aaddb450b9aa
[docs] can not => cannot
author | Brian Gough <bjg@gnu.org> |
---|---|
date | Tue, 13 Jan 2009 00:36:52 -0500 |
parents | 443a8f5a50fd |
children | eb63fbe60fab |
rev | line source |
---|---|
2882 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003, 2004, 2005, 2006, |
4 2007 John W. Eaton | |
2882 | 5 |
6 This file is part of Octave. | |
7 | |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
2882 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
2882 | 21 |
22 */ | |
23 | |
24 #if !defined (octave_list_h) | |
25 #define octave_list_h 1 | |
26 | |
27 #include <cstdlib> | |
28 | |
3503 | 29 #include <iostream> |
2882 | 30 #include <string> |
31 | |
32 #include "mx-base.h" | |
33 #include "str-vec.h" | |
34 | |
4591 | 35 #include "Cell.h" |
2882 | 36 #include "error.h" |
37 #include "oct-alloc.h" | |
38 #include "ov-base.h" | |
39 #include "ov-typeinfo.h" | |
40 | |
41 class tree_walker; | |
42 | |
43 // Lists. | |
44 | |
45 class | |
46 octave_list : public octave_base_value | |
47 { | |
48 public: | |
49 | |
50 octave_list (void) | |
51 : octave_base_value () { } | |
52 | |
53 octave_list (const octave_value_list& l) | |
4591 | 54 : octave_base_value (), data (l) { } |
2882 | 55 |
4513 | 56 octave_list (const Cell& c); |
57 | |
2882 | 58 octave_list (const octave_list& l) |
4591 | 59 : octave_base_value (), data (l.data) { } |
2882 | 60 |
61 ~octave_list (void) { } | |
62 | |
5759 | 63 octave_base_value *clone (void) const { return new octave_list (*this); } |
64 octave_base_value *empty_clone (void) const { return new octave_list (); } | |
3933 | 65 |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
66 octave_value subsref (const std::string& type, |
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
67 const std::list<octave_value_list>& idx) |
4271 | 68 { |
7651
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
69 octave_value_list tmp = subsref (type, idx, 1); |
443a8f5a50fd
require both subsref variants to be defined in octave_value subclasses
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
70 return tmp.length () > 0 ? tmp(0) : octave_value (); |
4271 | 71 } |
72 | |
4994 | 73 octave_value_list subsref (const std::string& type, |
74 const std::list<octave_value_list>& idx, | |
75 int nargout); | |
76 | |
5885 | 77 octave_value do_index_op (const octave_value_list& idx, |
78 bool resize_ok = false); | |
3933 | 79 |
4247 | 80 octave_value subsasgn (const std::string& type, |
4219 | 81 const std::list<octave_value_list>& idx, |
3933 | 82 const octave_value& rhs); |
2882 | 83 |
3196 | 84 void assign (const octave_value_list& idx, const octave_value& rhs); |
85 | |
4591 | 86 dim_vector dims (void) const { return dim_vector (1, data.length ()); } |
4559 | 87 |
4791 | 88 size_t byte_size (void) const; |
89 | |
2882 | 90 bool is_defined (void) const { return true; } |
91 | |
92 bool is_list (void) const { return true; } | |
93 | |
4591 | 94 octave_value_list list_value (void) const; |
2882 | 95 |
3523 | 96 void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
2901 | 97 |
3523 | 98 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
2901 | 99 |
3523 | 100 bool print_name_tag (std::ostream& os, const std::string& name) const; |
2882 | 101 |
6974 | 102 bool save_ascii (std::ostream& os); |
4687 | 103 |
104 bool load_ascii (std::istream& is); | |
105 | |
106 bool save_binary (std::ostream& os, bool& save_as_floats); | |
107 | |
108 bool load_binary (std::istream& is, bool swap, | |
109 oct_mach_info::float_format fmt); | |
110 | |
111 #if defined (HAVE_HDF5) | |
112 bool save_hdf5 (hid_t loc_id, const char *name, bool save_as_floats); | |
113 | |
114 bool load_hdf5 (hid_t loc_id, const char *name, bool have_h5giterate_bug); | |
115 #endif | |
116 | |
4499 | 117 protected: |
2882 | 118 |
119 // The list of Octave values. | |
4591 | 120 Cell data; |
2882 | 121 |
4499 | 122 private: |
123 | |
4612 | 124 DECLARE_OCTAVE_ALLOCATOR |
2882 | 125 |
4612 | 126 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2882 | 127 }; |
128 | |
129 #endif | |
130 | |
131 /* | |
132 ;;; Local Variables: *** | |
133 ;;; mode: C++ *** | |
134 ;;; End: *** | |
135 */ |