2376
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
2376
|
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" |
2477
|
37 #include "oct-alloc.h" |
2376
|
38 #include "str-vec.h" |
|
39 |
|
40 #include "error.h" |
|
41 #include "ov-base.h" |
3219
|
42 #include "ov-base-mat.h" |
2376
|
43 #include "ov-typeinfo.h" |
|
44 |
|
45 class Octave_map; |
|
46 class octave_value_list; |
|
47 |
|
48 class tree_walker; |
|
49 |
2477
|
50 // Character matrix values. |
2376
|
51 |
|
52 class |
3219
|
53 octave_char_matrix : public octave_base_matrix<charMatrix> |
2376
|
54 { |
|
55 public: |
|
56 |
|
57 octave_char_matrix (void) |
3219
|
58 : octave_base_matrix<charMatrix> () { } |
2376
|
59 |
|
60 octave_char_matrix (const charMatrix& chm, bool = false) |
3219
|
61 : octave_base_matrix<charMatrix> (chm) { } |
2376
|
62 |
3189
|
63 octave_char_matrix (char c) |
3219
|
64 : octave_base_matrix<charMatrix> (c) { } |
3189
|
65 |
2376
|
66 octave_char_matrix (const char *s) |
3219
|
67 : octave_base_matrix<charMatrix> (s) { } |
2376
|
68 |
|
69 octave_char_matrix (const string& s) |
3219
|
70 : octave_base_matrix<charMatrix> (s) { } |
2376
|
71 |
|
72 octave_char_matrix (const string_vector& s) |
3219
|
73 : octave_base_matrix<charMatrix> (s) { } |
2376
|
74 |
|
75 octave_char_matrix (const octave_char_matrix& chm) |
3219
|
76 : octave_base_matrix<charMatrix> (chm) { } |
2376
|
77 |
|
78 ~octave_char_matrix (void) { } |
|
79 |
|
80 octave_value *clone (void) { return new octave_char_matrix (*this); } |
|
81 |
|
82 bool is_char_matrix (void) const { return true; } |
3180
|
83 bool is_real_matrix (void) const { return true; } |
2376
|
84 |
|
85 bool is_real_type (void) const { return true; } |
|
86 |
|
87 bool valid_as_scalar_index (void) const; |
|
88 |
|
89 double double_value (bool = false) const; |
|
90 |
3145
|
91 double scalar_value (bool frc_str_conv = false) const |
|
92 { return double_value (frc_str_conv); } |
2916
|
93 |
2376
|
94 Matrix matrix_value (bool = false) const { return matrix; } |
|
95 |
|
96 Complex complex_value (bool = false) const; |
|
97 |
3145
|
98 ComplexMatrix complex_matrix_value (bool = false) const |
|
99 { return matrix; } |
2376
|
100 |
3145
|
101 charMatrix char_matrix_value (bool = false) const |
|
102 { return matrix; } |
2376
|
103 |
2449
|
104 octave_value convert_to_str (void) const |
3110
|
105 { return octave_value (matrix, true); } |
2449
|
106 |
2376
|
107 protected: |
|
108 |
3219
|
109 DECLARE_OCTAVE_ALLOCATOR |
2477
|
110 |
3219
|
111 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2376
|
112 }; |
|
113 |
|
114 #endif |
|
115 |
|
116 /* |
|
117 ;;; Local Variables: *** |
|
118 ;;; mode: C++ *** |
|
119 ;;; End: *** |
|
120 */ |