]> git.lyx.org Git - lyx.git/blob - src/mathed/InsetMathDiff.cpp
use bald pointers in clone()
[lyx.git] / src / mathed / InsetMathDiff.cpp
1 /**
2  * \file InsetMathDiff.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 "InsetMathDiff.h"
14 #include "MathData.h"
15 #include "MathStream.h"
16 #include "debug.h"
17
18
19 namespace lyx {
20
21 using std::endl;
22
23
24 InsetMathDiff::InsetMathDiff()
25         : InsetMathNest(1)
26 {}
27
28
29 Inset * InsetMathDiff::clone() const
30 {
31         return new InsetMathDiff(*this);
32 }
33
34
35 void InsetMathDiff::addDer(MathData const & der)
36 {
37         cells_.push_back(der);
38 }
39
40
41 void InsetMathDiff::normalize(NormalStream & os) const
42 {
43         os << "[diff";
44         for (idx_type idx = 0; idx < nargs(); ++idx)
45                 os << ' ' << cell(idx);
46         os << ']';
47 }
48
49
50 bool InsetMathDiff::metrics(MetricsInfo &, Dimension &) const
51 {
52         lyxerr << "should not happen" << endl;
53         return true;
54 }
55
56
57 void InsetMathDiff::draw(PainterInfo &, int, int) const
58 {
59         lyxerr << "should not happen" << endl;
60 }
61
62
63 void InsetMathDiff::maple(MapleStream & os) const
64 {
65         os << "diff(";
66         for (idx_type idx = 0; idx < nargs(); ++idx) {
67                 if (idx != 0)
68                         os << ',';
69                 os << cell(idx);
70         }
71         os << ')';
72 }
73
74
75 void InsetMathDiff::maxima(MaximaStream & os) const
76 {
77         os << "diff(";
78         for (idx_type idx = 0; idx < nargs(); ++idx) {
79                 if (idx != 0)
80                         os << ',';
81                 os << cell(idx);
82                 if (idx != 0)
83                         os << ",1";
84         }
85         os << ')';
86 }
87
88
89 void InsetMathDiff::mathematica(MathematicaStream & os) const
90 {
91         os << "D[";
92         for (idx_type idx = 0; idx < nargs(); ++idx) {
93                 if (idx != 0)
94                         os << ',';
95                 os << cell(idx);
96         }
97         os << ']';
98 }
99
100
101 void InsetMathDiff::mathmlize(MathStream & os) const
102 {
103         os << "diff(";
104         for (idx_type idx = 0; idx < nargs(); ++idx) {
105                 if (idx != 0)
106                         os << ',';
107                 os << cell(idx);
108         }
109         os << ')';
110 }
111
112
113 void InsetMathDiff::write(WriteStream &) const
114 {
115         lyxerr << "should not happen" << endl;
116 }
117
118
119 } // namespace lyx