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 |
5307
|
19 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
20 02110-1301, USA. |
2376
|
21 |
|
22 */ |
|
23 |
|
24 #if !defined (octave_char_matrix_h) |
|
25 #define octave_char_matrix_h 1 |
|
26 |
|
27 #include <cstdlib> |
|
28 |
3503
|
29 #include <iostream> |
2376
|
30 #include <string> |
|
31 |
|
32 #include "mx-base.h" |
2477
|
33 #include "oct-alloc.h" |
2376
|
34 #include "str-vec.h" |
|
35 |
|
36 #include "error.h" |
|
37 #include "ov-base.h" |
4513
|
38 |
3219
|
39 #include "ov-base-mat.h" |
2376
|
40 #include "ov-typeinfo.h" |
|
41 |
|
42 class Octave_map; |
|
43 class octave_value_list; |
|
44 |
|
45 class tree_walker; |
|
46 |
2477
|
47 // Character matrix values. |
2376
|
48 |
|
49 class |
4513
|
50 octave_char_matrix : public octave_base_matrix<charNDArray> |
2376
|
51 { |
|
52 public: |
|
53 |
|
54 octave_char_matrix (void) |
4513
|
55 : octave_base_matrix<charNDArray> () { } |
2376
|
56 |
|
57 octave_char_matrix (const charMatrix& chm, bool = false) |
4513
|
58 : octave_base_matrix<charNDArray> (chm) { } |
|
59 |
|
60 octave_char_matrix (const charNDArray& chm, bool = false) |
|
61 : octave_base_matrix<charNDArray> (chm) { } |
2376
|
62 |
3189
|
63 octave_char_matrix (char c) |
4513
|
64 : octave_base_matrix<charNDArray> (c) { } |
3189
|
65 |
2376
|
66 octave_char_matrix (const char *s) |
4513
|
67 : octave_base_matrix<charNDArray> (s) { } |
2376
|
68 |
3523
|
69 octave_char_matrix (const std::string& s) |
4513
|
70 : octave_base_matrix<charNDArray> (s) { } |
2376
|
71 |
|
72 octave_char_matrix (const string_vector& s) |
4513
|
73 : octave_base_matrix<charNDArray> (s) { } |
2376
|
74 |
|
75 octave_char_matrix (const octave_char_matrix& chm) |
4513
|
76 : octave_base_matrix<charNDArray> (chm) { } |
2376
|
77 |
|
78 ~octave_char_matrix (void) { } |
|
79 |
3933
|
80 octave_value *clone (void) const { return new octave_char_matrix (*this); } |
|
81 octave_value *empty_clone (void) const { return new octave_char_matrix (); } |
2376
|
82 |
5267
|
83 idx_vector index_vector (void) const |
|
84 { return idx_vector (array_value (true)); } |
|
85 |
2376
|
86 bool is_char_matrix (void) const { return true; } |
3180
|
87 bool is_real_matrix (void) const { return true; } |
2376
|
88 |
|
89 bool is_real_type (void) const { return true; } |
|
90 |
|
91 bool valid_as_scalar_index (void) const; |
|
92 |
|
93 double double_value (bool = false) const; |
|
94 |
3145
|
95 double scalar_value (bool frc_str_conv = false) const |
|
96 { return double_value (frc_str_conv); } |
2916
|
97 |
4513
|
98 Matrix matrix_value (bool = false) const |
|
99 { return Matrix (matrix.matrix_value ()); } |
2376
|
100 |
4668
|
101 NDArray array_value (bool = false) const |
|
102 { return NDArray (matrix); } |
|
103 |
2376
|
104 Complex complex_value (bool = false) const; |
|
105 |
3145
|
106 ComplexMatrix complex_matrix_value (bool = false) const |
4513
|
107 { return ComplexMatrix (matrix.matrix_value ()); } |
2376
|
108 |
4668
|
109 ComplexNDArray complex_array_value (bool = false) const |
|
110 { return ComplexNDArray (matrix); } |
|
111 |
3145
|
112 charMatrix char_matrix_value (bool = false) const |
4513
|
113 { return matrix.matrix_value (); } |
2376
|
114 |
4550
|
115 charNDArray char_array_value (bool = false) const |
4543
|
116 { return matrix; } |
|
117 |
5279
|
118 octave_value convert_to_str_internal (bool, bool, char type) const |
|
119 { return octave_value (matrix, true, type); } |
2449
|
120 |
4643
|
121 void print_raw (std::ostream& os, bool pr_as_read_syntax = false) const; |
|
122 |
2376
|
123 protected: |
|
124 |
3219
|
125 DECLARE_OCTAVE_ALLOCATOR |
2477
|
126 |
3219
|
127 DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA |
2376
|
128 }; |
|
129 |
|
130 #endif |
|
131 |
|
132 /* |
|
133 ;;; Local Variables: *** |
|
134 ;;; mode: C++ *** |
|
135 ;;; End: *** |
|
136 */ |