2882
|
1 /* |
|
2 |
|
3 Copyright (C) 1996, 1997 John W. Eaton |
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
|
23 #if !defined (octave_list_h) |
|
24 #define octave_list_h 1 |
|
25 |
4192
|
26 #if defined (__GNUG__) && defined (USE_PRAGMA_INTERFACE_IMPLEMENTATION) |
2882
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include <cstdlib> |
|
31 |
3503
|
32 #include <iostream> |
2882
|
33 #include <string> |
|
34 |
|
35 #include "mx-base.h" |
|
36 #include "str-vec.h" |
|
37 |
|
38 #include "error.h" |
|
39 #include "oct-alloc.h" |
|
40 #include "oct-obj.h" |
|
41 #include "ov-base.h" |
|
42 #include "ov-typeinfo.h" |
|
43 |
|
44 class tree_walker; |
|
45 |
|
46 // Lists. |
|
47 |
|
48 class |
|
49 octave_list : public octave_base_value |
|
50 { |
|
51 public: |
|
52 |
|
53 octave_list (void) |
|
54 : octave_base_value () { } |
|
55 |
|
56 octave_list (const octave_value_list& l) |
|
57 : octave_base_value (), lst (l) { } |
|
58 |
|
59 octave_list (const octave_list& l) |
|
60 : octave_base_value (), lst (l.lst) { } |
|
61 |
|
62 ~octave_list (void) { } |
|
63 |
3933
|
64 octave_value *clone (void) const { return new octave_list (*this); } |
|
65 octave_value *empty_clone (void) const { return new octave_list (); } |
|
66 |
4247
|
67 octave_value subsref (const std::string& type, |
4219
|
68 const std::list<octave_value_list>& idx); |
2882
|
69 |
3933
|
70 octave_value do_index_op (const octave_value_list& idx, int resize_ok); |
|
71 |
4247
|
72 octave_value subsasgn (const std::string& type, |
4219
|
73 const std::list<octave_value_list>& idx, |
3933
|
74 const octave_value& rhs); |
2882
|
75 |
3196
|
76 void assign (const octave_value_list& idx, const octave_value& rhs); |
|
77 |
|
78 int length (void) const { return lst.length (); } |
|
79 |
2882
|
80 bool is_defined (void) const { return true; } |
|
81 |
2974
|
82 bool is_constant (void) const { return true; } |
|
83 |
2882
|
84 bool is_list (void) const { return true; } |
|
85 |
|
86 octave_value_list list_value (void) const { return lst; } |
|
87 |
3523
|
88 void print (std::ostream& os, bool pr_as_read_syntax = false) const; |
2901
|
89 |
3523
|
90 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
2901
|
91 |
3523
|
92 bool print_name_tag (std::ostream& os, const std::string& name) const; |
2882
|
93 |
|
94 private: |
|
95 |
|
96 // The list of Octave values. |
|
97 octave_value_list lst; |
|
98 |
3219
|
99 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2882
|
100 |
3219
|
101 DECLARE_OCTAVE_ALLOCATOR |
2882
|
102 }; |
|
103 |
|
104 #endif |
|
105 |
|
106 /* |
|
107 ;;; Local Variables: *** |
|
108 ;;; mode: C++ *** |
|
109 ;;; End: *** |
|
110 */ |