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 |
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
20 |
|
21 */ |
|
22 |
1687
|
23 #if !defined (octave_chMatrix_int_h) |
|
24 #define octave_chMatrix_int_h 1 |
1573
|
25 |
1728
|
26 #include <string> |
|
27 |
1989
|
28 #include "MArray2.h" |
1573
|
29 |
|
30 #include "mx-defs.h" |
2349
|
31 #include "str-vec.h" |
1573
|
32 |
1728
|
33 class |
|
34 charMatrix : public MArray2<char> |
1573
|
35 { |
|
36 friend class ComplexMatrix; |
|
37 |
|
38 public: |
|
39 |
|
40 charMatrix (void) : MArray2<char> () { } |
|
41 charMatrix (int r, int c) : MArray2<char> (r, c) { } |
|
42 charMatrix (int r, int c, char val) : MArray2<char> (r, c, val) { } |
|
43 charMatrix (const MArray2<char>& a) : MArray2<char> (a) { } |
|
44 charMatrix (const charMatrix& a) : MArray2<char> (a) { } |
3189
|
45 charMatrix (char c); |
1573
|
46 charMatrix (const char *s); |
3504
|
47 charMatrix (const std::string& s); |
2349
|
48 charMatrix (const string_vector& s); |
1573
|
49 |
|
50 charMatrix& operator = (const charMatrix& a) |
|
51 { |
|
52 MArray2<char>::operator = (a); |
|
53 return *this; |
|
54 } |
|
55 |
2384
|
56 bool operator == (const charMatrix& a) const; |
|
57 bool operator != (const charMatrix& a) const; |
1573
|
58 |
4902
|
59 charMatrix transpose (void) const { return MArray2<char>::transpose (); } |
|
60 |
1573
|
61 // destructive insert/delete/reorder operations |
|
62 |
|
63 charMatrix& insert (const char *s, int r, int c); |
|
64 charMatrix& insert (const charMatrix& a, int r, int c); |
|
65 |
3836
|
66 std::string row_as_string (int, bool strip_ws = false, bool raw = false) const; |
1573
|
67 |
3189
|
68 // resize is the destructive equivalent for this one |
|
69 |
|
70 charMatrix extract (int r1, int c1, int r2, int c2) const; |
|
71 |
4017
|
72 boolMatrix all (int dim = -1) const; |
|
73 boolMatrix any (int dim = -1) const; |
3136
|
74 |
2255
|
75 #if 0 |
1573
|
76 // i/o |
|
77 |
3504
|
78 friend std::ostream& operator << (std::ostream& os, const Matrix& a); |
|
79 friend std::istream& operator >> (std::istream& is, Matrix& a); |
1573
|
80 #endif |
|
81 |
3933
|
82 static char resize_fill_value (void) { return '\0'; } |
|
83 |
1573
|
84 private: |
|
85 |
|
86 charMatrix (char *ch, int r, int c) : MArray2<char> (ch, r, c) { } |
|
87 }; |
|
88 |
|
89 #endif |
|
90 |
|
91 /* |
|
92 ;;; Local Variables: *** |
|
93 ;;; mode: C++ *** |
|
94 ;;; End: *** |
|
95 */ |