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 (__GNUG__) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
|
27 #ifdef HAVE_CONFIG_H |
|
28 #include <config.h> |
|
29 #endif |
|
30 |
|
31 #include "lo-ieee.h" |
|
32 #include "mx-base.h" |
|
33 |
|
34 #include "ops.h" |
|
35 #include "ov-re-mat.h" |
|
36 #include "ov-str-mat.h" |
|
37 #include "gripes.h" |
|
38 #include "pr-output.h" |
|
39 |
|
40 int octave_char_matrix_str::t_id = -1; |
|
41 |
|
42 const string octave_char_matrix_str::t_name ("string"); |
|
43 |
|
44 static octave_value * |
|
45 default_numeric_conversion_function (const octave_value& a) |
|
46 { |
|
47 CAST_CONV_ARG (const octave_char_matrix_str&); |
|
48 |
|
49 return new octave_matrix (v.matrix_value ()); |
|
50 } |
|
51 |
|
52 octave_value::numeric_conv_fcn |
|
53 octave_char_matrix_str::numeric_conversion_function (void) const |
|
54 { |
|
55 return default_numeric_conversion_function; |
|
56 } |
|
57 |
|
58 octave_value |
|
59 octave_char_matrix_str::all (void) const |
|
60 { |
|
61 octave_value retval; |
|
62 error ("octave_char_matrix_str::all(): not implemented"); |
|
63 return retval; |
|
64 } |
|
65 |
|
66 octave_value |
|
67 octave_char_matrix_str::any (void) const |
|
68 { |
|
69 octave_value retval; |
|
70 error ("octave_char_matrix_str::any(): not implemented"); |
|
71 return retval; |
|
72 } |
|
73 |
|
74 bool |
|
75 octave_char_matrix_str::valid_as_scalar_index (void) const |
|
76 { |
|
77 bool retval = false; |
|
78 error ("octave_char_matrix_str::valid_as_scalar_index(): not implemented"); |
|
79 return retval; |
|
80 } |
|
81 bool |
|
82 octave_char_matrix_str::valid_as_zero_index (void) const |
|
83 { |
|
84 bool retval = false; |
|
85 error ("octave_char_matrix_str::valid_as_zero_index(): not implemented"); |
|
86 return retval; |
|
87 } |
|
88 |
|
89 bool |
|
90 octave_char_matrix_str::is_true (void) const |
|
91 { |
|
92 bool retval = false; |
|
93 error ("octave_char_matrix_str::is_true(): not implemented"); |
|
94 return retval; |
|
95 } |
|
96 |
|
97 Matrix |
|
98 octave_char_matrix_str::matrix_value (bool force_string_conv) const |
|
99 { |
|
100 Matrix retval; |
|
101 |
|
102 int flag = force_string_conv; |
|
103 |
|
104 if (! flag) |
|
105 flag = Vimplicit_str_to_num_ok; |
|
106 |
|
107 if (flag < 0) |
|
108 gripe_implicit_conversion ("string", "real matrix"); |
|
109 |
|
110 if (flag) |
|
111 retval = Matrix (matrix); |
|
112 else |
|
113 gripe_invalid_conversion ("string", "real matrix"); |
|
114 |
|
115 return retval; |
|
116 } |
|
117 |
|
118 charMatrix |
|
119 octave_char_matrix_str::all_strings (void) const |
|
120 { |
|
121 charMatrix retval; |
|
122 error ("octave_char_matrix_str::all_strings(): not implemented"); |
|
123 return retval; |
|
124 } |
|
125 |
|
126 string |
|
127 octave_char_matrix_str::string_value (void) const |
|
128 { |
|
129 return matrix.row_as_string (0); // XXX FIXME??? XXX |
|
130 } |
|
131 |
|
132 void |
|
133 octave_char_matrix_str::print (ostream& os) |
|
134 { |
|
135 octave_print_internal (os, matrix, false, true, struct_indent); |
|
136 } |
|
137 |
|
138 /* |
|
139 ;;; Local Variables: *** |
|
140 ;;; mode: C++ *** |
|
141 ;;; End: *** |
|
142 */ |