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