]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathMatrix.cpp
Coding style
[lyx.git] / src / mathed / InsetMathMatrix.cpp
1 /**
2  * \file InsetMathMatrix.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author André Pönitz
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "InsetMathMatrix.h"
14 #include "MathData.h"
15 #include "MathStream.h"
16
17
18 namespace lyx {
19
20 InsetMathMatrix::InsetMathMatrix(InsetMathGrid const & p)
21         : InsetMathGrid(p)
22 {}
23
24
25 Inset * InsetMathMatrix::clone() const
26 {
27         return new InsetMathMatrix(*this);
28 }
29
30
31 void InsetMathMatrix::write(WriteStream & os) const
32 {
33         InsetMathGrid::write(os);
34 }
35
36
37 void InsetMathMatrix::normalize(NormalStream & os) const
38 {
39         InsetMathGrid::normalize(os);
40 }
41
42
43 void InsetMathMatrix::maple(MapleStream & os) const
44 {
45         os << "matrix(" << int(nrows()) << ',' << int(ncols()) << ",[";
46         for (idx_type idx = 0; idx < nargs(); ++idx) {
47                 if (idx)
48                         os << ',';
49                 os << cell(idx);
50         }
51         os << "])";
52 }
53
54
55 void InsetMathMatrix::maxima(MaximaStream & os) const
56 {
57         os << "matrix(";
58         for (row_type row = 0; row < nrows(); ++row) {
59                 if (row)
60                         os << ',';
61                 os << '[';
62                 for (col_type col = 0; col < ncols(); ++col) {
63                         if (col)
64                                 os << ',';
65                         os << cell(index(row, col));
66                 }
67                 os << ']';
68         }
69         os << ')';
70 }
71
72
73 void InsetMathMatrix::mathematica(MathematicaStream & os) const
74 {
75         os << '{';
76         for (row_type row = 0; row < nrows(); ++row) {
77                 if (row)
78                         os << ',';
79                 os << '{';
80                 for (col_type col = 0; col < ncols(); ++col) {
81                         if (col)
82                                 os << ',';
83                         os << cell(index(row, col));
84                 }
85                 os << '}';
86         }
87         os << '}';
88 }
89
90
91 void InsetMathMatrix::mathmlize(MathStream & os) const
92 {
93         InsetMathGrid::mathmlize(os);
94 }
95
96
97 void InsetMathMatrix::octave(OctaveStream & os) const
98 {
99         os << '[';
100         for (row_type row = 0; row < nrows(); ++row) {
101                 if (row)
102                         os << ';';
103                 os << '[';
104                 for (col_type col = 0; col < ncols(); ++col)
105                         os << cell(index(row, col)) << ' ';
106                 os << ']';
107         }
108         os << ']';
109 }
110
111
112 } // namespace lyx