1573
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1573
|
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. |
1573
|
21 |
|
22 */ |
|
23 |
1687
|
24 #if !defined (octave_chMatrix_int_h) |
|
25 #define octave_chMatrix_int_h 1 |
1573
|
26 |
1728
|
27 #include <string> |
|
28 |
1989
|
29 #include "MArray2.h" |
1573
|
30 |
|
31 #include "mx-defs.h" |
2349
|
32 #include "str-vec.h" |
1573
|
33 |
1728
|
34 class |
6108
|
35 OCTAVE_API |
1728
|
36 charMatrix : public MArray2<char> |
1573
|
37 { |
|
38 friend class ComplexMatrix; |
|
39 |
|
40 public: |
|
41 |
|
42 charMatrix (void) : MArray2<char> () { } |
5275
|
43 charMatrix (octave_idx_type r, octave_idx_type c) : MArray2<char> (r, c) { } |
|
44 charMatrix (octave_idx_type r, octave_idx_type c, char val) : MArray2<char> (r, c, val) { } |
1573
|
45 charMatrix (const MArray2<char>& a) : MArray2<char> (a) { } |
|
46 charMatrix (const charMatrix& a) : MArray2<char> (a) { } |
3189
|
47 charMatrix (char c); |
1573
|
48 charMatrix (const char *s); |
3504
|
49 charMatrix (const std::string& s); |
2349
|
50 charMatrix (const string_vector& s); |
1573
|
51 |
|
52 charMatrix& operator = (const charMatrix& a) |
|
53 { |
|
54 MArray2<char>::operator = (a); |
|
55 return *this; |
|
56 } |
|
57 |
2384
|
58 bool operator == (const charMatrix& a) const; |
|
59 bool operator != (const charMatrix& a) const; |
1573
|
60 |
4902
|
61 charMatrix transpose (void) const { return MArray2<char>::transpose (); } |
|
62 |
1573
|
63 // destructive insert/delete/reorder operations |
|
64 |
5275
|
65 charMatrix& insert (const char *s, octave_idx_type r, octave_idx_type c); |
|
66 charMatrix& insert (const charMatrix& a, octave_idx_type r, octave_idx_type c); |
1573
|
67 |
5275
|
68 std::string row_as_string (octave_idx_type, bool strip_ws = false, bool raw = false) const; |
1573
|
69 |
3189
|
70 // resize is the destructive equivalent for this one |
|
71 |
5275
|
72 charMatrix extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const; |
3189
|
73 |
4017
|
74 boolMatrix all (int dim = -1) const; |
|
75 boolMatrix any (int dim = -1) const; |
3136
|
76 |
2255
|
77 #if 0 |
1573
|
78 // i/o |
|
79 |
3504
|
80 friend std::ostream& operator << (std::ostream& os, const Matrix& a); |
|
81 friend std::istream& operator >> (std::istream& is, Matrix& a); |
1573
|
82 #endif |
|
83 |
3933
|
84 static char resize_fill_value (void) { return '\0'; } |
|
85 |
1573
|
86 private: |
|
87 |
5275
|
88 charMatrix (char *ch, octave_idx_type r, octave_idx_type c) : MArray2<char> (ch, r, c) { } |
1573
|
89 }; |
|
90 |
6708
|
91 MS_CMP_OP_DECLS (charMatrix, char, OCTAVE_API) |
|
92 MS_BOOL_OP_DECLS (charMatrix, char, OCTAVE_API) |
6456
|
93 |
6708
|
94 SM_CMP_OP_DECLS (char, charMatrix, OCTAVE_API) |
|
95 SM_BOOL_OP_DECLS (char, charMatrix, OCTAVE_API) |
6456
|
96 |
6708
|
97 MM_CMP_OP_DECLS (charMatrix, charMatrix, OCTAVE_API) |
|
98 MM_BOOL_OP_DECLS (charMatrix, charMatrix, OCTAVE_API) |
6456
|
99 |
|
100 MARRAY_FORWARD_DEFS (MArray2, charMatrix, char) |
|
101 |
1573
|
102 #endif |
|
103 |
|
104 /* |
|
105 ;;; Local Variables: *** |
|
106 ;;; mode: C++ *** |
|
107 ;;; End: *** |
|
108 */ |