2376
|
1 /* |
|
2 |
|
3 Copyright (C) 1996 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_char_matrix_h) |
|
24 #define octave_char_matrix_h 1 |
|
25 |
|
26 #if defined (__GNUG__) |
|
27 #pragma interface |
|
28 #endif |
|
29 |
|
30 #include <cstdlib> |
|
31 |
|
32 #include <string> |
|
33 |
|
34 class ostream; |
|
35 |
|
36 #include "mx-base.h" |
|
37 #include "str-vec.h" |
|
38 |
|
39 #include "error.h" |
|
40 #include "ov-base.h" |
|
41 #include "ov-typeinfo.h" |
|
42 |
|
43 class Octave_map; |
|
44 class octave_value_list; |
|
45 |
|
46 class tree_walker; |
|
47 |
|
48 // Real scalar values. |
|
49 |
|
50 class |
|
51 octave_char_matrix : public octave_base_value |
|
52 { |
|
53 public: |
|
54 |
|
55 octave_char_matrix (void) |
|
56 : octave_base_value () { } |
|
57 |
|
58 octave_char_matrix (const charMatrix& chm, bool = false) |
|
59 : octave_base_value (), matrix (chm) { } |
|
60 |
|
61 octave_char_matrix (const char *s) |
|
62 : octave_base_value (), matrix (s) { } |
|
63 |
|
64 octave_char_matrix (const string& s) |
|
65 : octave_base_value (), matrix (s) { } |
|
66 |
|
67 octave_char_matrix (const string_vector& s) |
|
68 : octave_base_value (), matrix (s) { } |
|
69 |
|
70 octave_char_matrix (const octave_char_matrix& chm) |
|
71 : octave_base_value (), matrix (chm.matrix) { } |
|
72 |
|
73 ~octave_char_matrix (void) { } |
|
74 |
|
75 octave_value *clone (void) { return new octave_char_matrix (*this); } |
|
76 |
|
77 #if 0 |
|
78 void *operator new (size_t size); |
|
79 void operator delete (void *p, size_t size); |
|
80 #endif |
|
81 |
|
82 int rows (void) const { return matrix.rows (); } |
|
83 int columns (void) const { return matrix.columns (); } |
|
84 |
|
85 bool is_defined (void) const { return true; } |
|
86 |
|
87 bool is_char_matrix (void) const { return true; } |
|
88 |
|
89 // XXX FIXME XXX |
2431
|
90 octave_value all (void) const { return 0.0; } |
|
91 octave_value any (void) const { return 0.0; } |
2376
|
92 |
|
93 bool is_real_type (void) const { return true; } |
|
94 |
|
95 bool is_matrix_type (void) const { return true; } |
|
96 |
|
97 bool is_numeric_type (void) const { return true; } |
|
98 |
|
99 bool valid_as_scalar_index (void) const; |
|
100 bool valid_as_zero_index (void) const; |
|
101 |
|
102 bool is_true (void) const; |
|
103 |
|
104 double double_value (bool = false) const; |
|
105 |
|
106 Matrix matrix_value (bool = false) const { return matrix; } |
|
107 |
|
108 Complex complex_value (bool = false) const; |
|
109 |
|
110 ComplexMatrix complex_matrix_value (bool = false) const { return matrix; } |
|
111 |
|
112 charMatrix char_matrix_value (bool = false) const { return matrix; } |
|
113 |
2449
|
114 octave_value convert_to_str (void) const |
|
115 { return octave_value (matrix); } |
|
116 |
2466
|
117 void print (ostream& os, bool pr_as_read_syntax = false); |
2376
|
118 |
|
119 int type_id (void) const { return t_id; } |
|
120 |
|
121 string type_name (void) const { return t_name; } |
|
122 |
|
123 static int static_type_id (void) { return t_id; } |
|
124 |
|
125 static void register_type (void) |
|
126 { t_id = octave_value_typeinfo::register_type (t_name); } |
|
127 |
|
128 protected: |
|
129 |
|
130 charMatrix matrix; |
|
131 |
|
132 static int t_id; |
|
133 |
|
134 static const string t_name; |
|
135 }; |
|
136 |
|
137 #endif |
|
138 |
|
139 /* |
|
140 ;;; Local Variables: *** |
|
141 ;;; mode: C++ *** |
|
142 ;;; End: *** |
|
143 */ |