Mercurial > hg > octave-lyh
annotate src/Cell.h @ 7530:bb0f2353cff5
new cell array ctype mappers
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 25 Feb 2008 19:01:30 -0500 |
parents | f06b8150fe56 |
children | 3209a584e1ac |
rev | line source |
---|---|
3353 | 1 /* |
2 | |
7017 | 3 Copyright (C) 1999, 2002, 2003, 2004, 2005, 2006, 2007 John W. Eaton |
3353 | 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 | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3353 | 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 | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
3353 | 20 |
21 */ | |
22 | |
23 #if !defined (Cell_h) | |
24 #define Cell_h 1 | |
25 | |
26 #include <string> | |
27 | |
4513 | 28 #include "ArrayN.h" |
3353 | 29 #include "oct-alloc.h" |
30 #include "str-vec.h" | |
31 | |
4055 | 32 #include "oct-obj.h" |
3353 | 33 |
34 class | |
6169 | 35 OCTINTERP_API |
4513 | 36 Cell : public ArrayN<octave_value> |
3353 | 37 { |
38 public: | |
39 | |
40 Cell (void) | |
4548 | 41 : ArrayN<octave_value> (dim_vector (0, 0)) { } |
3928 | 42 |
43 Cell (const octave_value& val) | |
4513 | 44 : ArrayN<octave_value> (dim_vector (1, 1), val) { } |
45 | |
46 Cell (const octave_value_list& ovl) | |
6833 | 47 : ArrayN<octave_value> (dim_vector (1, ovl.length ())) |
4513 | 48 { |
5275 | 49 for (octave_idx_type i = 0; i < ovl.length (); i++) |
4513 | 50 elem (i) = ovl (i); |
51 } | |
3353 | 52 |
7209 | 53 Cell (octave_idx_type n, octave_idx_type m, |
54 const octave_value& val = resize_fill_value ()) | |
4513 | 55 : ArrayN<octave_value> (dim_vector (n, m), val) { } |
3353 | 56 |
4587 | 57 Cell (const dim_vector& dv, const octave_value& val = resize_fill_value ()) |
58 : ArrayN<octave_value> (dv, val) { } | |
4563 | 59 |
4513 | 60 Cell (const ArrayN<octave_value>& c) |
61 : ArrayN<octave_value> (c) { } | |
3354 | 62 |
4567 | 63 Cell (const Array<octave_value>& c) |
64 : ArrayN<octave_value> (c) { } | |
65 | |
5275 | 66 Cell (const Array<octave_value>& c, octave_idx_type nr, octave_idx_type nc) |
4513 | 67 : ArrayN<octave_value> (c, dim_vector (nr, nc)) { } |
3933 | 68 |
5805 | 69 Cell (const string_vector& sv, bool trim = false); |
4216 | 70 |
6116 | 71 Cell (const dim_vector& dv, const string_vector& sv, bool trim = false); |
72 | |
3353 | 73 Cell (const Cell& c) |
4513 | 74 : ArrayN<octave_value> (c) { } |
75 | |
6116 | 76 bool is_cellstr (void) const; |
77 | |
4513 | 78 Cell index (const octave_value_list& idx, bool resize_ok = false) const; |
79 | |
80 Cell index (idx_vector& i, int resize_ok = 0, | |
81 const octave_value& rfv = resize_fill_value ()) const | |
4567 | 82 { return Cell (ArrayN<octave_value>::index (i, resize_ok, rfv)); } |
4513 | 83 |
84 Cell index (idx_vector& i, idx_vector& j, int resize_ok = 0, | |
85 const octave_value& rfv = resize_fill_value ()) const | |
4567 | 86 { return Cell (ArrayN<octave_value>::index (i, j, resize_ok, rfv)); } |
4513 | 87 |
88 Cell index (Array<idx_vector>& ra_idx, int resize_ok = 0, | |
89 const octave_value& rfv = resize_fill_value ()) const | |
4567 | 90 { return Cell (ArrayN<octave_value>::index (ra_idx, resize_ok, rfv)); } |
4513 | 91 |
92 Cell& assign (const octave_value_list& idx, const Cell& rhs, | |
93 const octave_value& fill_val = octave_value ()); | |
94 | |
4901 | 95 Cell reshape (const dim_vector& new_dims) const |
96 { return ArrayN<octave_value>::reshape (new_dims); } | |
97 | |
5602 | 98 octave_idx_type nnz (void) const; |
99 | |
5570 | 100 Cell column (octave_idx_type i) const; |
101 | |
5775 | 102 // FIXME |
4932 | 103 boolMatrix all (int /* dim */ = 0) const { return boolMatrix (); } |
3933 | 104 |
5775 | 105 // FIXME |
4932 | 106 boolMatrix any (int /* dim */ = 0) const { return boolMatrix (); } |
3933 | 107 |
5275 | 108 Cell concat (const Cell& rb, const Array<octave_idx_type>& ra_idx); |
4915 | 109 |
5275 | 110 Cell& insert (const Cell& a, octave_idx_type r, octave_idx_type c); |
111 Cell& insert (const Cell& a, const Array<octave_idx_type>& ra_idx); | |
4806 | 112 |
5775 | 113 // FIXME |
3933 | 114 bool is_true (void) const { return false; } |
115 | |
4219 | 116 static octave_value resize_fill_value (void) { return Matrix (); } |
7530
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
117 |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
118 Cell xisalnum (void) const { return map (&octave_value::xisalnum); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
119 Cell xisalpha (void) const { return map (&octave_value::xisalpha); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
120 Cell xisascii (void) const { return map (&octave_value::xisascii); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
121 Cell xiscntrl (void) const { return map (&octave_value::xiscntrl); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
122 Cell xisdigit (void) const { return map (&octave_value::xisdigit); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
123 Cell xisgraph (void) const { return map (&octave_value::xisgraph); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
124 Cell xislower (void) const { return map (&octave_value::xislower); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
125 Cell xisprint (void) const { return map (&octave_value::xisprint); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
126 Cell xispunct (void) const { return map (&octave_value::xispunct); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
127 Cell xisspace (void) const { return map (&octave_value::xisspace); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
128 Cell xisupper (void) const { return map (&octave_value::xisupper); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
129 Cell xisxdigit (void) const { return map (&octave_value::xisxdigit); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
130 Cell xtoascii (void) const { return map (&octave_value::xtoascii); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
131 Cell xtolower (void) const { return map (&octave_value::xtolower); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
132 Cell xtoupper (void) const { return map (&octave_value::xtoupper); } |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
133 |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
134 private: |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
135 |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
136 typedef octave_value (octave_value::*ctype_mapper) (void) const; |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
137 |
bb0f2353cff5
new cell array ctype mappers
John W. Eaton <jwe@octave.org>
parents:
7209
diff
changeset
|
138 Cell map (ctype_mapper) const; |
3353 | 139 }; |
140 | |
141 #endif | |
142 | |
143 /* | |
144 ;;; Local Variables: *** | |
145 ;;; mode: C++ *** | |
146 ;;; End: *** | |
147 */ |